# HG changeset patch # User Sverre Rabbelier # Date 1228167447 0 # Node ID 671dc971c3d1e16ff67c37002e8d956992d398c6 # Parent c59a0ffc2c31be49a73c00d7403c1f0243287299 Allow for extra dynamic fields for the create form Also some minor cleanups, such as making base.Logic inherit from object, as per the style guide. Patch by: Sverre Rabbelier diff -r c59a0ffc2c31 -r 671dc971c3d1 app/soc/logic/models/base.py --- a/app/soc/logic/models/base.py Mon Dec 01 21:30:01 2008 +0000 +++ b/app/soc/logic/models/base.py Mon Dec 01 21:37:27 2008 +0000 @@ -39,7 +39,7 @@ pass -class Logic: +class Logic(object): """Base logic for entity classes. The BaseLogic class functions specific to Entity classes by relying diff -r c59a0ffc2c31 -r 671dc971c3d1 app/soc/views/helper/params.py --- a/app/soc/views/helper/params.py Mon Dec 01 21:30:01 2008 +0000 +++ b/app/soc/views/helper/params.py Mon Dec 01 21:37:27 2008 +0000 @@ -87,9 +87,9 @@ new_params['sidebar'] = None new_params['sidebar_defaults'] = [ - ('/%s/create', 'New %(name)s', 'create'), - ('/%s/list', 'List %(name_plural)s', 'list'), - ] + ('/%s/create', 'New %(name)s', 'create'), + ('/%s/list', 'List %(name_plural)s', 'list'), + ] new_params['sidebar_additional'] = [] new_params['key_fields_prefix'] = [] @@ -145,23 +145,26 @@ new_params['dynabase'] = helper.forms.BaseForm - new_params['create_dynainclude'] = [] + params.get('extra_dynainclude', []) - new_params['create_dynaexclude'] = ['scope', 'scope_path'] + \ - params.get('extra_dynaexclude', []) - new_params['create_dynafields'] = { + create_dynafields = { 'clean_link_id': cleaning.clean_new_link_id(params['logic']), 'clean_feed_url': cleaning.clean_feed_url, } + create_dynafields.update(params.get('create_extra_dynafields', {})) - dynafields = { + new_params['create_dynainclude'] = [] + params.get('extra_dynainclude', []) + new_params['create_dynaexclude'] = ['scope', 'scope_path'] + \ + params.get('extra_dynaexclude', []) + new_params['create_dynafields'] = create_dynafields + + edit_dynafields = { 'clean_link_id': cleaning.clean_link_id, 'link_id': forms.CharField(widget=helper.widgets.ReadOnlyInput()), } - dynafields.update(params.get('extra_dynafields', {})) + edit_dynafields.update(params.get('edit_extra_dynafields', {})) new_params['edit_dynainclude'] = None new_params['edit_dynaexclude'] = None - new_params['edit_dynafields'] = dynafields + new_params['edit_dynafields'] = edit_dynafields params = dicts.merge(params, new_params) diff -r c59a0ffc2c31 -r 671dc971c3d1 app/soc/views/models/host.py --- a/app/soc/views/models/host.py Mon Dec 01 21:30:01 2008 +0000 +++ b/app/soc/views/models/host.py Mon Dec 01 21:37:27 2008 +0000 @@ -108,10 +108,6 @@ role.RoleView.__init__(self, params=params) - def _editSeed(self, request, seed): - """See base.View._editGet(). - """ - def _editPost(self, request, entity, fields): """See base.View._editPost(). """ diff -r c59a0ffc2c31 -r 671dc971c3d1 app/soc/views/models/sponsor.py --- a/app/soc/views/models/sponsor.py Mon Dec 01 21:30:01 2008 +0000 +++ b/app/soc/views/models/sponsor.py Mon Dec 01 21:37:27 2008 +0000 @@ -64,7 +64,7 @@ params['module_name'] = "sponsor" params['extra_dynaexclude'] = ['founder', 'home'] - params['extra_dynafields'] = { + params['edit_extra_dynafields'] = { 'founded_by': forms.CharField(widget=helper.widgets.ReadOnlyInput(), required=False), }