def cmd_ungroup(SUB, settings): """ folder ungroup ID """ sa = Folder.start_session('folder', settings.dbref) for subid in SUB: sub = Folder.fetch_instance(subid, 'folder') node.partOf_id = None sa.add(node) sa.commit()
def cmd_new(NAME, REF, settings): sa = Folder.start_session('folder', settings.dbref) folder = Folder.byName(NAME) if folder: log.std("Found existing folder %s, created %s", folder.name, folder.date_added) else: folder = Folder(name=NAME) folder.init_defaults() sa.add(folder) sa.commit() log.std("Added new folder %s", folder.name) print_Folder(folder)
def cmd_group(ID, SUB, settings): """ folder group ID SUB... """ taxus.ORMMixin.init('folder', settings.dbref) sa = Folder.start_session('folder', settings.dbref) root = Folder.fetch_instance(ID, 'folder') for subid in SUB: sub = Folder.fetch_instance(subid, 'folder') sub.partOf_id = ID # XXX abstract using some kind of master store iface sa.add(node) sa.commit()
def cmd_list(settings): sa = Folder.get_session('default', settings.dbref) for t in Folder.all(): print_Folder(t)