[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/publisher/browser/ allow directoryresources to recursively see subdirectories per discussion w/Jim

Brian Lloyd brian at zope.com
Wed Jun 22 09:51:19 EDT 2005


Log message for revision 30887:
  allow directoryresources to recursively see subdirectories per discussion w/Jim

Changed:
  U   Zope3/trunk/src/zope/app/publisher/browser/directoryresource.py
  A   Zope3/trunk/src/zope/app/publisher/browser/tests/testfiles/subdir/
  A   Zope3/trunk/src/zope/app/publisher/browser/tests/testfiles/subdir/test.gif

-=-
Modified: Zope3/trunk/src/zope/app/publisher/browser/directoryresource.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/directoryresource.py	2005-06-22 13:48:35 UTC (rev 30886)
+++ Zope3/trunk/src/zope/app/publisher/browser/directoryresource.py	2005-06-22 13:51:19 UTC (rev 30887)
@@ -80,12 +80,20 @@
     def get(self, name, default=_marker):
         path = self.context.path
         filename = os.path.join(path, name)
-        if not os.path.isfile(filename):
+        isfile = os.path.isfile(filename)
+        isdir = os.path.isdir(filename)
+          
+        if not (isfile or isdir):
             if default is _marker:
                 raise NotFound(None, name)
             return default
-        ext = os.path.splitext(os.path.normcase(name))[1]
-        factory = self.resource_factories.get(ext, self.default_factory)
+
+        if isfile:
+            ext = os.path.splitext(os.path.normcase(name))[1]
+            factory = self.resource_factories.get(ext, self.default_factory)
+        else:
+            factory = DirectoryResourceFactory
+
         rname = posixpath.join(self.__name__, name)
         resource = factory(filename, self.context.checker, rname)(self.request)
         resource.__parent__ = self

Added: Zope3/trunk/src/zope/app/publisher/browser/tests/testfiles/subdir/test.gif
===================================================================
(Binary files differ)


Property changes on: Zope3/trunk/src/zope/app/publisher/browser/tests/testfiles/subdir/test.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream



More information about the Zope3-Checkins mailing list