app/soc/views/helper/params.py
changeset 1430 ff8cc6b15e6a
parent 1400 842958b8a55d
child 1432 cc58eb1136d6
equal deleted inserted replaced
1429:cfa0c3f2dc19 1430:ff8cc6b15e6a
   238       DEF_SUBMIT_MSG_PARAM_NAME: DEF_SUBMIT_MSG_PROFILE_SAVED,
   238       DEF_SUBMIT_MSG_PARAM_NAME: DEF_SUBMIT_MSG_PROFILE_SAVED,
   239       }
   239       }
   240 
   240 
   241   new_params['dynabase'] = helper.forms.BaseForm
   241   new_params['dynabase'] = helper.forms.BaseForm
   242 
   242 
   243   create_dynafields = {
   243   create_dynaproperties = {
   244       'clean_link_id': cleaning.clean_link_id('link_id'),
   244       'clean_link_id': cleaning.clean_link_id('link_id'),
   245       'clean_feed_url': cleaning.clean_feed_url,
   245       'clean_feed_url': cleaning.clean_feed_url,
   246       }
   246       }
   247   create_dynafields.update(params.get('create_extra_dynafields', {}))
   247   create_dynaproperties.update(params.get('create_extra_dynaproperties', {}))
   248 
   248 
   249   new_params['references'] = []
   249   new_params['references'] = []
   250   new_params['create_dynainclude'] = [] + params.get('extra_dynainclude', [])
   250   new_params['create_dynainclude'] = [] + params.get('extra_dynainclude', [])
   251   new_params['create_dynaexclude'] = ['scope', 'scope_path'] + \
   251   new_params['create_dynaexclude'] = ['scope', 'scope_path'] + \
   252       params.get('extra_dynaexclude', [])
   252       params.get('extra_dynaexclude', [])
   253   new_params['create_dynafields'] = create_dynafields
   253   new_params['create_dynaproperties'] = create_dynaproperties
   254 
   254 
   255   edit_dynafields = {
   255   edit_dynaproperties = {
   256       'clean_link_id': cleaning.clean_link_id('link_id'),
   256       'clean_link_id': cleaning.clean_link_id('link_id'),
   257       'link_id': forms.CharField(widget=helper.widgets.ReadOnlyInput()),
   257       'link_id': forms.CharField(widget=helper.widgets.ReadOnlyInput()),
   258       }
   258       }
   259   edit_dynafields.update(params.get('edit_extra_dynafields', {}))
   259   edit_dynaproperties.update(params.get('edit_extra_dynaproperties', {}))
   260 
   260 
   261   new_params['edit_dynainclude'] = None
   261   new_params['edit_dynainclude'] = None
   262   new_params['edit_dynaexclude'] = None
   262   new_params['edit_dynaexclude'] = None
   263   new_params['edit_dynafields'] = edit_dynafields
   263   new_params['edit_dynaproperties'] = edit_dynaproperties
   264 
   264 
   265   params = dicts.merge(params, new_params)
   265   params = dicts.merge(params, new_params)
   266 
   266 
   267   # These need to be constructed separately, because they require
   267   # These need to be constructed separately, because they require
   268   # parameters that can be defined either in params, or new_params.
   268   # parameters that can be defined either in params, or new_params.
   291     dynabase: The dynabase value is used as the base argument to
   291     dynabase: The dynabase value is used as the base argument to
   292       dynaform.newDynaForm.
   292       dynaform.newDynaForm.
   293     logic: The logic value is used to get the model argument to newDynaForm.
   293     logic: The logic value is used to get the model argument to newDynaForm.
   294     create_dynainclude: same as dynabase, but as dynainclude argument
   294     create_dynainclude: same as dynabase, but as dynainclude argument
   295     create_dynaexclude: same as dynabase, but as dynaexclude argument
   295     create_dynaexclude: same as dynabase, but as dynaexclude argument
   296     create_dynafields: same as dynabase, but as dynafields argument
   296     create_dynaproperties: same as dynabase, but as dynaproperties argument
   297   """
   297   """
   298 
   298 
   299   create_form = dynaform.newDynaForm(
   299   create_form = dynaform.newDynaForm(
   300     dynabase = params['dynabase'],
   300     dynabase = params['dynabase'],
   301     dynamodel = model,
   301     dynamodel = model,
   302     dynainclude = params['create_dynainclude'],
   302     dynainclude = params['create_dynainclude'],
   303     dynaexclude = params['create_dynaexclude'],
   303     dynaexclude = params['create_dynaexclude'],
   304     dynafields = params['create_dynafields'],
   304     dynaproperties = params['create_dynaproperties'],
   305     )
   305     )
   306 
   306 
   307   if 'extra_key_order' in params:
   307   if 'extra_key_order' in params:
   308     for field in params['extra_key_order']:
   308     for field in params['extra_key_order']:
   309       if field in create_form.base_fields.keyOrder:
   309       if field in create_form.base_fields.keyOrder:
   319   Params usage:
   319   Params usage:
   320     create_form: The dynabase value is used as the dynaform argument
   320     create_form: The dynabase value is used as the dynaform argument
   321       to dyanform.extendDynaForm.
   321       to dyanform.extendDynaForm.
   322     edit_dynainclude: same as create_form, but as dynainclude argument
   322     edit_dynainclude: same as create_form, but as dynainclude argument
   323     edit_dynaexclude: same as create_form, but as dynaexclude argument
   323     edit_dynaexclude: same as create_form, but as dynaexclude argument
   324     edit_dynafields: same as create_form, but as dynafields argument
   324     edit_dynaproperties: same as create_form, but as dynaproperties argument
   325   """
   325   """
   326 
   326 
   327   edit_form = dynaform.extendDynaForm(
   327   edit_form = dynaform.extendDynaForm(
   328     dynaform = base_form,
   328     dynaform = base_form,
   329     dynainclude = params['edit_dynainclude'],
   329     dynainclude = params['edit_dynainclude'],
   330     dynaexclude = params['edit_dynaexclude'],
   330     dynaexclude = params['edit_dynaexclude'],
   331     dynafields = params['edit_dynafields'],
   331     dynaproperties = params['edit_dynaproperties'],
   332     )
   332     )
   333 
   333 
   334   return edit_form
   334   return edit_form
   335 
   335 
   336 
   336