def __call__(self): self.setup() layout = json.loads(self.cover_layout) assign_tile_ids(layout, override=False) self.cover_layout = json.dumps(layout) self.context.cover_layout = self.cover_layout self.context.reindexObject() return 'saved'
def save(self): cover_layout = self.request.get('cover_layout') layout = json.loads(cover_layout) assign_tile_ids(layout, override=False) cover_layout = json.dumps(layout) self.context.cover_layout = cover_layout self.context.reindexObject() return cover_layout
def assign_id_for_tiles(cover, event): if not cover.cover_layout: # When versioning, a new cover gets created, so, if we already # have a cover_layout stored, do not overwrite it registry = getUtility(IRegistry) settings = registry.forInterface(ICoverSettings) layout = settings.layouts.get(cover.template_layout) if layout: layout = json.loads(layout) assign_tile_ids(layout) cover.cover_layout = json.dumps(layout)
def _bootstrap_tiles(self): layout = self.get_layout() assign_tile_ids(layout, override=False) self.cover.cover_layout = json.dumps(layout) self.cover.reindexObject()