本文整理汇总了Python中saas.utils.validate_redirect_url函数的典型用法代码示例。如果您正苦于以下问题:Python validate_redirect_url函数的具体用法?Python validate_redirect_url怎么用?Python validate_redirect_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了validate_redirect_url函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_redirect_path
def get_redirect_path(self, **kwargs): #pylint: disable=unused-argument
context = {}
redirect_path = validate_redirect_url(
self.request.GET.get(REDIRECT_FIELD_NAME, None))
if not redirect_path:
redirect_path = validate_redirect_url(
self.request.META.get('HTTP_REFERER', ''))
if redirect_path:
context.update({REDIRECT_FIELD_NAME: redirect_path})
return context
示例2: get_success_url
def get_success_url(self):
redirect_path = validate_redirect_url(
self.request.GET.get(REDIRECT_FIELD_NAME, None))
if redirect_path:
return '%s?%s=%s' % (
reverse('saas_organization_cart', args=(self.customer,)),
REDIRECT_FIELD_NAME, redirect_path)
return reverse('saas_organization_cart', args=(self.customer,))
示例3: get_success_url
def get_success_url(self):
redirect_path = validate_redirect_url(
self.request.GET.get(REDIRECT_FIELD_NAME, None))
if redirect_path:
return redirect_path
messages.success(self.request,
"Your bank on file was sucessfully updated")
return reverse('saas_transfer_info', kwargs=self.get_url_kwargs())
示例4: get_success_url
def get_success_url(self):
redirect_path = validate_redirect_url(
self.request.GET.get(REDIRECT_FIELD_NAME, None))
if redirect_path:
return redirect_path
if self.request.user.is_authenticated():
return reverse('saas_cart')
return reverse('saas_cart_plan_list')
示例5: get_context_data
def get_context_data(self, **kwargs):
context = super(AgreementSignView, self).get_context_data(**kwargs)
redirect_path = validate_redirect_url(
self.request.GET.get(REDIRECT_FIELD_NAME, None))
if redirect_path:
context.update({REDIRECT_FIELD_NAME: redirect_path})
context.update({
'page': _read_agreement_file(self.kwargs.get('agreement'))})
return context
示例6: get_success_url
def get_success_url(self):
redirect_path = validate_redirect_url(
self.request.GET.get(REDIRECT_FIELD_NAME, None))
if hasattr(self, 'charge') and self.charge:
if redirect_path:
return '%s?%s=%s' % (
reverse('saas_charge_receipt',
args=(self.charge.customer, self.charge.processor_id)),
REDIRECT_FIELD_NAME, redirect_path)
return reverse('saas_charge_receipt',
args=(self.charge.customer, self.charge.processor_id))
if redirect_path:
return redirect_path
if self.sole_provider:
# XXX product_default_start is not defined in url patterns.
return '/%(organization)s/app/%(subscriber)s/' % {
'organization': self.sole_provider,
'subscriber': self.customer}
return reverse('saas_organization_profile', args=(self.customer,))
示例7: get_success_url
def get_success_url(self):
redirect_path = validate_redirect_url(
self.request.GET.get(REDIRECT_FIELD_NAME, None))
if redirect_path:
return redirect_path
return reverse(self.redirect_url)