[Zope3-checkins] CVS: Zope3/src/zope/app/folder - fssync.py:1.5
tests.py:1.5
Jim Fulton
jim at zope.com
Sat Mar 6 10:38:44 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/folder
In directory cvs.zope.org:/tmp/cvs-serv31719/src/zope/app/folder
Modified Files:
fssync.py tests.py
Log Message:
Added a missing import that caused FTP directory access to fail.
Added a missing test. (Sheesh)
=== Zope3/src/zope/app/folder/fssync.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/folder/fssync.py:1.4 Fri Mar 5 17:09:05 2004
+++ Zope3/src/zope/app/folder/fssync.py Sat Mar 6 10:38:43 2004
@@ -17,6 +17,7 @@
"""
from zope.fssync.server.entryadapter import DirectoryAdapter
+from zope.app.interfaces.services.service import ISite
__metaclass__ = type
@@ -77,6 +78,36 @@
"""
def contents(self):
+ """Compute a folder listing.
+
+ A folder listing is a list of the items in the folder. It is
+ a combination of the folder contents and the site-manager, if
+ a folder is a site.
+
+ The adapter will take any mapping:
+
+ >>> adapter = FolderAdapter({'x': 1, 'y': 2})
+ >>> contents = adapter.contents()
+ >>> contents.sort()
+ >>> contents
+ [('x', 1), ('y', 2)]
+
+ If a folder is a site, then we'll get ++etc++site included:
+
+ >>> import zope.interface
+ >>> class Site(dict):
+ ... zope.interface.implements(ISite)
+ ...
+ ... def getSiteManager(self):
+ ... return 'site goes here :)'
+
+ >>> adapter = FolderAdapter(Site({'x': 1, 'y': 2}))
+ >>> contents = adapter.contents()
+ >>> contents.sort()
+ >>> contents
+ [('++etc++site', 'site goes here :)'), ('x', 1), ('y', 2)]
+
+ """
result = super(FolderAdapter, self).contents()
if ISite.providedBy(self.context):
sm = self.context.getSiteManager()
=== Zope3/src/zope/app/folder/tests.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/folder/tests.py:1.4 Mon Mar 1 10:02:51 2004
+++ Zope3/src/zope/app/folder/tests.py Sat Mar 6 10:38:43 2004
@@ -57,7 +57,7 @@
return TestSuite((
makeSuite(Test),
makeSuite(FolderMetaDataTest),
- DocTestSuite('zope.app.content'),
+ DocTestSuite('zope.app.folder.fssync'),
))
if __name__=='__main__':
More information about the Zope3-Checkins
mailing list