def create(self,args): uri = args.uri.strip() space = LtrSpace().setUri(uri) box = LtrBox(space).setUri(uri) box.setBoxname(args.boxname.strip()) box.create() directory = args.directory.strip() box.fspath = directory box.writeCookie()
def clone(self,args): name = args.boxname.strip() src = args.src.strip() dst = args.dst.strip() if os.path.isdir(src): srcbox = LtrSpace.boxFromCookie(src) else: space = LtrSpace().setUri(src) srcbox = space.getBox(space.boxname) dstbox = LtrBox(srcbox.space) dstbox.fspath = dst dstbox.setName(name) dstbox.create() dstbox.writeCookie()
def setopt(self,key,value): (docname,keyname)=key.split(".") d = LtrBox.load(self.records,docname) setattr(d,keyname,value) d.store(self.records)
def getBoxNames(self): return map(lambda x: x.setSpace(self).id,list(LtrBox.view(self.records,"ltrcrawler/boxes")))
def getBox(self,boxname): return LtrBox.load(self.records,boxname).setSpace(self)