Use key().name() instead of link_id
authorSverre Rabbelier <srabbelier@gmail.com>
Sat, 06 Dec 2008 11:53:26 +0000
changeset 675 14958011dceb
parent 674 0158b11cbf6d
child 676 c6433532ddff
Use key().name() instead of link_id This is now possible because key_name is constructed purely from the key fields of an entity. It is not sufficient to use just link_id, that works only for single-scoped entities (e.g., those that either do not have a scope, or that have a scope which itself does not have a scope). It would break if there was an entity that has a scoped scope (it would only include the scope's link_id in the url, which made it impossible to look up the scope as we missed the link_id of the scope's scope). Patch by: Sverre Rabbelier
app/soc/views/helper/redirects.py
--- a/app/soc/views/helper/redirects.py	Sat Dec 06 11:53:05 2008 +0000
+++ b/app/soc/views/helper/redirects.py	Sat Dec 06 11:53:26 2008 +0000
@@ -27,7 +27,7 @@
   """
 
   result ='/request/create/%s/%s/%s' % (
-     params['url_name'], params['group_scope'], entity.link_id)
+     params['url_name'], params['group_scope'], entity.key.name())
   
   return result
 
@@ -37,7 +37,7 @@
   """
 
   result ='/%s/invite/%s' % (
-     params['url_name'], entity.link_id)
+     params['url_name'], entity.key().name())
 
   return result
 
@@ -47,7 +47,7 @@
   """
 
   result ='/%s/create/%s' % (
-     params['url_name'], entity.link_id)
+     params['url_name'], entity.key().name())
 
   return result
 
@@ -56,9 +56,8 @@
   """Returns the edit redirect for the specified entity.
   """
 
-  suffix = params['logic'].getKeySuffix(entity)
   url_name = params['url_name']
-  return '/%s/edit/%s' % (url_name, suffix)
+  return '/%s/edit/%s' % (url_name, entity.key().name())
 
 
 def inviteAcceptedRedirect(entity, _):