Commits

Joseph Tate (on nd.pub)  committed 0cfb0e1

Fix file sorting

  • Participants
  • Parent commits 073baf8

Comments (0)

Files changed (1)

File c5t/core/model/content.py

     @property
     def files(self):
         the_files = File.query.find_by(parent_id=self._id)
-        return sorted(the_files, key=lambda k: (k['text'].lower(), k['title'].lower()))
+        def key(k):
+            if k.text is not None:
+                return k.text.lower()
+            else:
+                return k.title.lower()
+        return sorted(the_files, key=key)
 
 #    @property
 #    def news(self):