# HG changeset patch # User Madhusudan.C.S # Date 1244052482 -19800 # Node ID 174e946039e07ac95365a02861f4155b0bd7cf6d # Parent 6ca37aa4c33ed810f52b1151c47404386c569666 Introduced 'module_package' key in params dict to support modules in melange diff -r 6ca37aa4c33e -r 174e946039e0 app/soc/views/helper/params.py --- a/app/soc/views/helper/params.py Tue Jun 02 19:23:06 2009 +0200 +++ b/app/soc/views/helper/params.py Wed Jun 03 23:38:02 2009 +0530 @@ -152,71 +152,77 @@ new_params['extra_django_patterns'] = [] new_params['django_patterns_defaults'] = [] + # Defines the module package that the view is in. If it is not + # already defined in the respective view, it defaults to + # soc.views.models + if not params.get('module_package'): + new_params['module_package'] = 'soc.views.models' + if not params.get('no_edit'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pedit)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.edit', 'Edit %(name_short)s')] + '%(module_package)s.%(module_name)s.edit', 'Edit %(name_short)s')] if not params.get('no_delete'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pdelete)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.delete', 'Delete %(name_short)s')] + '%(module_package)s.%(module_name)s.delete', 'Delete %(name_short)s')] if not params.get('no_show'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pshow)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.public', 'Show %(name_short)s')] + '%(module_package)s.%(module_name)s.public', 'Show %(name_short)s')] if not params.get('no_admin'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Padmin)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.admin', + '%(module_package)s.%(module_name)s.admin', 'Show %(name_short)s (admin)')] if not params.get('no_create_raw'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pcreate)$', - 'soc.views.models.%(module_name)s.create', 'Create %(name_short)s')] + '%(module_package)s.%(module_name)s.create', 'Create %(name_short)s')] if not params.get('no_create_with_scope'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pcreate)/%(scope)s$', - 'soc.views.models.%(module_name)s.create', 'Create %(name_short)s')] + '%(module_package)s.%(module_name)s.create', 'Create %(name_short)s')] if not params.get('no_create_with_key_fields'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pcreate)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.create', 'Create %(name_short)s')] + '%(module_package)s.%(module_name)s.create', 'Create %(name_short)s')] if not params.get('no_list_raw'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Plist)$', - 'soc.views.models.%(module_name)s.list', 'List %(name_plural)s')] + '%(module_package)s.%(module_name)s.list', 'List %(name_plural)s')] if params.get('pickable'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Ppick)$', - 'soc.views.models.%(module_name)s.pick', 'Pick %(name_short)s')] + '%(module_package)s.%(module_name)s.pick', 'Pick %(name_short)s')] if params.get('export_content_type'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pexport)/%(key_fields)s$', - 'soc.views.models.%(module_name)s.export', 'Export %(name_short)s')] + '%(module_package)s.%(module_name)s.export', 'Export %(name_short)s')] if params.get('sans_link_id_create'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Pcreate)/%(sans_link_id)s$', - 'soc.views.models.%(module_name)s.create', 'Create %(name_short)s')] + '%(module_package)s.%(module_name)s.create', 'Create %(name_short)s')] if params.get('sans_link_id_list'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Plist)/%(sans_link_id)s$', - 'soc.views.models.%(module_name)s.list', 'List %(name_plural)s')] + '%(module_package)s.%(module_name)s.list', 'List %(name_plural)s')] if params.get('sans_link_id_public_list'): new_params['django_patterns_defaults'] += [ (r'^%(url_name)s/(?Plist_public)/%(sans_link_id)s$', - 'soc.views.models.%(module_name)s.list_public', + '%(module_package)s.%(module_name)s.list_public', 'List %(name_plural)s')] new_params['public_template'] = 'soc/%(module_name)s/public.html' % params