Made presence document retrievel specify prefix
authorSverre Rabbelier <srabbelier@gmail.com>
Sat, 31 Jan 2009 12:12:05 +0000
changeset 1101 6c0f9b73b053
parent 1100 db177bcdfe29
child 1102 8765079db045
Made presence document retrievel specify prefix Patch by: Sverre Rabbelier
app/soc/views/helper/params.py
app/soc/views/models/presence.py
app/soc/views/models/presence_with_tos.py
--- a/app/soc/views/helper/params.py	Sat Jan 31 12:11:34 2009 +0000
+++ b/app/soc/views/helper/params.py	Sat Jan 31 12:12:05 2009 +0000
@@ -95,6 +95,9 @@
   if 'url_name' not in params:
     params['url_name'] = params['module_name']
 
+  if 'document_prefix' not in params:
+    params['document_prefix'] = params['name_short'].lower()
+
   # Do not expand edit_redirect to allow it to be overriden without suffix
   new_params['edit_redirect'] = '/%(url_name)s/edit/%(suffix)s'
   new_params['missing_redirect'] = '/%(url_name)s/create' % params
--- a/app/soc/views/models/presence.py	Sat Jan 31 12:11:34 2009 +0000
+++ b/app/soc/views/models/presence.py	Sat Jan 31 12:12:05 2009 +0000
@@ -136,13 +136,14 @@
     """See base.View._editPost().
     """
 
+    prefix = self._params['document_prefix']
     key_fields = self._logic.getKeyFieldsFromDict(fields)
     scope_path = self._logic.getKeyNameForFields(key_fields)
     home_link_id = fields['home_link_id']
 
     # TODO notify the user if home_doc is not found
     home_doc = document_logic.logic.getFromFields(
-      scope_path=scope_path, link_id=home_link_id)
+      scope_path=scope_path, link_id=home_link_id, prefix=prefix)
 
     fields['home'] = home_doc
 
--- a/app/soc/views/models/presence_with_tos.py	Sat Jan 31 12:11:34 2009 +0000
+++ b/app/soc/views/models/presence_with_tos.py	Sat Jan 31 12:12:05 2009 +0000
@@ -76,6 +76,7 @@
     """See base.View._editPost().
     """
 
+    prefix = self._params['document_prefix']
     key_fields = self._logic.getKeyFieldsFromDict(fields)
     scope_path = self._logic.getKeyNameForFields(key_fields)
 
@@ -83,7 +84,7 @@
 
     # TODO notify the user if tos_doc is not found
     tos_doc = document_logic.logic.getFromFields(
-      scope_path=scope_path, link_id=tos_link_id)
+      scope_path=scope_path, link_id=tos_link_id, prefix=prefix)
 
     fields['tos'] = tos_doc