Corrected philo tests and removed all use of penfield models in those tests - resolve...
[philo.git] / philo / models / base.py
index 46fa8d5..b41a00e 100644 (file)
@@ -36,6 +36,7 @@ class Tag(models.Model):
 
 
 class Titled(models.Model):
+       # Use of this model is deprecated.
        title = models.CharField(max_length=255)
        slug = models.SlugField(max_length=255)
        
@@ -99,7 +100,7 @@ class AttributeValue(models.Model):
                abstract = True
 
 
-#: An instance of :class:`ContentTypeSubclassLimiter` which is used to track the content types which are considered valid value models for an :class:`Attribute`.
+#: An instance of :class:`.ContentTypeSubclassLimiter` which is used to track the content types which are considered valid value models for an :class:`Attribute`.
 attribute_value_limiter = ContentTypeSubclassLimiter(AttributeValue)
 
 
@@ -245,7 +246,12 @@ class ManyToManyValue(AttributeValue):
 
 
 class Attribute(models.Model):
-       """Represents an arbitrary key/value pair on an arbitrary :class:`Model` where the key consists of word characters and the value is a subclass of :class:`AttributeValue`."""
+       """
+       :class:`Attribute`\ s exist primarily to let arbitrary data be attached to arbitrary model instances without altering the database schema and without guaranteeing that the data will be available on every instance of that model.
+       
+       Generally, :class:`Attribute`\ s will not be accessed as models; instead, they will be accessed through the :attr:`Entity.attributes` property, which allows direct dictionary getting and setting of the value of an :class:`Attribute` with its key.
+       
+       """
        entity_content_type = models.ForeignKey(ContentType, related_name='attribute_entity_set', verbose_name='Entity type')
        entity_object_id = models.PositiveIntegerField(verbose_name='Entity ID', db_index=True)
        
@@ -461,6 +467,9 @@ class TreeModel(MPTTModel):
                if root == self:
                        return ''
                
+               if root is None and self.is_root_node():
+                       return self.slug
+               
                if root is not None and not self.is_descendant_of(root):
                        raise AncestorDoesNotExist(root)