def init(self): ''' Initialize this cache with data from the backend. ''' with self.write_lock: self.backend.read_tables() for field, table in self.backend.tables.iteritems(): self.fields[field] = create_field(field, table) if table.metadata['datatype'] == 'composite': self.composites.add(field) self.fields['ondevice'] = create_field('ondevice', VirtualTable('ondevice'))
def init(self): ''' Initialize this cache with data from the backend. ''' with self.write_lock: self.backend.read_tables() for field, table in self.backend.tables.iteritems(): self.fields[field] = create_field(field, table) if table.metadata['datatype'] == 'composite': self.composites.add(field) self.fields['ondevice'] = create_field('ondevice', VirtualTable('ondevice')) for name, field in self.fields.iteritems(): if name[0] == '#' and name.endswith('_index'): field.series_field = self.fields[name[:-len('_index')]] elif name == 'series_index': field.series_field = self.fields['series'] elif name == 'authors': field.author_sort_field = self.fields['author_sort'] elif name == 'title': field.title_sort_field = self.fields['sort']