app/soc/views/site/docs/edit.py
changeset 267 0c008a43443b
parent 251 8f23804302d0
child 269 0f1acc4c3e1e
equal deleted inserted replaced
266:3b47bfd4f1b3 267:0c008a43443b
    30 
    30 
    31 from soc.logic import document
    31 from soc.logic import document
    32 from soc.logic import out_of_band
    32 from soc.logic import out_of_band
    33 from soc.logic import path_linkname
    33 from soc.logic import path_linkname
    34 from soc.logic.site import id_user
    34 from soc.logic.site import id_user
       
    35 from soc.views import helpers
       
    36 import soc.views.helpers.request
    35 from soc.views import simple
    37 from soc.views import simple
    36 from soc.views.helpers import custom_widgets
    38 from soc.views.helpers import custom_widgets
    37 from soc.views.helpers import forms_helpers
    39 from soc.views.helpers import forms_helpers
    38 from soc.views.helpers import request_helpers
       
    39 from soc.views.helpers import response_helpers
    40 from soc.views.helpers import response_helpers
    40 from soc.views.user import profile
    41 from soc.views.user import profile
    41 
    42 
    42 import soc.models.document
    43 import soc.models.document
    43 
    44 
   160     if path:
   161     if path:
   161       if doc:
   162       if doc:
   162         # is 'Profile saved' parameter present, but referrer was not ourself?
   163         # is 'Profile saved' parameter present, but referrer was not ourself?
   163         # (e.g. someone bookmarked the GET that followed the POST submit) 
   164         # (e.g. someone bookmarked the GET that followed the POST submit) 
   164         if (request.GET.get(profile.SUBMIT_MSG_PARAM_NAME)
   165         if (request.GET.get(profile.SUBMIT_MSG_PARAM_NAME)
   165             and (not request_helpers.isReferrerSelf(request, suffix=path))):
   166             and (not helpers.request.isReferrerSelf(request, suffix=path))):
   166           # redirect to aggressively remove 'Profile saved' query parameter
   167           # redirect to aggressively remove 'Profile saved' query parameter
   167           return http.HttpResponseRedirect(request.path)
   168           return http.HttpResponseRedirect(request.path)
   168     
   169     
   169         # referrer was us, so select which submit message to display
   170         # referrer was us, so select which submit message to display
   170         # (may display no message if ?s=0 parameter is not present)
   171         # (may display no message if ?s=0 parameter is not present)
   171         context['submit_message'] = (
   172         context['submit_message'] = (
   172             request_helpers.getSingleIndexedParamValue(
   173             helpers.request.getSingleIndexedParamValue(
   173                 request, profile.SUBMIT_MSG_PARAM_NAME,
   174                 request, profile.SUBMIT_MSG_PARAM_NAME,
   174                 values=profile.SUBMIT_MESSAGES))
   175                 values=profile.SUBMIT_MESSAGES))
   175 
   176 
   176         # populate form with the existing User entity
   177         # populate form with the existing User entity
   177         form = EditForm(initial={'doc_key_name': doc.key().name(),
   178         form = EditForm(initial={'doc_key_name': doc.key().name(),