本文整理匯總了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)