Remove getKeySuffix and it's usage
authorSverre Rabbelier <srabbelier@gmail.com>
Sat, 11 Apr 2009 22:58:57 +0000
changeset 2161 3b5e0e0880cd
parent 2160 3f9dd37d98a8
child 2162 03ed2fa5ccc8
Remove getKeySuffix and it's usage We can use .key().id_or_name() everywhere now. Patch by: Sverre Rabbelier
app/soc/logic/models/base.py
app/soc/views/models/base.py
app/soc/views/models/notification.py
--- a/app/soc/logic/models/base.py	Sat Apr 11 22:58:19 2009 +0000
+++ b/app/soc/logic/models/base.py	Sat Apr 11 22:58:57 2009 +0000
@@ -176,21 +176,6 @@
 
     return ['scope_path', 'link_id']
 
-  def getKeySuffix(self, entity):
-    """Returns a suffix for the specified entity or None if no entity specified.
-
-    Args:
-      entity: the entity for which to get the suffix
-    """
-
-    if not entity:
-      return None
-
-    key_values = self.getKeyValuesFromEntity(entity)
-    suffix = '/'.join(key_values)
-
-    return suffix
-
   def getKeyFieldsFromFields(self, dictionary):
     """Does any required massaging and filtering of dictionary.
 
--- a/app/soc/views/models/base.py	Sat Apr 11 22:58:19 2009 +0000
+++ b/app/soc/views/models/base.py	Sat Apr 11 22:58:57 2009 +0000
@@ -376,7 +376,7 @@
         edit_form, only it is used when there is no existing entity.
       edit_redirect: The edit_redirect value is used as the first part
         of the url if the form was valid. The last part of the url is
-        created using the getKeySuffix method of the _logic object.
+        created using the .key().id_or_name() method of the entity.
       edit_params: The edit_params dictionary is used as argument to
         redirectToChangedSuffix, it will be appended to the url in the
         standard ?key=value format.
@@ -411,7 +411,7 @@
       return http.HttpResponseRedirect('/')
 
     page_params = params['edit_params']
-    params['suffix'] = logic.getKeySuffix(entity)
+    params['suffix'] = entity.key().id_or_name()
 
     request.path = params['edit_redirect'] % params
 
@@ -453,7 +453,7 @@
     """
 
     logic = params['logic']
-    suffix = logic.getKeySuffix(entity)
+    suffix = entity.key().id_or_name()
 
     # remove the params from the request, this is relevant only if
     # someone bookmarked a POST page.
@@ -891,7 +891,7 @@
     """
 
     logic = params['logic']
-    suffix = logic.getKeySuffix(entity)
+    suffix = entity.key().id_or_name()
 
     context['form'] = form
     context['entity'] = entity
--- a/app/soc/views/models/notification.py	Sat Apr 11 22:58:19 2009 +0000
+++ b/app/soc/views/models/notification.py	Sat Apr 11 22:58:57 2009 +0000
@@ -195,7 +195,7 @@
         self._logic.updateEntityProperties(entity, {'unread' : False} )
 
     context['entity_type_url'] = self._params['url_name']
-    context['entity_suffix'] = self._logic.getKeySuffix(entity)
+    context['entity_suffix'] = entity.key().id_or_name()
 
     return True