Beispiel #1
0
 def generate_data(self, scope):
     """Create a genererator with dicts for each item.
     """
     for item in zot.json_read(self.wf.datafile('zotero_db.json')):
         dict_array = []
         the_scope = self.filters.get(scope, None)
         if the_scope:
             columns = the_scope.keys()
             for column in columns:
                 json_map = the_scope.get(column, None)
                 if json_map:
                     dict_array.append({column: get_datum(item, json_map)})
         yield dict_array
Beispiel #2
0
 def __init__(self, wf, scope, db=None):
     self.wf = wf
     self.scope = scope
     self.db = self.wf.datafile('zot_index.db') if db == None else db
     self.filters = zot.json_read(wf.workflowfile('index_filters.json'))
     self.scopes = self.filters.keys()