Mercurial > hg > toolbox
changeset 11:1c6dbeb4ddab
py3
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Tue, 24 Nov 2020 13:07:43 -0800 |
parents | 2fc286e008f5 |
children | c280a43ac442 |
files | toolbox/model.py |
diffstat | 1 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/toolbox/model.py Tue Nov 24 13:05:51 2020 -0800 +++ b/toolbox/model.py Tue Nov 24 13:07:43 2020 -0800 @@ -113,17 +113,16 @@ """ def __init__(self, fields=None, whoosh_index=None): - + ProjectsModel.__init__(self, fields=fields, whoosh_index=whoosh_index) # indices self._projects = {} self.index = {} - self.load() def update(self, project, load=False): - + if project['name'] in self._projects and project == self._projects[project['name']]: return # nothing to do if not load: @@ -197,7 +196,7 @@ if not classifiers[key]: del classifiers[key] self.search.delete(project) - + def load(self): """for subclasses; in memory, load nothing""" @@ -234,7 +233,7 @@ try: project = json.loads(file(filename).read()) except: - print 'File: ' + i + print('File: {}'.format(i)) raise self.files[project['name']] = i self.update(project, load='modified' in project) @@ -364,7 +363,7 @@ except KeyError: continue # it's prob a design doc self.update(project, load=True) - + def save(self, project): name = project['name'] try: