# HG changeset patch # User Sverre Rabbelier # Date 1233403925 0 # Node ID 6c0f9b73b053a36b2959e988e28435c6abcae4c8 # Parent db177bcdfe29c36c398b6d3821e59f5f7b489db8 Made presence document retrievel specify prefix Patch by: Sverre Rabbelier diff -r db177bcdfe29 -r 6c0f9b73b053 app/soc/views/helper/params.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 diff -r db177bcdfe29 -r 6c0f9b73b053 app/soc/views/models/presence.py --- 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 diff -r db177bcdfe29 -r 6c0f9b73b053 app/soc/views/models/presence_with_tos.py --- 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