def populate_with_object(self, obj): # check permissions super(PtgTile, self).populate_with_object(obj) data = {'testingsomething'} obj = aq_inner(obj) data_mgr = ITileDataManager(self) data_mgr.set(data) tile_storage = AnnotationStorage(self) obj_storage = BaseAnnotationStorage(obj) for k, v in obj_storage.items(): tile_storage.storage[k] = v tile_storage.storage[k]['modified'] = '%f' % time.time() scale_data = obj_storage.storage[k]['data'].open().read() tile_storage.storage[k]['data'] = 'somedata'
def populate_with_object(self, obj): # check permissions super(ImageTile, self).populate_with_object(obj) data = {} obj = aq_inner(obj) try: scales = queryMultiAdapter((obj, self.request), name="images") data['image'] = NamedImageFile(str(scales.scale('image').data)) except AttributeError: pass data_mgr = ITileDataManager(self) data_mgr.set(data) tile_storage = AnnotationStorage(self) obj_storage = BaseAnnotationStorage(obj) for k, v in obj_storage.items(): tile_storage.storage[k] = v tile_storage.storage[k]['modified'] = '%f' % time.time() scale_data = obj_storage.storage[k]['data'].open().read() tile_storage.storage[k]['data'] = NamedImageFile(str(scale_data))