app/soc/views/sponsor/profile.py
changeset 272 00cea07656c0
parent 270 7dd6d8347b56
child 298 c76a366c7ab4
equal deleted inserted replaced
271:01e90bb21b7e 272:00cea07656c0
    24 
    24 
    25 from soc.logic import out_of_band
    25 from soc.logic import out_of_band
    26 from soc.logic import sponsor
    26 from soc.logic import sponsor
    27 from soc.views import simple
    27 from soc.views import simple
    28 from soc.views import helper
    28 from soc.views import helper
       
    29 import soc.views.helper.responses
    29 import soc.views.helper.templates
    30 import soc.views.helper.templates
    30 from soc.views.helpers import response_helpers
       
    31 
    31 
    32 
    32 
    33 DEF_SPONSOR_PUBLIC_TMPL = 'soc/group/profile/public.html'
    33 DEF_SPONSOR_PUBLIC_TMPL = 'soc/group/profile/public.html'
    34 
    34 
    35 def public(request, linkname=None, template=DEF_SPONSOR_PUBLIC_TMPL):
    35 def public(request, linkname=None, template=DEF_SPONSOR_PUBLIC_TMPL):
    42 
    42 
    43   Returns:
    43   Returns:
    44     A subclass of django.http.HttpResponse with generated template.
    44     A subclass of django.http.HttpResponse with generated template.
    45   """
    45   """
    46   # create default template context for use with any templates
    46   # create default template context for use with any templates
    47   context = response_helpers.getUniversalContext(request)
    47   context = helper.responses.getUniversalContext(request)
    48 
    48 
    49   try:
    49   try:
    50     linkname_sponsor = sponsor.getSponsorIfLinkName(linkname)
    50     linkname_sponsor = sponsor.getSponsorIfLinkName(linkname)
    51   except out_of_band.ErrorResponse, error:
    51   except out_of_band.ErrorResponse, error:
    52     # show custom 404 page when link name doesn't exist in Datastore
    52     # show custom 404 page when link name doesn't exist in Datastore
    56       helper.templates.unescape(linkname_sponsor.description)
    56       helper.templates.unescape(linkname_sponsor.description)
    57   
    57   
    58   context.update({'linkname_group': linkname_sponsor,
    58   context.update({'linkname_group': linkname_sponsor,
    59                   'group_type': 'Sponsor'})
    59                   'group_type': 'Sponsor'})
    60 
    60 
    61   return response_helpers.respond(request, template, context)
    61   return helper.responses.respond(request, template, context)