Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to override trigger_build from demo project #5236

Merged
merged 3 commits into from Feb 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions readthedocs/projects/views/private.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""Project views for authenticated users."""

import logging
Expand Down Expand Up @@ -58,9 +56,9 @@
ProjectRelationship,
WebHook,
)
from readthedocs.projects.notifications import EmailConfirmNotification
from readthedocs.projects.signals import project_import
from readthedocs.projects.views.base import ProjectAdminMixin, ProjectSpamMixin
from readthedocs.projects.notifications import EmailConfirmNotification

from ..tasks import retry_domain_verification

Expand Down Expand Up @@ -354,7 +352,7 @@ def get(self, request, *args, **kwargs):
if form.is_valid():
project = form.save()
project.save()
trigger_build(project)
self.trigger_initial_build(project)
messages.success(
request,
_('Your demo project is currently being imported'),
Expand All @@ -381,6 +379,14 @@ def get_form_kwargs(self):
"""Form kwargs passed in during instantiation."""
return {'user': self.request.user}

def trigger_initial_build(self, project):
"""
Trigger initial build.

Allow to override the behavior from outside.
"""
return trigger_build(project)


class ImportView(PrivateViewMixin, TemplateView):

Expand Down