From 5f45e2d7481b7c303edb63834f1bc82e41f0c74a Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Tue, 10 Oct 2017 07:53:43 +0200 Subject: [PATCH] Fixed all remarks --- .../agenda/static/js/agenda/projector.js | 1 + .../core/management/commands/collectstatic.py | 30 +++++++++++-------- openslides/global_settings.py | 4 +-- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/openslides/agenda/static/js/agenda/projector.js b/openslides/agenda/static/js/agenda/projector.js index 51333d36a..39ea38db7 100644 --- a/openslides/agenda/static/js/agenda/projector.js +++ b/openslides/agenda/static/js/agenda/projector.js @@ -101,6 +101,7 @@ angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda']) if (result) { $scope.rootItem = result.item; $scope.tree = result.children; + return false; } }); } else if ($scope.element.tree) { diff --git a/openslides/core/management/commands/collectstatic.py b/openslides/core/management/commands/collectstatic.py index 1b155f31f..314dfd204 100644 --- a/openslides/core/management/commands/collectstatic.py +++ b/openslides/core/management/commands/collectstatic.py @@ -26,18 +26,24 @@ class Command(CollectStatic): return super().handle(**options) def collect(self) -> Dict[str, Any]: - destination_dir = os.path.join(settings.OS_STATICFILES_DIR, 'js') - if not os.path.exists(destination_dir): - os.makedirs(destination_dir) + try: + destination_dir = os.path.join(settings.STATICFILES_DIRS[0], 'js') + except IndexError: + # If the user does not want do have staticfiles, he should not get + # the webclient files either. + pass + else: + if not os.path.exists(destination_dir): + os.makedirs(destination_dir) - for realm in self.realms: - filename = self.js_filename.format(realm) - content = self.view.get(realm=realm).content - path = os.path.join(destination_dir, filename) - with open(path, 'wb+') as f: - f.write(content) - self.stdout.write("Written WebclientJavaScriptView for realm {} to '{}'".format( - realm, - path)) + for realm in self.realms: + filename = self.js_filename.format(realm) + content = self.view.get(realm=realm).content + path = os.path.join(destination_dir, filename) + with open(path, 'wb+') as f: + f.write(content) + self.stdout.write("Written WebclientJavaScriptView for realm {} to '{}'".format( + realm, + path)) return super().collect() diff --git a/openslides/global_settings.py b/openslides/global_settings.py index 2cacbaacd..2487d7d68 100644 --- a/openslides/global_settings.py +++ b/openslides/global_settings.py @@ -81,10 +81,8 @@ LOCALE_PATHS = [ STATIC_URL = '/static/' -OS_STATICFILES_DIR = os.path.join(MODULE_DIR, 'static') - STATICFILES_DIRS = [ - OS_STATICFILES_DIR, + os.path.join(MODULE_DIR, 'static'), ]