Example #1
0
 def post(self, request, *args, **kwargs):
     # pylint: disable=unused-argument
     if 'integration_pk' in kwargs:
         integration = self.get_integration()
         update_webhook(self.get_project(), integration, request=request)
     else:
         # This is a brute force form of the webhook sync, if a project has a
         # webhook or a remote repository object, the user should be using
         # the per-integration sync instead.
         attach_webhook(project=self.get_project(), request=request)
     return HttpResponseRedirect(self.get_success_url())
Example #2
0
 def post(self, request, *args, **kwargs):
     # pylint: disable=unused-argument
     if 'integration_pk' in kwargs:
         integration = self.get_integration()
         update_webhook(self.get_project(), integration, request=request)
     else:
         # This is a brute force form of the webhook sync, if a project has a
         # webhook or a remote repository object, the user should be using
         # the per-integration sync instead.
         attach_webhook(project=self.get_project(), request=request)
     return HttpResponseRedirect(self.get_success_url())
Example #3
0
def project_resync_webhook(request, project_slug):
    """
    Resync a project webhook.

    The signal will add a success/failure message on the request.
    """
    project = get_object_or_404(Project.objects.for_admin_user(request.user),
                                slug=project_slug)
    if request.method == 'POST':
        attach_webhook(project=project, request=request)
        return HttpResponseRedirect(
            reverse('projects_detail', args=[project.slug]))

    return render_to_response('projects/project_resync_webhook.html',
                              {'project': project},
                              context_instance=RequestContext(request))
Example #4
0
def project_resync_webhook(request, project_slug):
    """
    Resync a project webhook.

    The signal will add a success/failure message on the request.
    """
    project = get_object_or_404(Project.objects.for_admin_user(request.user),
                                slug=project_slug)
    if request.method == 'POST':
        attach_webhook(project=project, request=request)
        return HttpResponseRedirect(reverse('projects_detail',
                                            args=[project.slug]))

    return render_to_response(
        'projects/project_resync_webhook.html',
        {'project': project},
        context_instance=RequestContext(request)
    )
Example #5
0
def handle_project_import(sender, **kwargs):
    """Add post-commit hook on project import"""
    project = sender
    request = kwargs.get('request')

    attach_webhook(project=project, request=request)
Example #6
0
def handle_project_import(sender, **kwargs):
    """Add post-commit hook on project import"""
    project = sender
    request = kwargs.get('request')

    attach_webhook(project=project, request=request)
Example #7
0
 def post(self, request, *args, **kwargs):
     # pylint: disable=unused-argument
     attach_webhook(project=self.get_project(), request=request)
     return HttpResponseRedirect(self.get_success_url())