本文整理汇总了Python中sentry.utils.samples.create_sample_event函数的典型用法代码示例。如果您正苦于以下问题:Python create_sample_event函数的具体用法?Python create_sample_event怎么用?Python create_sample_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_sample_event函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: create_new_team_project
def create_new_team_project(request, team):
from sentry.web.forms.projects import NewProjectAdminForm, NewProjectForm
if not can_create_projects(request.user, team):
return missing_perm(request, Permissions.ADD_PROJECT, team=team)
if request.user.is_superuser:
form_cls = NewProjectAdminForm
initial = {
'owner': request.user.username,
}
else:
form_cls = NewProjectForm
initial = {}
form = form_cls(request.POST or None, initial=initial)
if form.is_valid():
project = form.save(commit=False)
project.team = team
project.save()
create_sample_event(project)
if project.platform not in (None, 'other'):
return HttpResponseRedirect(reverse('sentry-docs-client', args=[project.team.slug, project.slug, project.platform]))
return HttpResponseRedirect(reverse('sentry-get-started', args=[project.team.slug, project.slug]))
context = csrf(request)
context.update({
'form': form,
'page': 'projects',
'SUBSECTION': 'new_project',
})
return render_with_team_context(team, 'sentry/teams/projects/new.html', context, request)
开发者ID:basco-johnkevin,项目名称:sentry,代码行数:35,代码来源:teams.py
示例2: post
def post(self, request, team):
"""
Create a New Project
````````````````````
Create a new project bound to a team.
:pparam string organization_slug: the slug of the organization the
team belongs to.
:pparam string team_slug: the slug of the team to create a new project
for.
:param string name: the name for the new project.
:param string slug: optionally a slug for the new project. If it's
not provided a slug is generated from the name.
:auth: required
"""
serializer = ProjectSerializer(data=request.DATA)
if serializer.is_valid():
result = serializer.object
try:
with transaction.atomic():
project = Project.objects.create(
name=result['name'],
slug=result.get('slug'),
organization=team.organization,
team=team,
platform=result.get('platform')
)
except IntegrityError:
return Response(
{'detail': 'A project with this slug already exists.'},
status=409,
)
# XXX: create sample event?
self.create_audit_entry(
request=request,
organization=team.organization,
target_object=project.id,
event=AuditLogEntryEvent.PROJECT_ADD,
data=project.get_audit_log_data(),
)
project_created.send(project=project, user=request.user, sender=self)
create_sample_event(project, platform='javascript')
return Response(serialize(project, request.user), status=201)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
开发者ID:duanshuaimin,项目名称:sentry,代码行数:52,代码来源:team_project_index.py
示例3: handle
def handle(self, **options):
from django.conf import settings
from sentry.constants import PLATFORM_LIST
from sentry.models import Project
from sentry.utils.samples import create_sample_event
if not options['project']:
project = Project.objects.get(id=settings.SENTRY_PROJECT)
else:
if options['project'].isdigit():
project = Project.objects.get(id=options['project'])
elif '/' in options['project']:
t_slug, p_slug = options['project'].split('/', 1)
project = Project.objects.get(slug=p_slug, team__slug=t_slug)
else:
raise CommandError('Project must be specified as team-slug/project-slug or a project id')
if options['platform'] not in PLATFORM_LIST:
raise CommandError('Invalid platform. Must specify one of: %s' % ', '.join(PLATFORM_LIST))
platform = options['platform'] or project.platform
event = create_sample_event(project, platform)
if not event:
raise CommandError('Unable to create an event for platform %r' % (str(platform),))
self.stdout.write('Event created: %s' % (event.group.get_absolute_url(),))
开发者ID:BlueMoebius,项目名称:sentry,代码行数:26,代码来源:create_sample_event.py
示例4: create_event
def create_event(self, project, release, platform='python', raw=True):
from sentry.utils.samples import create_sample_event
event = create_sample_event(
project=project, platform=platform, release=release.version, raw=raw
)
create_sample_time_series(event)
return event
开发者ID:binlee1990,项目名称:sentry,代码行数:7,代码来源:apidocs.py
示例5: test_one_issue
def test_one_issue(self):
event = create_sample_event(
project=self.project,
platform='python',
event_id='d964fdbd649a4cf8bfc35d18082b6b0e',
timestamp=1452683305,
)
event.group.update(
first_seen=datetime(2018, 1, 12, 3, 8, 25, tzinfo=timezone.utc),
last_seen=datetime(2018, 1, 13, 3, 8, 25, tzinfo=timezone.utc),
)
GroupAssignee.objects.create(
user=self.user,
group=event.group,
project=self.project,
)
self.project.update(first_event=timezone.now())
self.browser.get(self.path)
# dashboard is a bit complex to load since it has many subcomponents
# so we bank on the core container and the activity container being
# enough of a check
self.browser.wait_until('.organization-home')
self.browser.wait_until('.dashboard-barchart')
self.browser.wait_until_not('.loading-indicator')
assert not self.browser.element_exists('.awaiting-events')
self.browser.snapshot('org dash one issue')
开发者ID:hosmelq,项目名称:sentry,代码行数:26,代码来源:test_dashboard.py
示例6: test_one_issue
def test_one_issue(self):
event = create_sample_event(
project=self.project,
platform='python',
event_id='d964fdbd649a4cf8bfc35d18082b6b0e',
timestamp=1452683305,
)
event.group.update(
first_seen=datetime(2018, 1, 12, 3, 8, 25, tzinfo=timezone.utc),
last_seen=datetime(2018, 1, 13, 3, 8, 25, tzinfo=timezone.utc),
)
GroupAssignee.objects.create(
user=self.user,
group=event.group,
project=self.project,
)
OrganizationOnboardingTask.objects.create_or_update(
organization_id=self.project.organization_id,
task=OnboardingTask.FIRST_EVENT,
status=OnboardingTaskStatus.COMPLETE,
)
self.project.update(first_event=timezone.now())
self.browser.get(self.path)
self.browser.wait_until_not('.loading-indicator')
self.browser.wait_until('[data-test-id] figure')
self.browser.snapshot('org dash one issue')
开发者ID:Kayle009,项目名称:sentry,代码行数:26,代码来源:test_dashboard.py
示例7: post
def post(self, request, project):
event = create_sample_event(
project, platform=project.platform, default='javascript',
)
data = serialize(event, request.user)
return Response(data)
开发者ID:getsentry,项目名称:sentry,代码行数:8,代码来源:project_create_sample.py
示例8: save
def save(self, actor, team, ip_address):
project = super(AddProjectForm, self).save(commit=False)
project.team = team
project.organization = team.organization
project.save()
AuditLogEntry.objects.create(
organization=project.organization,
actor=actor,
ip_address=ip_address,
target_object=project.id,
event=AuditLogEntryEvent.PROJECT_ADD,
data=project.get_audit_log_data(),
)
create_sample_event(project, platform='javascript')
return project
开发者ID:AyrtonRicardo,项目名称:sentry,代码行数:18,代码来源:add_project.py
示例9: create_sample_event
def create_sample_event(self, platform):
event = create_sample_event(
project=self.project,
platform=platform,
event_id='d964fdbd649a4cf8bfc35d18082b6b0e',
timestamp=1452683305,
)
event.group.update(
first_seen=datetime(2015, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
last_seen=datetime(2016, 1, 13, 3, 8, 25, tzinfo=timezone.utc),
)
return event
开发者ID:Kayle009,项目名称:sentry,代码行数:12,代码来源:test_project_similar_issues.py
示例10: create_sample_event
def create_sample_event(self, platform, default=None, sample_name=None):
event = create_sample_event(
project=self.project,
platform=platform,
default=default,
sample_name=sample_name,
event_id='d964fdbd649a4cf8bfc35d18082b6b0e'
)
event.group.update(
first_seen=datetime(2015, 8, 13, 3, 8, 25, tzinfo=timezone.utc),
last_seen=datetime(2016, 1, 13, 3, 8, 25, tzinfo=timezone.utc),
)
return event
开发者ID:Kayle009,项目名称:sentry,代码行数:13,代码来源:test_issue_details.py
示例11: get
def get(self, request):
org = Organization(
id=1,
slug='organization',
name='My Company',
)
project = Project(
id=1,
organization=org,
slug='project',
name='My Project',
)
event = create_sample_event(
project=project,
platform='python',
event_id='595',
timestamp=1452683305,
)
group = event.group
link = absolute_uri(u'/{}/{}/issues/{}/feedback/'.format(
project.organization.slug,
project.slug,
group.id,
))
return MailPreview(
html_template='sentry/emails/activity/new-user-feedback.html',
text_template='sentry/emails/activity/new-user-feedback.txt',
context={
'group': group,
'report': {
'name': 'Homer Simpson',
'email': '[email protected]',
'comments': 'I hit a bug.\n\nI went to https://example.com, hit the any key, and then it stopped working. DOH!',
},
'link': link,
'reason': 'are subscribed to this issue',
'enhanced_privacy': False,
},
).render(request)
开发者ID:yaoqi,项目名称:sentry,代码行数:42,代码来源:debug_new_user_feedback_email.py
示例12: test_configuration
def test_configuration(self, project):
from sentry.utils.samples import create_sample_event
event = create_sample_event(project, platform='python')
notification = Notification(event=event)
return self.notify(notification)
开发者ID:Batterfii,项目名称:sentry,代码行数:5,代码来源:notify.py
示例13: test_configuration
def test_configuration(self, project):
from sentry.utils.samples import create_sample_event
event = create_sample_event(project, default='python')
return self.notify_users(event.group, event, fail_silently=False)
开发者ID:amoygao,项目名称:sentry,代码行数:4,代码来源:notify.py
示例14: test_configuration
def test_configuration(self, project):
from sentry.utils.samples import create_sample_event
event = create_sample_event(project, default='python')
return self.post_process(event.group, event, is_new=True, is_sample=False)
开发者ID:vzaritovsky,项目名称:sentry,代码行数:4,代码来源:notify.py
注:本文中的sentry.utils.samples.create_sample_event函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论