本文整理汇总了Python中sentry.utils.http.get_origins函数的典型用法代码示例。如果您正苦于以下问题:Python get_origins函数的具体用法?Python get_origins怎么用?Python get_origins使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_origins函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_empty_origin_values
def test_empty_origin_values(self):
project = Project.objects.get()
project.update_option('sentry:origins', [u'*', None, ''])
with self.settings(SENTRY_ALLOW_ORIGIN=None):
result = get_origins(project)
self.assertEquals(result, frozenset([u'*']))
开发者ID:Kayle009,项目名称:sentry,代码行数:7,代码来源:tests.py
示例2: test_project_and_setting
def test_project_and_setting(self):
project = Project.objects.get()
project.update_option('sentry:origins', ['http://foo.example'])
with self.settings(SENTRY_ALLOW_ORIGIN='http://example.com'):
result = get_origins(project)
self.assertEquals(result, frozenset(['http://foo.example', 'http://example.com']))
开发者ID:ForkRepo,项目名称:sentry,代码行数:7,代码来源:tests.py
示例3: test_project
def test_project(self):
project = Project.objects.get()
ProjectOption.objects.create(project=project, key='sentry:origins', value=['http://foo.example'])
with self.Settings(SENTRY_ALLOW_ORIGIN=None):
result = get_origins(project)
self.assertEquals(result, frozenset(['http://foo.example']))
开发者ID:allanlei,项目名称:sentry,代码行数:7,代码来源:tests.py
示例4: test_project_and_setting
def test_project_and_setting(self):
from sentry.models import Project, ProjectOption
project = Project.objects.get()
ProjectOption.objects.create(project=project, key='sentry:origins', value=['http://foo.example'])
with self.Settings(SENTRY_ALLOW_ORIGIN='http://example.com'):
result = get_origins(project)
self.assertEquals(result, frozenset(['http://foo.example', 'http://example.com']))
开发者ID:allanlei,项目名称:sentry,代码行数:8,代码来源:tests.py
示例5: crossdomain_xml
def crossdomain_xml(request, project):
origin_list = get_origins(project)
if origin_list == '*':
origin_list = [origin_list]
response = render_to_response('sentry/crossdomain.xml', {
'origin_list': origin_list
}, request)
response['Content-Type'] = 'application/xml'
return response
开发者ID:davidszotten,项目名称:sentry,代码行数:11,代码来源:api.py
示例6: crossdomain_xml
def crossdomain_xml(request, project_id):
if not project_id.isdigit():
return HttpResponse(status=404)
try:
project = Project.objects.get_from_cache(id=project_id)
except Project.DoesNotExist:
return HttpResponse(status=404)
origin_list = get_origins(project)
response = render_to_response("sentry/crossdomain.xml", {"origin_list": origin_list})
response["Content-Type"] = "application/xml"
return response
开发者ID:mitsuhiko,项目名称:sentry,代码行数:14,代码来源:api.py
示例7: crossdomain_xml
def crossdomain_xml(request, project_id):
if project_id.isdigit():
lookup = {"id": project_id}
else:
lookup = {"slug": project_id}
try:
project = Project.objects.get_from_cache(**lookup)
except Project.DoesNotExist:
return HttpResponse(status=404)
origin_list = get_origins(project)
if origin_list == "*":
origin_list = [origin_list]
response = render_to_response("sentry/crossdomain.xml", {"origin_list": origin_list})
response["Content-Type"] = "application/xml"
return response
开发者ID:rnoldo,项目名称:sentry,代码行数:18,代码来源:api.py
示例8: crossdomain_xml
def crossdomain_xml(request, project_id):
if not project_id.isdigit():
return HttpResponse(status=404)
try:
project = Project.objects.get_from_cache(id=project_id)
except Project.DoesNotExist:
return HttpResponse(status=404)
origin_list = get_origins(project)
if origin_list == ['*']:
origin_list = [origin_list]
response = render_to_response('sentry/crossdomain.xml', {
'origin_list': origin_list
})
response['Content-Type'] = 'application/xml'
return response
开发者ID:haojiang1,项目名称:sentry,代码行数:19,代码来源:api.py
示例9: crossdomain_xml
def crossdomain_xml(request, project_id):
if project_id.isdigit():
lookup = {'id': project_id}
else:
lookup = {'slug': project_id}
try:
project = Project.objects.get_from_cache(**lookup)
except Project.DoesNotExist:
return HttpResponse(status=404)
origin_list = get_origins(project)
if origin_list == '*':
origin_list = [origin_list]
response = render_to_response('sentry/crossdomain.xml', {
'origin_list': origin_list
})
response['Content-Type'] = 'application/xml'
return response
开发者ID:DNIWE-Systems,项目名称:sentry,代码行数:20,代码来源:api.py
示例10: test_setting_uri
def test_setting_uri(self):
with self.settings(SENTRY_ALLOW_ORIGIN='http://example.com'):
result = get_origins(None)
self.assertEquals(result, frozenset(['http://example.com']))
开发者ID:ForkRepo,项目名称:sentry,代码行数:4,代码来源:tests.py
示例11: test_setting_all
def test_setting_all(self):
with self.settings(SENTRY_ALLOW_ORIGIN='*'):
result = get_origins(None)
self.assertEquals(result, frozenset(['*']))
开发者ID:ForkRepo,项目名称:sentry,代码行数:4,代码来源:tests.py
示例12: test_setting_empty
def test_setting_empty(self):
with self.settings(SENTRY_ALLOW_ORIGIN=None):
result = get_origins(None)
self.assertEquals(result, frozenset([]))
开发者ID:ForkRepo,项目名称:sentry,代码行数:4,代码来源:tests.py
示例13: test_project_default
def test_project_default(self):
project = Project.objects.get()
with self.settings(SENTRY_ALLOW_ORIGIN=None):
result = get_origins(project)
self.assertEquals(result, frozenset(['*']))
开发者ID:ForkRepo,项目名称:sentry,代码行数:6,代码来源:tests.py
示例14: get_allowed_origins
def get_allowed_origins(self):
from sentry.utils.http import get_origins
return get_origins(self.project)
开发者ID:ekmartin,项目名称:sentry,代码行数:3,代码来源:projectkey.py
注:本文中的sentry.utils.http.get_origins函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论