From 6bacbafb6f7bbb6096f0f97e98f32493d46bc4e8 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Mon, 4 Mar 2013 08:06:58 -0500 Subject: [PATCH 1/3] move call to update_templates on service startup into a django-admin command --- cms/djangoapps/contentstore/__init__.py | 2 -- rakefile | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cms/djangoapps/contentstore/__init__.py b/cms/djangoapps/contentstore/__init__.py index e8dccbbf60..8b13789179 100644 --- a/cms/djangoapps/contentstore/__init__.py +++ b/cms/djangoapps/contentstore/__init__.py @@ -1,3 +1 @@ -from xmodule.templates import update_templates -update_templates() diff --git a/rakefile b/rakefile index 15692d0d99..f62e75507c 100644 --- a/rakefile +++ b/rakefile @@ -440,6 +440,13 @@ namespace :cms do end end +namespace :cms do + desc "Imports all the templates from the code pack" + task :update_templates do + sh(django_admin(:cms, :dev, :update_templates)) + end +end + namespace :cms do desc "Import course data within the given DATA_DIR variable" task :xlint do From f057ec5a0494b717c5d811fb3c4af481dfb1555c Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Mon, 4 Mar 2013 08:29:56 -0500 Subject: [PATCH 2/3] add new file to commit --- .../contentstore/management/commands/update_templates.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 cms/djangoapps/contentstore/management/commands/update_templates.py diff --git a/cms/djangoapps/contentstore/management/commands/update_templates.py b/cms/djangoapps/contentstore/management/commands/update_templates.py new file mode 100644 index 0000000000..2e8d0565c9 --- /dev/null +++ b/cms/djangoapps/contentstore/management/commands/update_templates.py @@ -0,0 +1,9 @@ +from xmodule.templates import update_templates +from django.core.management.base import BaseCommand + +class Command(BaseCommand): + help = \ +'''Delete a MongoDB backed course''' + + def handle(self, *args, **options): + update_templates() \ No newline at end of file From f21ff7bbfa7658e1e7948e50d2265ed4384b5843 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Mon, 4 Mar 2013 09:15:53 -0500 Subject: [PATCH 3/3] update comment --- .../contentstore/management/commands/update_templates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/management/commands/update_templates.py b/cms/djangoapps/contentstore/management/commands/update_templates.py index 2e8d0565c9..b30d30480a 100644 --- a/cms/djangoapps/contentstore/management/commands/update_templates.py +++ b/cms/djangoapps/contentstore/management/commands/update_templates.py @@ -3,7 +3,7 @@ from django.core.management.base import BaseCommand class Command(BaseCommand): help = \ -'''Delete a MongoDB backed course''' +'''Imports and updates the Studio component templates from the code pack and put in the DB''' def handle(self, *args, **options): update_templates() \ No newline at end of file