本文整理汇总了Python中django.http.HttpResponseGone方法的典型用法代码示例。如果您正苦于以下问题:Python http.HttpResponseGone方法的具体用法?Python http.HttpResponseGone怎么用?Python http.HttpResponseGone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.http
的用法示例。
在下文中一共展示了http.HttpResponseGone方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from django import http [as 别名]
# 或者: from django.http import HttpResponseGone [as 别名]
def get(self, request, *args, **kwargs):
url = self.get_redirect_url(*args, **kwargs)
if url:
if self.permanent:
return http.HttpResponsePermanentRedirect(url)
else:
return http.HttpResponseRedirect(url)
else:
logger.warning('Gone: %s', request.path,
extra={
'status_code': 410,
'request': request
})
return http.HttpResponseGone()
示例2: get
# 需要导入模块: from django import http [as 别名]
# 或者: from django.http import HttpResponseGone [as 别名]
def get(self, request, *args, **kwargs):
url = self.get_redirect_url(*args, **kwargs)
if url:
if self.permanent:
return http.HttpResponsePermanentRedirect(url)
else:
return http.HttpResponseRedirect(url)
else:
logger.warning(
'Gone: %s', request.path,
extra={'status_code': 410, 'request': request}
)
return http.HttpResponseGone()
示例3: get
# 需要导入模块: from django import http [as 别名]
# 或者: from django.http import HttpResponseGone [as 别名]
def get(self, request, *args, **kwargs):
url = self.get_redirect_url(**kwargs)
if url:
if self.permanent:
return http.HttpResponsePermanentRedirect(url)
else:
return http.HttpResponseRedirect(url)
else:
logger.warning('Gone: %s', self.request.path,
extra={
'status_code': 410,
'request': self.request
})
return http.HttpResponseGone()
示例4: deprecation_view
# 需要导入模块: from django import http [as 别名]
# 或者: from django.http import HttpResponseGone [as 别名]
def deprecation_view(request):
return HttpResponseGone(UNICORN, content_type="text/plain")
示例5: apiv1_gone
# 需要导入模块: from django import http [as 别名]
# 或者: from django.http import HttpResponseGone [as 别名]
def apiv1_gone(request):
return HttpResponseGone(apiv1_gone_msg)