]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/models/node.py
General cleanup. Moved many hardcoded stuff still left in the code to an admin option...
[osqa.git] / forum / models / node.py
index 3150e992e0d915e7836a3c90707ad87998573394..d2b70b6eeb099e6f207f18ca1f016c15fd79d585 100644 (file)
@@ -1,4 +1,3 @@
-from forum.akismet import *\r
 from base import *\r
 from tag import Tag\r
 \r
@@ -166,6 +165,10 @@ class Node(BaseModel, NodeContent):
     def summary(self):\r
         return strip_tags(self.html)[:300]\r
 \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
@@ -181,13 +184,13 @@ class Node(BaseModel, NodeContent):
         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
@@ -195,9 +198,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
@@ -256,16 +256,12 @@ class Node(BaseModel, NodeContent):
 \r
     @staticmethod\r
     def isSpam(comment, data):\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
+        #if not settings.WORDPRESS_API_KEY:\r
+        #    return False\r
+        #\r
+        #api = Akismet(settings.WORDPRESS_API_KEY, settings.APP_URL)\r
+        #return api.comment_check(comment, data)\r
 \r
     class Meta:\r
         app_label = 'forum'\r