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
def export_json(self, path=None):
from utils import _to_json
if not path:
if self.name:
name = os.path.join('Lists', self.name)
else:
name = 'Books'
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 = []
for i in self.get_items():
j = i.json()