Fix getKeyValues() method footprint mismatches in soc.logic.models.site.Logic
after the recent refactoring. Remove 'Link scope' drop-down from Edit Site
Settings form.
Patch by: Todd Larsen
--- a/app/soc/logic/models/site.py Fri Nov 21 12:01:59 2008 +0000
+++ b/app/soc/logic/models/site.py Fri Nov 21 22:38:38 2008 +0000
@@ -43,7 +43,7 @@
"""
presence.Logic.__init__(self, model=model, base_model=base_model)
- def getKeyValues(self):
+ def getKeyValues(self, unused_entity):
"""Returns the default key values for the site settings.
The Site entity is always expected to be a singleton, so this method
--- a/app/soc/views/models/base.py Fri Nov 21 12:01:59 2008 +0000
+++ b/app/soc/views/models/base.py Fri Nov 21 22:38:38 2008 +0000
@@ -198,7 +198,8 @@
new_suffix='edit')
if not kwargs:
- return self.edit(request, page_name=page_name, params=params, **empty_kwargs)
+ return self.edit(request, page_name=page_name, params=params,
+ **empty_kwargs)
else:
return self.edit(request, page_name=page_name, params=params, seed=kwargs, **empty_kwargs)
@@ -235,7 +236,8 @@
'entity_type' : params['name'],
'create' : params['missing_redirect']
}
- return simple.errorResponse(request, page_name, error, template, context)
+ return simple.errorResponse(request, page_name, error, template,
+ context)
if request.method == 'POST':
return self.editPost(request, entity, context, params)
--- a/app/soc/views/models/site.py Fri Nov 21 12:01:59 2008 +0000
+++ b/app/soc/views/models/site.py Fri Nov 21 22:38:38 2008 +0000
@@ -52,7 +52,7 @@
model = soc.models.site.Site
#: list of model fields which will *not* be gathered by the form
- exclude = ['inheritance_line', 'home', 'scope_path', 'link_id']
+ exclude = ['inheritance_line', 'home', 'scope', 'scope_path', 'link_id']
scope_path = forms.CharField(widget=forms.HiddenInput)
@@ -120,7 +120,10 @@
"""
keys = self._logic.getKeyFieldNames()
- values = self._logic.getKeyValues()
+
+ # No entity in this case, since Site key values are hard-coded for the
+ # Site singleton, so pass in None to match parent method footprint.
+ values = self._logic.getKeyValues(None)
key_values = dicts.zip(keys, values)
return self.public(request, page_name, **key_values)
@@ -135,7 +138,10 @@
"""
keys = self._logic.getKeyFieldNames()
- values = self._logic.getKeyValues()
+
+ # No entity in this case, since Site key values are hard-coded for the
+ # Site singleton, so pass in None to match parent method footprint.
+ values = self._logic.getKeyValues(None)
key_values = dicts.zip(keys, values)
return self.edit(request, page_name, seed=key_values, **key_values)