Author: eduardo.padoan
Date: Mon Sep 22 15:58:16 2008
New Revision: 169

Modified:
    trunk/wiki/models.py

Log:
Fixed issue #60: return an empty queryset when there is no changeset on  
Article.lastest_changeset()

Modified: trunk/wiki/models.py
==============================================================================
--- trunk/wiki/models.py        (original)
+++ trunk/wiki/models.py        Mon Sep 22 15:58:16 2008
@@ -77,8 +77,11 @@
          super(Article, self).save(force_insert, force_update)

      def latest_changeset(self):
-        return self.changeset_set.filter(
-            reverted=False).order_by('-revision')[0]
+        try:
+            return self.changeset_set.filter(
+                reverted=False).order_by('-revision')[0]
+        except IndexError:
+            return ChangeSet.objects.none()

      def new_revision(self, old_content, old_title, old_markup,
                       comment, editor_ip, editor):

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to