app/soc/views/helpers/response_helpers.py
changeset 179 4882d6c5630d
parent 169 a9b3d6c9d4f9
child 190 b1351bf81064
equal deleted inserted replaced
178:5370aeb7df31 179:4882d6c5630d
   123       'sign_out', users.create_logout_url(request.path))
   123       'sign_out', users.create_logout_url(request.path))
   124 
   124 
   125   return context
   125   return context
   126 
   126 
   127 
   127 
   128 def replaceSuffix(path, old_suffix, new_suffix, params=None):
   128 def replaceSuffix(path, old_suffix, new_suffix=None, params=None):
   129   """Replace the last part of a URL path with something else.
   129   """Replace the last part of a URL path with something else.
   130 
   130 
   131   Also appends an optional list of query parameters.  Used for
   131   Also appends an optional list of query parameters.  Used for
   132   replacing, for example, one link name at the end of a relative
   132   replacing, for example, one link name at the end of a relative
   133   URL path with another.
   133   URL path with another.
   164 
   164 
   165   return path
   165   return path
   166 
   166 
   167 
   167 
   168 def redirectToChangedSuffix(
   168 def redirectToChangedSuffix(
   169     request, old_suffix, new_suffix, params=None):
   169     request, old_suffix, new_suffix=None, params=None):
   170   """Changes suffix of URL path and returns an HTTP redirect response.
   170   """Changes suffix of URL path and returns an HTTP redirect response.
   171   
   171   
   172   Args:
   172   Args:
   173     request: the Django HTTP request object; redirect path is derived from
   173     request: the Django HTTP request object; redirect path is derived from
   174       request.path
   174       request.path