Example #1
0
 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")))
Example #2
0
 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")))
Example #3
0
    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))
Example #4
0
    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))
Example #5
0
    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()
Example #6
0
    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()
Example #7
0
 def testDeepFile(self):
     self.assertTrue(IReflectoFile.providedBy(
         self.reflecto['subdir']['emptyfile.txt']))
Example #8
0
 def testSimpleFile(self):
     self.assertTrue(IReflectoFile.providedBy(self.reflecto['reflecto.jpg']))
Example #9
0
 def testDeepFile(self):
     self.assertTrue(
         IReflectoFile.providedBy(self.reflecto['subdir']['emptyfile.txt']))
Example #10
0
 def testSimpleFile(self):
     self.assertTrue(IReflectoFile.providedBy(
         self.reflecto['reflecto.jpg']))