]> git.openstreetmap.org Git - osqa.git/commitdiff
python 2.4 compatibility fixes and fix on score counter
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sun, 18 Apr 2010 18:28:40 +0000 (18:28 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sun, 18 Apr 2010 18:28:40 +0000 (18:28 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@50 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/models/base.py
forum/models/node.py
forum/models/user.py

index 7974af6f8ef3527c4fa01b8523c5e013a3dc3baa..78f12428b45c16d15fbe7e854f03fff534eb8675 100644 (file)
@@ -1,5 +1,4 @@
 import datetime
-import hashlib
 from urllib import quote_plus, urlencode
 from django.db import models, IntegrityError, connection, transaction
 from django.utils.http import urlquote  as django_urlquote
@@ -194,14 +193,6 @@ class QandA(Node):
             self.wikified_at = datetime.datetime.now()
             self.save()
 
-    def save(self, *args, **kwargs):
-        self.__dict__['score'] = self.__dict__['vote_up_count'] - self.__dict__['vote_down_count']
-        super(QandA,self).save(*args, **kwargs)
-
-        try:
-            ping_google()
-        except Exception:
-            logging.debug('problem pinging google did you register you sitemap with google?')
 
 
 
index 552944e69a15e5db69dd89b49129831d5f5d6213..13749cd9872a5af40019e7154b96f7df12a9bff5 100644 (file)
@@ -190,6 +190,8 @@ class Node(BaseModel, NodeContent, DeletableContent):
 \r
         if self.parent_id and not self.abs_parent_id:\r
             self.abs_parent = self.parent.absolute_parent\r
+\r
+        self.__dict__['score'] = self.__dict__['vote_up_count'] - self.__dict__['vote_down_count']\r
             \r
         tags = self.get_tag_list_if_changed()\r
         super(Node, self).save(*args, **kwargs)\r
index f8b8d1433d2da7698e177e7c6a9224627e385ea9..82cfe3aec3523d6bb177514d2a7a60e8f9e8cf10 100644 (file)
@@ -3,7 +3,10 @@ from forum import const
 from django.contrib.contenttypes.models import ContentType\r
 from django.contrib.auth.models import User as DjangoUser, AnonymousUser as DjangoAnonymousUser\r
 from django.db.models import Q\r
-from hashlib import md5\r
+try:\r
+    from hashlib import md5\r
+except:\r
+    import md5\r
 import string\r
 from random import Random\r
 \r
@@ -97,7 +100,7 @@ class User(BaseModel, DjangoUser):
 \r
     @property\r
     def gravatar(self):\r
-        return hashlib.md5(self.email).hexdigest()\r
+        return md5(self.email).hexdigest()\r
 \r
     def save(self, *args, **kwargs):\r
         if self.reputation < 0:\r