app/soc/views/site/sponsor/profile.py
changeset 313 c25b1b680ba7
parent 309 7190b224c701
child 316 9efdc7bc3565
equal deleted inserted replaced
312:3488234b329f 313:c25b1b680ba7
    30 import soc.logic
    30 import soc.logic
    31 from soc.logic import validate
    31 from soc.logic import validate
    32 from soc.logic import out_of_band
    32 from soc.logic import out_of_band
    33 from soc.logic.site import id_user
    33 from soc.logic.site import id_user
    34 from soc.logic import models
    34 from soc.logic import models
       
    35 from soc.logic.models import sponsor
    35 import soc.models.sponsor
    36 import soc.models.sponsor
    36 from soc.views import helper
    37 from soc.views import helper
    37 from soc.views.helper import access
    38 from soc.views.helper import access
    38 import soc.views.helper.forms
    39 import soc.views.helper.forms
    39 import soc.views.helper.requests
    40 import soc.views.helper.requests
   110   sponsor_form = None
   111   sponsor_form = None
   111   existing_sponsor = None
   112   existing_sponsor = None
   112 
   113 
   113   # try to fetch Sponsor entity corresponding to link_name if one exists
   114   # try to fetch Sponsor entity corresponding to link_name if one exists
   114   try:
   115   try:
   115     existing_sponsor = models.sponsor.logic.getIfFields(link_name=link_name)
   116     existing_sponsor = sponsor.logic.getIfFields(link_name=link_name)
   116   except out_of_band.ErrorResponse, error:
   117   except out_of_band.ErrorResponse, error:
   117     # show custom 404 page when link name doesn't exist in Datastore
   118     # show custom 404 page when link name doesn't exist in Datastore
   118     error.message = error.message + DEF_CREATE_NEW_SPONSOR_MSG
   119     error.message = error.message + DEF_CREATE_NEW_SPONSOR_MSG
   119     return simple.errorResponse(request, error, template, context)
   120     return simple.errorResponse(request, error, template, context)
   120      
   121