Using getForCurrentAccount where possible due to comments on r1309.
authorLennard de Rijk <ljvderijk@gmail.com>
Sat, 13 Dec 2008 11:02:08 +0000
changeset 727 ddf44af087a0
parent 726 ba3d399ec9be
child 728 602c2b2f4d8b
Using getForCurrentAccount where possible due to comments on r1309. Patch by: Lennard de Rijk
app/soc/views/helper/access.py
app/soc/views/models/notification.py
--- a/app/soc/views/helper/access.py	Fri Dec 12 23:28:18 2008 +0000
+++ b/app/soc/views/helper/access.py	Sat Dec 13 11:02:08 2008 +0000
@@ -358,8 +358,7 @@
   
   notification = notification_logic.logic.getForFields(properties, unique=True)
   
-  user = user_logic.logic.getForFields(
-      {'account': users.get_current_user()}, unique=True)
+  user = user_logic.logic.getForCurrentAccount()
   
   # check if the key of the current user matches the key from the scope of the message
   if user.key() == notification.scope.key():
--- a/app/soc/views/models/notification.py	Fri Dec 12 23:28:18 2008 +0000
+++ b/app/soc/views/models/notification.py	Sat Dec 13 11:02:08 2008 +0000
@@ -168,8 +168,7 @@
     params = dicts.merge(params, self._params)
       
     # get the current user
-    properties = {'account': users.get_current_user()}
-    user_entity = user_logic.logic.getForFields(properties, unique=True)
+    user_entity = user_logic.logic.getForCurrentAccount()
 
     # only select the notifications for this user so construct a filter
     filter = {'scope': user_entity}
@@ -193,8 +192,8 @@
     """See base.View._editPost().
     """
 
-    account = users.get_current_user()
-    current_user = user_logic.logic.getForFields({'account': account}, unique=True)
+    # get the current user
+    current_user = user_logic.logic.getForCurrentAccount()
     
     to_user = user_logic.logic.getForFields(
         {'link_id' : fields['to_user']}, unique=True)
@@ -225,11 +224,10 @@
     # and the notification has not been read yet
     if not entity.has_been_read:
       # get the current user
-      account = users.get_current_user()
-      user = user_logic.logic.getForFields({'account': account}, unique=True)
+      user = user_logic.logic.getForCurrentAccount()
       
       if entity.scope.key() == user.key():
-      # mark the entity as read
+        # mark the entity as read
         self._logic.updateModelProperties(entity, {'has_been_read' : True} )
     
     context['entity_type_url'] = self._params['url_name']