app/soc/views/site/user/profile.py
changeset 190 b1351bf81064
parent 189 1cf3e7531382
child 205 4a86df751222
equal deleted inserted replaced
189:1cf3e7531382 190:b1351bf81064
   151     form = LookupForm(initial={'id': user.id.email,
   151     form = LookupForm(initial={'id': user.id.email,
   152                                'link_name': user.link_name})
   152                                'link_name': user.link_name})
   153 
   153 
   154     if request.path.endswith('lookup'):
   154     if request.path.endswith('lookup'):
   155       # convert /lookup path into /profile/link_name path
   155       # convert /lookup path into /profile/link_name path
   156       context['edit_link'] = response_helpers.replaceSuffix(
   156       context['edit_link'] = request_helpers.replaceSuffix(
   157           request.path, 'lookup', 'profile/%s' % user.link_name)
   157           request.path, 'lookup', 'profile/%s' % user.link_name)
   158     # else: URL is not one that was expected, so do not display edit link
   158     # else: URL is not one that was expected, so do not display edit link
   159   elif not form:
   159   elif not form:
   160     # no pre-populated form was constructed, so show the empty look-up form
   160     # no pre-populated form was constructed, so show the empty look-up form
   161     form = LookupForm()
   161     form = LookupForm()
   281     if linkname:
   281     if linkname:
   282       if user:
   282       if user:
   283         # is 'Profile saved' parameter present, but referrer was not ourself?
   283         # is 'Profile saved' parameter present, but referrer was not ourself?
   284         # (e.g. someone bookmarked the GET that followed the POST submit) 
   284         # (e.g. someone bookmarked the GET that followed the POST submit) 
   285         if (request.GET.get(profile.SUBMIT_MSG_PARAM_NAME)
   285         if (request.GET.get(profile.SUBMIT_MSG_PARAM_NAME)
   286             and (not response_helpers.isReferrerSelf(request,
   286             and (not request_helpers.isReferrerSelf(request,
   287                                                     suffix=linkname))):
   287                                                     suffix=linkname))):
   288           # redirect to aggressively remove 'Profile saved' query parameter
   288           # redirect to aggressively remove 'Profile saved' query parameter
   289           return http.HttpResponseRedirect(request.path)
   289           return http.HttpResponseRedirect(request.path)
   290     
   290     
   291         # referrer was us, so select which submit message to display
   291         # referrer was us, so select which submit message to display