app/soc/views/models/base.py
changeset 573 1b37588c4922
parent 572 1b3e7280743a
child 576 6614d3f545b7
equal deleted inserted replaced
572:1b3e7280743a 573:1b37588c4922
   134     new_params['create_template'] = 'soc/models/edit.html'
   134     new_params['create_template'] = 'soc/models/edit.html'
   135     new_params['edit_template'] = 'soc/models/edit.html'
   135     new_params['edit_template'] = 'soc/models/edit.html'
   136     new_params['list_template'] = 'soc/models/list.html'
   136     new_params['list_template'] = 'soc/models/list.html'
   137     new_params['invite_template'] = 'soc/models/invite.html'
   137     new_params['invite_template'] = 'soc/models/invite.html'
   138 
   138 
       
   139     new_params['error_public'] = 'soc/%(module_name)s/error.html' % params
       
   140     new_params['error_edit'] = 'soc/%(module_name)s/error.html'  % params
       
   141 
   139     new_params['list_main'] = 'soc/list/main.html'
   142     new_params['list_main'] = 'soc/list/main.html'
   140     new_params['list_pagination'] = 'soc/list/pagination.html'
   143     new_params['list_pagination'] = 'soc/list/pagination.html'
   141     new_params['list_row'] = 'soc/%(module_name)s/list/row.html' % params
   144     new_params['list_row'] = 'soc/%(module_name)s/list/row.html' % params
   142     new_params['list_heading'] = 'soc/%(module_name)s/list/heading.html' % params
   145     new_params['list_heading'] = 'soc/%(module_name)s/list/heading.html' % params
   143 
   146 
   188 
   191 
   189     try:
   192     try:
   190       key_fields = self._logic.getKeyFieldsFromDict(kwargs)
   193       key_fields = self._logic.getKeyFieldsFromDict(kwargs)
   191       entity = self._logic.getIfFields(key_fields)
   194       entity = self._logic.getIfFields(key_fields)
   192     except out_of_band.Error, error:
   195     except out_of_band.Error, error:
   193       return error.response(request, template=params['public_template'],
   196       return error.response(request, template=params['error_public'],
   194                             context=context)
   197                             context=context)
   195 
   198 
   196     self._public(request, entity, context)
   199     self._public(request, entity, context)
   197 
   200 
   198     context['entity'] = entity
   201     context['entity'] = entity
   257         error.message_fmt = (
   260         error.message_fmt = (
   258           error.message_fmt + self.DEF_CREATE_NEW_ENTITY_MSG_FMT % {
   261           error.message_fmt + self.DEF_CREATE_NEW_ENTITY_MSG_FMT % {
   259             'entity_type_lower' : params['name'].lower(),
   262             'entity_type_lower' : params['name'].lower(),
   260             'entity_type' : params['name'],
   263             'entity_type' : params['name'],
   261             'create' : params['missing_redirect']})
   264             'create' : params['missing_redirect']})
   262         return error.response(request, template=params['public_template'],
   265         return error.response(request, template=params['error_public'],
   263                               context=context)
   266                               context=context)
   264 
   267 
   265     if request.method == 'POST':
   268     if request.method == 'POST':
   266       return self.editPost(request, entity, context, params)
   269       return self.editPost(request, entity, context, params)
   267     else:
   270     else:
   410       error.message_fmt = (
   413       error.message_fmt = (
   411         error.message_fmt + self.DEF_CREATE_NEW_ENTITY_MSG_FMT % {
   414         error.message_fmt + self.DEF_CREATE_NEW_ENTITY_MSG_FMT % {
   412           'entity_type_lower' : params['name'].lower(),
   415           'entity_type_lower' : params['name'].lower(),
   413           'entity_type' : params['name'],
   416           'entity_type' : params['name'],
   414           'create' : params['missing_redirect']})
   417           'create' : params['missing_redirect']})
   415       return error.response(request, template=params['edit_template'],
   418       return error.response(request, template=params['error_edit'],
   416                             context=context)
   419                             context=context)
   417 
   420 
   418     if not entity:
   421     if not entity:
   419       #TODO: Create a proper error page for this
   422       #TODO: Create a proper error page for this
   420       return http.HttpResponseRedirect('/')
   423       return http.HttpResponseRedirect('/')