Increased the length of the timebased link_id to handle more items at once.
authorLennard de Rijk <ljvderijk@gmail.com>
Mon, 16 Mar 2009 16:27:21 +0000
changeset 1890 a8a5da24212c
parent 1889 4356a9201d20
child 1891 563d6e544011
Increased the length of the timebased link_id to handle more items at once. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
app/soc/logic/helper/notifications.py
app/soc/views/models/comment.py
app/soc/views/models/notification.py
app/soc/views/models/student_proposal.py
--- a/app/soc/logic/helper/notifications.py	Mon Mar 16 15:33:27 2009 +0000
+++ b/app/soc/logic/helper/notifications.py	Mon Mar 16 16:27:21 2009 +0000
@@ -150,12 +150,12 @@
   message = loader.render_to_string(template, dictionary=message_properties)
 
   fields = {
-      'from_user' : from_user,
+      'from_user': from_user,
       'subject': subject,
-      'message' : message,
-      'scope' : to_user,
-      'link_id' :'t%i' % (time.time()),
-      'scope_path' : to_user.link_id
+      'message': message,
+      'scope': to_user,
+      'link_id': 't%i' %(int(time.time()*100)),
+      'scope_path': to_user.link_id
   }
 
   key_name = model_logic.notification.logic.getKeyNameFromFields(fields)
--- a/app/soc/views/models/comment.py	Mon Mar 16 15:33:27 2009 +0000
+++ b/app/soc/views/models/comment.py	Mon Mar 16 16:27:21 2009 +0000
@@ -130,7 +130,7 @@
 
     if not entity:
       fields['author'] = user
-      fields['link_id'] = 't%i' % (time.time())
+      fields['link_id'] = 't%i' %(int(time.time()*100))
     else:
       fields['author'] = entity.author
       fields['link_id'] = entity.link_id
--- a/app/soc/views/models/notification.py	Mon Mar 16 15:33:27 2009 +0000
+++ b/app/soc/views/models/notification.py	Mon Mar 16 16:27:21 2009 +0000
@@ -163,7 +163,7 @@
     # get the current user
     current_user = user_logic.getForCurrentAccount()
 
-    fields['link_id'] = 't%i' % (time.time())
+    fields['link_id'] = 't%i' %(int(time.time()*100))
     fields['scope'] = fields['to_user']
     fields['from_user'] = current_user
     fields['scope_path'] = fields['to_user'].link_id
--- a/app/soc/views/models/student_proposal.py	Mon Mar 16 15:33:27 2009 +0000
+++ b/app/soc/views/models/student_proposal.py	Mon Mar 16 16:27:21 2009 +0000
@@ -266,7 +266,7 @@
     """
 
     if not entity:
-      fields['link_id'] = 't%i' % (time.time())
+      fields['link_id'] = 't%i' %(int(time.time()*100))
     else:
       fields['link_id'] = entity.link_id
 
@@ -910,7 +910,7 @@
     from soc.logic.models.review import logic as review_logic
 
     # create the fields for the review entity
-    fields = {'link_id': 't%i' %(time.time()),
+    fields = {'link_id': 't%i' %(int(time.time()*100)),
         'scope': entity,
         'scope_path': entity.key().name(),
         'author': user_logic.logic.getForCurrentAccount(),