make sure folder exists

This commit is contained in:
j 2016-01-15 13:58:42 +05:30
parent b961086475
commit fa916d11b7

View file

@ -338,13 +338,14 @@ class List(db.Model):
pass pass
def export_json(self, path=None): def export_json(self, path=None):
from utils import _to_json
if not path: if not path:
if self.name: if self.name:
name = os.path.join('Lists', self.name) name = os.path.join('Lists', self.name)
else: else:
name = 'Books' name = 'Books'
path = os.path.join(os.path.expanduser(settings.preferences['libraryPath']), name, 'library.json') path = os.path.join(os.path.expanduser(settings.preferences['libraryPath']), name, 'library.json')
from utils import _to_json ox.makedirs(os.path.dirname(path))
items = [] items = []
for i in self.get_items(): for i in self.get_items():
j = i.json() j = i.json()