X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/08a62c79e1e283f446130c02b92aa7920d7d7949..6a4cff9d955a0dbf417f684bf98a288f089bf46b:/librarian/__init__.py diff --git a/librarian/__init__.py b/librarian/__init__.py index b257b79..9a9e23e 100644 --- a/librarian/__init__.py +++ b/librarian/__init__.py @@ -10,6 +10,8 @@ import re import shutil import urllib +from util import makedirs + class UnicodeException(Exception): def __str__(self): @@ -82,7 +84,7 @@ class WLURI(object): slug = None example = 'http://wolnelektury.pl/katalog/lektura/template/' - _re_wl_uri = re.compile(r'http://(www\.)?wolnelektury.pl/katalog/lektura/' + _re_wl_uri = re.compile(r'http://(www\.)?wolnelektury.pl/katalog/lektur[ay]/' '(?P[-a-z0-9]+)/?$') def __init__(self, uri): @@ -273,8 +275,7 @@ class OutputFile(object): """Save file to a path. Create directories, if necessary.""" dirname = os.path.dirname(os.path.abspath(path)) - if not os.path.isdir(dirname): - os.makedirs(dirname) + makedirs(dirname) shutil.copy(self.get_filename(), path)