]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/models/node.py
made isSpam just return False and removed the settings for Wordpress API. Something...
[osqa.git] / forum / models / node.py
index a7e122ec509930e1039b135ebf2074742da6fa8a..dc292fb22b41126d76d667b1eefe02c33b60550b 100644 (file)
@@ -166,25 +166,32 @@ class Node(BaseModel, NodeContent):
     def summary(self):\r
         return strip_tags(self.html)[:300]\r
 \r
-    def update_last_activity(self, user):\r
+    @models.permalink\r
+    def get_revisions_url(self):\r
+        return ('revisions', (), {'id': self.id})\r
+\r
+    def update_last_activity(self, user, save=False):\r
         self.last_activity_by = user\r
         self.last_activity_at = datetime.datetime.now()\r
 \r
         if self.parent:\r
-            self.parent.update_last_activity(user)\r
+            self.parent.update_last_activity(user, save=True)\r
+\r
+        if save:\r
+            self.save()\r
 \r
     def _create_revision(self, user, number, **kwargs):\r
         revision = NodeRevision(author=user, revision=number, node=self, **kwargs)\r
         revision.save()\r
         return revision\r
 \r
-    def create_revision(self, user, action=None, **kwargs):\r
+    def create_revision(self, user, **kwargs):\r
         number = self.revisions.aggregate(last=models.Max('revision'))['last'] + 1\r
         revision = self._create_revision(user, number, **kwargs)\r
-        self.activate_revision(user, revision, action)\r
+        self.activate_revision(user, revision)\r
         return revision\r
 \r
-    def activate_revision(self, user, revision, action=None):\r
+    def activate_revision(self, user, revision):\r
         self.title = revision.title\r
         self.tagnames = revision.tagnames\r
         self.body = revision.body\r
@@ -192,9 +199,6 @@ class Node(BaseModel, NodeContent):
         self.active_revision = revision\r
         self.update_last_activity(user)\r
 \r
-        if action:\r
-            self.last_edited = action\r
-\r
         self.save()\r
 \r
     def get_tag_list_if_changed(self):\r
@@ -253,16 +257,18 @@ class Node(BaseModel, NodeContent):
 \r
     @staticmethod\r
     def isSpam(comment, data):\r
-        api = Akismet()\r
+        #api = Akismet()\r
+\r
+        #if not api.key:\r
+        #    return False\r
+        #else:\r
+        #    if api.comment_check(comment, data):\r
+        #        return True\r
+        #    else:\r
+        #        return False\r
+        # return data\r
+        return False\r
 \r
-        if not api.key:\r
-            return False\r
-        else:\r
-            if api.comment_check(comment, data):\r
-                return True\r
-            else:\r
-                return False\r
-        return data\r
 \r
     class Meta:\r
         app_label = 'forum'\r