def testUnrestrictedTraverse(self): self.assertTrue(IReflectoFile.providedBy( self.reflecto.unrestrictedTraverse("reflecto.txt"))) self.assertTrue(IReflectoDirectory.providedBy( self.reflecto.unrestrictedTraverse("subdir"))) self.assertTrue(IReflectoFile.providedBy( self.reflecto.unrestrictedTraverse("subdir/emptyfile.txt")))
def testUnrestrictedTraverse(self): self.assertTrue( IReflectoFile.providedBy( self.reflecto.unrestrictedTraverse("reflecto.txt"))) self.assertTrue( IReflectoDirectory.providedBy( self.reflecto.unrestrictedTraverse("subdir"))) self.assertTrue( IReflectoFile.providedBy( self.reflecto.unrestrictedTraverse("subdir/emptyfile.txt")))
def _addToZip(self, zip, entry, path=[]): newpath=path + [entry.__name__] if IReflectoDirectory.providedBy(entry): for key in entry.keys(): if not self.acceptableName(key): continue value=entry[key] if not self.acceptableEntry(value): continue self._addToZip(zip, entry[key], newpath) elif IReflectoFile.providedBy(entry): zip.write(entry.getFilesystemPath(), os.path.join(*newpath))
def _addToZip(self, zip, entry, path=[]): newpath = path + [entry.__name__] if IReflectoDirectory.providedBy(entry): for key in entry.keys(): if not self.acceptableName(key): continue value = entry[key] if not self.acceptableEntry(value): continue self._addToZip(zip, entry[key], newpath) elif IReflectoFile.providedBy(entry): zip.write(entry.getFilesystemPath(), os.path.join(*newpath))
def index(self, proxy=None): if proxy is None: proxy=aq_inner(self.context) if not self.approve(proxy): return if IReflectoDirectory.providedBy(proxy): self.unindex(proxy) for (id, entry) in proxy.iteritems(): if IReflectoDirectory.providedBy(entry): self.index(entry) elif IReflectoFile.providedBy(entry): entry.indexObject() proxy.indexObject()
def index(self, proxy=None): if proxy is None: proxy = aq_inner(self.context) if not self.approve(proxy): return if IReflectoDirectory.providedBy(proxy): self.unindex(proxy) for (id, entry) in proxy.iteritems(): if IReflectoDirectory.providedBy(entry): self.index(entry) elif IReflectoFile.providedBy(entry): entry.indexObject() proxy.indexObject()
def testDeepFile(self): self.assertTrue(IReflectoFile.providedBy( self.reflecto['subdir']['emptyfile.txt']))
def testSimpleFile(self): self.assertTrue(IReflectoFile.providedBy(self.reflecto['reflecto.jpg']))
def testDeepFile(self): self.assertTrue( IReflectoFile.providedBy(self.reflecto['subdir']['emptyfile.txt']))
def testSimpleFile(self): self.assertTrue(IReflectoFile.providedBy( self.reflecto['reflecto.jpg']))