]> git.openstreetmap.org Git - osqa.git/commitdiff
Makes hitting a question url using an id that is not a question raise a 404.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 17 Jun 2010 15:27:23 +0000 (15:27 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 17 Jun 2010 15:27:23 +0000 (15:27 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@437 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/models/action.py
forum/models/node.py

index d6d0c648fdf63ceca30f068b746f21c84c61b286..c951a58038c51e97acb75ef7192dad2d55ae499a 100644 (file)
@@ -15,8 +15,13 @@ class ActionQuerySet(CachedQuerySet):
         else:
             return super(ActionQuerySet, self).obj_from_datadict(datadict)
 
-    def get(self, *args, **kwargs):
-        return super(ActionQuerySet, self).get(*args, **kwargs).leaf()
+    def get(self, *args, **kwargs):            
+        action = super(ActionQuerySet, self).get(*args, **kwargs).leaf()
+
+        if not isinstance(action, self.model):
+            raise self.model.DoesNotExist()
+
+        return action
 
 class ActionManager(CachedManager):
     use_for_related_fields = True
index 70d10b647c2dfa2da162491dc4a616e7660e1fbb..75b39339e3284d74e913f60d99e80fa35a7b8d21 100644 (file)
@@ -95,7 +95,12 @@ class NodeQuerySet(CachedQuerySet):
             return super(NodeQuerySet, self).obj_from_datadict(datadict)
 
     def get(self, *args, **kwargs):
-        return super(NodeQuerySet, self).get(*args, **kwargs).leaf
+        node = super(NodeQuerySet, self).get(*args, **kwargs).leaf
+
+        if not isinstance(node, self.model):
+            raise self.model.DoesNotExist()
+
+        return node
 
     def filter_state(self, **kwargs):
         apply_bool = lambda q, b: b and q or ~q