app/soc/views/models/base.py
changeset 1991 3aeda3007467
parent 1967 3fe7ad2d40c0
child 2002 7698408e10a5
equal deleted inserted replaced
1990:fea8bdb43992 1991:3aeda3007467
   120       entity = logic.getFromKeyFieldsOr404(kwargs)
   120       entity = logic.getFromKeyFieldsOr404(kwargs)
   121     except out_of_band.Error, error:
   121     except out_of_band.Error, error:
   122       return helper.responses.errorResponse(
   122       return helper.responses.errorResponse(
   123           error, request, template=params['error_public'], context=context)
   123           error, request, template=params['error_public'], context=context)
   124 
   124 
   125     self._public(request, entity, context)
   125     if not self._public(request, entity, context):
       
   126       redirect = params['public_redirect']
       
   127       if redirect:
       
   128         return http.HttpResponseRedirect(redirect)
   126 
   129 
   127     context['entity'] = entity
   130     context['entity'] = entity
   128     context['entity_type'] = params['name']
   131     context['entity_type'] = params['name']
   129     context['entity_type_url'] = params['url_name']
   132     context['entity_type_url'] = params['url_name']
   130 
   133 
   796       fields['scope'] = scope
   799       fields['scope'] = scope
   797 
   800 
   798   def _public(self, request, entity, context):
   801   def _public(self, request, entity, context):
   799     """Performs any required processing to get an entity's public page.
   802     """Performs any required processing to get an entity's public page.
   800 
   803 
       
   804     Should return True iff the public page should be displayed.
       
   805 
   801     Args:
   806     Args:
   802       request: the django request object
   807       request: the django request object
   803       entity: the entity to make public
   808       entity: the entity to make public
   804       context: the context object
   809       context: the context object
   805     """
   810     """
   806     pass
   811 
       
   812     return True
   807 
   813 
   808   def _editGet(self, request, entity, form):
   814   def _editGet(self, request, entity, form):
   809     """Performs any required processing on the form to get its edit page.
   815     """Performs any required processing on the form to get its edit page.
   810 
   816 
   811     Args:
   817     Args: