Skip to content

Commit 99c31d6

Browse files
authored
Merge pull request readthedocs#5236 from rtfd/stsewd/allow-to-override-trigger-demo-import
Allow to override trigger_build from demo project
2 parents fab340d + 21371da commit 99c31d6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

readthedocs/projects/views/private.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
"""Project views for authenticated users."""
42

53
import logging
@@ -58,9 +56,9 @@
5856
ProjectRelationship,
5957
WebHook,
6058
)
59+
from readthedocs.projects.notifications import EmailConfirmNotification
6160
from readthedocs.projects.signals import project_import
6261
from readthedocs.projects.views.base import ProjectAdminMixin, ProjectSpamMixin
63-
from readthedocs.projects.notifications import EmailConfirmNotification
6462

6563
from ..tasks import retry_domain_verification
6664

@@ -354,7 +352,7 @@ def get(self, request, *args, **kwargs):
354352
if form.is_valid():
355353
project = form.save()
356354
project.save()
357-
trigger_build(project)
355+
self.trigger_initial_build(project)
358356
messages.success(
359357
request,
360358
_('Your demo project is currently being imported'),
@@ -381,6 +379,14 @@ def get_form_kwargs(self):
381379
"""Form kwargs passed in during instantiation."""
382380
return {'user': self.request.user}
383381

382+
def trigger_initial_build(self, project):
383+
"""
384+
Trigger initial build.
385+
386+
Allow to override the behavior from outside.
387+
"""
388+
return trigger_build(project)
389+
384390

385391
class ImportView(PrivateViewMixin, TemplateView):
386392

0 commit comments

Comments
 (0)