def create_new_collection(self, title): # Create a new Collection now = str(datetime.now())[0:19] vcol = VirtualResource(self.app) vcol.set_id() header = [] header.append((RDF.type, PIMO['Collection'])) header.append((NIE['title'], Literal(title))) header.append((NAO['created'], Literal(str(now)))) header.append((NAO['lastModified'], Literal(str(now)))) vcol.set_metadata(header) self.add_resource(vcol) icon = self.app.gui.icons.get_icon_by_name('Collection-add.svg', 128, 128) self.app.gui.actions.notify('%s' % title, "A new collection was added to Vazaar</big>", icon)
def get_virtual_resource(self, id_target): """ Return a Virtual Resource from cache if exists. Otherway, a new Virtual Resource is built and added to cache """ try: #rint "return from cache" rid = str(id_target[9:]) vres = self.cache[rid] if vres is not None: return vres except Exception: #rint "get from store" vres = VirtualResource(self.app, id_target) propdict = self.ask.get_properties(id_target) vres.set_properties(propdict) return vres