From b69141c4b22ffcebafcebb526f0973194f2a91cb Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Wed, 2 Nov 2016 15:27:10 +0100 Subject: [PATCH 1/1] easier import for multiple lessons --- catalogue/management/commands/importlessons.py | 8 ++++++++ lib/librarian | 2 +- requirements.txt | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/catalogue/management/commands/importlessons.py b/catalogue/management/commands/importlessons.py index d179b16..d4733d3 100755 --- a/catalogue/management/commands/importlessons.py +++ b/catalogue/management/commands/importlessons.py @@ -33,6 +33,8 @@ class Command(BaseCommand): @staticmethod def all_attachments(path): files = {} + if not os.path.isdir(path): + return files def read_dir(path): for name in os.listdir(path): @@ -94,6 +96,12 @@ class Command(BaseCommand): file_path = os.path.join(abs_dir, file_name) file_base, ext = os.path.splitext(file_path) + if os.path.isdir(file_path): + dir_imported, dir_skipped = self.import_from_dir(file_path) + files_imported += dir_imported + files_skipped += files_skipped + continue + # Skip files that are not XML files if not ext == '.xml': continue diff --git a/lib/librarian b/lib/librarian index 565aa32..05a4485 160000 --- a/lib/librarian +++ b/lib/librarian @@ -1 +1 @@ -Subproject commit 565aa32ff31bdbe6e2aaf9f47b124ac1f883a990 +Subproject commit 05a4485b020b9252f5ffc02d19c163705cbf26e2 diff --git a/requirements.txt b/requirements.txt index 1daff32..47340f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -34,7 +34,7 @@ pysolr>=3,<4 pybbm>=0.14,<0.15 django-libravatar -sorl-thumbnail>=11,<12 +sorl-thumbnail>=12,<13 pyyaml django-subdomains>=2.0.4,<2.1 -- 2.20.1