當前位置: 首頁>>代碼示例>>Python>>正文


Python AtramhasisView.set_locale_cookie方法代碼示例

本文整理匯總了Python中atramhasis.views.views.AtramhasisView.set_locale_cookie方法的典型用法代碼示例。如果您正苦於以下問題:Python AtramhasisView.set_locale_cookie方法的具體用法?Python AtramhasisView.set_locale_cookie怎麽用?Python AtramhasisView.set_locale_cookie使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在atramhasis.views.views.AtramhasisView的用法示例。


在下文中一共展示了AtramhasisView.set_locale_cookie方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_default_locale

# 需要導入模塊: from atramhasis.views.views import AtramhasisView [as 別名]
# 或者: from atramhasis.views.views.AtramhasisView import set_locale_cookie [as 別名]
 def test_default_locale(self):
     config_default_lang = settings.get('pyramid.default_locale_name')
     self.request.referer = None
     self.request.skos_registry = self.regis
     atramhasisview = AtramhasisView(self.request)
     res = atramhasisview.set_locale_cookie()
     self.assertTrue((res.headers.get('Set-Cookie')).startswith('_LOCALE_=' + config_default_lang))
開發者ID:anukat2015,項目名稱:atramhasis,代碼行數:9,代碼來源:test_views.py

示例2: test_locale_uppercase

# 需要導入模塊: from atramhasis.views.views import AtramhasisView [as 別名]
# 或者: from atramhasis.views.views.AtramhasisView import set_locale_cookie [as 別名]
 def test_locale_uppercase(self):
     testlang = 'it'
     self.request.GET['language'] = testlang.upper()
     self.request.referer = None
     self.request.skos_registry = self.regis
     atramhasisview = AtramhasisView(self.request)
     res = atramhasisview.set_locale_cookie()
     self.assertTrue((res.headers.get('Set-Cookie')).startswith('_LOCALE_=' + testlang))
開發者ID:anukat2015,項目名稱:atramhasis,代碼行數:10,代碼來源:test_views.py

示例3: test_unsupported_lang

# 需要導入模塊: from atramhasis.views.views import AtramhasisView [as 別名]
# 或者: from atramhasis.views.views.AtramhasisView import set_locale_cookie [as 別名]
 def test_unsupported_lang(self):
     config_default_lang = settings.get('pyramid.default_locale_name')
     request = testing.DummyRequest()
     request.GET['language'] = 'XX'
     request.referer = None
     request.skos_registry = self.regis
     atramhasisview = AtramhasisView(request)
     res = atramhasisview.set_locale_cookie()
     self.assertTrue((res.headers.get('Set-Cookie')).startswith('_LOCALE_=' + config_default_lang))
開發者ID:JDeVos,項目名稱:atramhasis,代碼行數:11,代碼來源:test_views.py

示例4: test_referer

# 需要導入模塊: from atramhasis.views.views import AtramhasisView [as 別名]
# 或者: from atramhasis.views.views.AtramhasisView import set_locale_cookie [as 別名]
 def test_referer(self):
     testlang = 'it'
     testurl = 'http://www.foo.bar'
     self.request.GET['language'] = testlang.upper()
     self.request.referer = testurl
     self.request.skos_registry = self.regis
     atramhasisview = AtramhasisView(self.request)
     res = atramhasisview.set_locale_cookie()
     self.assertEqual(res.status, '302 Found')
     self.assertEqual(res.location, testurl)
開發者ID:anukat2015,項目名稱:atramhasis,代碼行數:12,代碼來源:test_views.py


注:本文中的atramhasis.views.views.AtramhasisView.set_locale_cookie方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。