Librarian in regular requirements.
[redakcja.git] / apps / catalogue / management / commands / import_wl.py
old mode 100755 (executable)
new mode 100644 (file)
index 5f60388..45c9e33
@@ -31,9 +31,7 @@ class Command(BaseCommand):
         verbose = options.get('verbose')
 
         # Start transaction management.
-        transaction.commit_unless_managed()
         transaction.enter_transaction_management()
-        transaction.managed(True)
 
         if verbose:
             print 'Reading currently managed files (skipping hidden ones).'
@@ -43,7 +41,7 @@ class Command(BaseCommand):
                 print b.slug
             text = b.materialize().encode('utf-8')
             try:
-                info = BookInfo.from_string(text)
+                info = BookInfo.from_bytes(text)
             except (ParseError, ValidationError):
                 pass
             else:
@@ -61,7 +59,7 @@ class Command(BaseCommand):
         for book in json.load(urllib2.urlopen(WL_API)):
             book_detail = json.load(urllib2.urlopen(book['href']))
             xml_text = urllib2.urlopen(book_detail['xml']).read()
-            info = BookInfo.from_string(xml_text)
+            info = BookInfo.from_bytes(xml_text)
             previous_books = slugs.get(info.slug)
             if previous_books:
                 if len(previous_books) > 1: