[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/ZPTPage - ZPTPage.py:1.18 configure.zcml:1.14

Stephan Richter srichter@cbu.edu
Fri, 20 Dec 2002 04:26:13 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/ZPTPage
In directory cvs.zope.org:/tmp/cvs-serv31450/Zope/App/OFS/Content/ZPTPage

Modified Files:
	ZPTPage.py configure.zcml 
Log Message:
Refactoring and fixing VFS and FTP

I am glad to make this commit that fixes up a lot of the FTP
implementation. I fixed the behavior of many of the FTP commands,
including LIST, SIZE, and CWD.

I moved the original VFSFile/DirectoryView into abstract classes and wrote
a special implementation for each content type, which makes the code much
more flexible.

Also I finally implemented a smart way of adding files via VFS through
file extension introspection, based on Jim's ExtensionViewName proposal.

I am adding documentation in the DevelCookbook right now and will later
add a README file.

TODOs:

- make VFS View names flexible, so that file extensions specify views.

- Simplify ZCML directives, so that one can add new extensions for Add views
  quicker. A solution might look like that:

      <vfs:view
          name=".dtml"
          for="Zope.App.OFS.Container.IAdding."
          factory=".DTMLPageAdd."
          permission="Zope.ManageContent">
        <vfs:extension name=".html" />
        <vfs:extension name=".xul" /> 
        <vfs:extension name=".xml" /> 
        ...
      </vfs:view>
			   
  This method would also be good for defining a default fiel extension.

- Show an object with its default file extension.
								     


=== Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/ZPTPage.py 1.17 => 1.18 ===
--- Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/ZPTPage.py:1.17	Sat Dec  7 11:52:19 2002
+++ Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/ZPTPage.py	Fri Dec 20 04:25:41 2002
@@ -26,7 +26,6 @@
 from Zope.Proxy.ContextWrapper import getWrapperContainer
 from Zope.Security.Proxy import ProxyFactory
 
-from Zope.App.OFS.Content.IFileContent import IFileContent
 from Zope.PageTemplate.PageTemplate import PageTemplate
 from Zope.App.PageTemplate.Engine import AppPT
 
@@ -69,8 +68,7 @@
 
 class ZPTPage(AppPT, PageTemplate, Persistent):
 
-    # XXX Putting IFileContent at the end gives an error!
-    __implements__ = IFileContent, IZPTPage, IRenderZPTPage
+    __implements__ = IZPTPage, IRenderZPTPage
 
     def getSource(self):
         '''See interface Zope.App.OFS.ZPTPage.ZPTPage.IZPTPage'''
@@ -108,14 +106,14 @@
     source = property(getSource, setSource, None,
                       """Source of the Page Template.""")
 
-# Adapter for ISearchableText
 
+# Adapter for ISearchableText
 from Zope.App.index.text.interfaces import ISearchableText
 
 class SearchableText:
 
-    __implements__ = ISearchableText
     __used_for__ = IZPTPage
+    __implements__ = ISearchableText
 
     def __init__(self, page):
         self.page = page


=== Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/configure.zcml 1.13 => 1.14 ===
--- Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/configure.zcml:1.13	Thu Dec  5 07:36:48 2002
+++ Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/configure.zcml	Fri Dec 20 04:25:41 2002
@@ -9,6 +9,16 @@
       title="ZPT Page"
       description="A simple, content-based Page Template" />
 
+  <factory
+      id=".pt"
+      permission="Zope.ManageContent"
+      title="ZPT Page" />
+
+  <factory
+      id=".zpt"
+      permission="Zope.ManageContent"
+      title="ZPT Page" />
+
   <require
       permission="Zope.View"
       attributes="__call__" />