[Zope3-checkins] SVN: Zope3/trunk/ - Fixed bug #728: Able to change-dir into non-existant directories using FTP

Christian Theune ct at gocept.com
Mon Dec 18 04:11:50 EST 2006


Log message for revision 71581:
  - Fixed bug #728:  Able to change-dir into non-existant directories using FTP
  

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/app/folder/filerepresentation.py
  U   Zope3/trunk/src/zope/app/folder/tests.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2006-12-17 20:49:57 UTC (rev 71580)
+++ Zope3/trunk/doc/CHANGES.txt	2006-12-18 09:11:48 UTC (rev 71581)
@@ -149,6 +149,9 @@
 
     Bug fixes
 
+      - Fixed bug #728:  Able to change-dir into non-existant directories
+        using FTP
+
       - Fixed widget bug in zope.app.form.browser; _getCurrentValue always
         returns an input value now. This fixes a bug in _getFormValue.
 

Modified: Zope3/trunk/src/zope/app/folder/filerepresentation.py
===================================================================
--- Zope3/trunk/src/zope/app/folder/filerepresentation.py	2006-12-17 20:49:57 UTC (rev 71580)
+++ Zope3/trunk/src/zope/app/folder/filerepresentation.py	2006-12-18 09:11:48 UTC (rev 71581)
@@ -19,7 +19,9 @@
 
 from zope.app.component.interfaces import ISite
 
+MARKER = object()
 
+
 class RootDirectoryFactory(object):
 
     def __init__(self, context):
@@ -30,8 +32,7 @@
 
 
 class ReadDirectory(object):
-    """Adapter to provide a file-system rendition of folders
-    """
+    """Adapter to provide a file-system rendition of folders."""
 
     def __init__(self, context):
         self.context = context
@@ -45,15 +46,14 @@
     def get(self, key, default=None):
         if key == '++etc++site' and ISite.providedBy(self.context):
             return self.context.getSiteManager()
-
         return self.context.get(key, default)
 
     def __iter__(self):
         return iter(self.keys())
 
     def __getitem__(self, key):
-        v = self.get(key, self)
-        if v is self:
+        v = self.get(key, MARKER)
+        if v is MARKER:
             raise KeyError(key)
         return v
 

Modified: Zope3/trunk/src/zope/app/folder/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/folder/tests.py	2006-12-17 20:49:57 UTC (rev 71580)
+++ Zope3/trunk/src/zope/app/folder/tests.py	2006-12-18 09:11:48 UTC (rev 71581)
@@ -20,9 +20,11 @@
 
 import zope.component
 from zope.testing.doctestunit import DocTestSuite
+from zope.testing import doctest
 from zope.dublincore.interfaces import IZopeDublinCore
 from zope.dublincore.annotatableadapter import ZDCAnnotatableAdapter
 
+from zope.app.testing.functional import FunctionalDocFileSuite
 from zope.app.folder.interfaces import IFolder
 from zope.app.component.testing import PlacefulSetup
 from zope.app.component.tests.test_site import BaseTestSiteManagerContainer
@@ -60,9 +62,11 @@
     return TestSuite((
         makeSuite(Test),
         makeSuite(FolderMetaDataTest),
+        FunctionalDocFileSuite("filerepresentation.txt",
+                               optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE),
         DocTestSuite('zope.app.folder.folder',
                      setUp=setUp, tearDown=tearDown),
-        ))    
+        ))
 
 if __name__=='__main__':
     main(defaultTest='test_suite')



More information about the Zope3-Checkins mailing list