~pennypress-core/django-pennypress/trunk

« back to all changes in this revision

Viewing changes to pennypress/apps/sections/models.py

  • Committer: Eric Moritz
  • Date: 2009-11-11 21:34:32 UTC
  • mfrom: (61.1.2 pennypress-mptt)
  • Revision ID: eric@themoritzfamily.com-20091111213432-c72lyu9s8x3tv3v3
Added a utility to rebuild MTPP trees

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
    def save(self, *args, **kwargs):
88
88
        """This saves the section model as well as normalizes the section's
89
89
        path"""
 
90
        raw = "raw" in kwargs
 
91
 
 
92
        if raw:
 
93
            del kwargs['raw']
 
94
 
90
95
        # Save to generate the tree so that we will have the ancestors
91
96
        super(Section, self).save(*args, **kwargs)
92
97
 
 
98
        # We can't build path because we're either importing or rebuilding
 
99
        # the tree
 
100
        if raw:
 
101
            return
 
102
 
93
103
        # Get a list of the model's ancestors
94
104
        ancestor_and_self_list = list(self.get_ancestors()) + [self]
95
105