From 59e248d7a8f7994fdb456653c4a2898994457bd9 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 18 Jun 2010 17:15:07 +0200 Subject: [PATCH] import fix --- apps/catalogue/management/commands/importbooks.py | 2 +- apps/catalogue/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/catalogue/management/commands/importbooks.py b/apps/catalogue/management/commands/importbooks.py index cead75fa2..ee469ba9b 100644 --- a/apps/catalogue/management/commands/importbooks.py +++ b/apps/catalogue/management/commands/importbooks.py @@ -44,7 +44,7 @@ class Command(BaseCommand): if not os.path.isdir(dir_name): print self.style.ERROR("%s: Not a directory. Skipping." % dir_name) else: - for file_name in os.listdir(dir_name): + for file_name in sorted(os.listdir(dir_name)): file_path = os.path.join(dir_name, file_name) file_base, ext = os.path.splitext(file_path) diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index 90ecb1a3c..37ea4e842 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -296,7 +296,7 @@ class Book(models.Model): book_info = dcparser.parse(xml_file) if not isinstance(xml_file, File): - xml_file = File(xml_file) + xml_file = File(open(xml_file)) try: return cls.from_text_and_meta(xml_file, book_info, overwrite) -- 2.20.1