5
5
from django .dispatch import receiver
6
6
from ol_openedx_git_auto_export .constants import ENABLE_GIT_AUTO_EXPORT
7
7
from ol_openedx_git_auto_export .tasks import async_export_to_git
8
- from xmodule .modulestore .django import SignalHandler
8
+ from xmodule .modulestore .django import SignalHandler , modulestore
9
9
10
10
log = logging .getLogger (__name__ )
11
11
@@ -20,7 +20,7 @@ def listen_for_course_publish(
20
20
Receives publishing signal and performs publishing related workflows
21
21
"""
22
22
git_repo_export_dir = getattr (
23
- settings , "GIT_REPO_EXPORT_DIR" , "/edx/var/edxapp /export_course_repos"
23
+ settings , "GIT_REPO_EXPORT_DIR" , "/openedx /export_course_repos"
24
24
)
25
25
if not os .path .exists (git_repo_export_dir ): # noqa: PTH110
26
26
# for development/docker/vagrant if GIT_REPO_EXPORT_DIR folder does not exist then create it # noqa: E501
@@ -32,6 +32,13 @@ def listen_for_course_publish(
32
32
if settings .FEATURES .get ("ENABLE_EXPORT_GIT" ) and settings .FEATURES .get (
33
33
ENABLE_GIT_AUTO_EXPORT
34
34
):
35
+ course_module = modulestore ().get_course (course_key )
36
+ if not course_module .giturl :
37
+ log .info (
38
+ "Course %s does not have a GIT URL set in course advance settings, skipping export." , # noqa: E501
39
+ course_module .id ,
40
+ )
41
+ return
35
42
# If the Git auto-export is enabled, push the course changes to Git
36
43
log .info (
37
44
"Course published with auto-export enabled. Starting export... (course id: %s)" , # noqa: E501
0 commit comments