[CMF-checkins] SVN: CMF/trunk/CMF Added handlers for "DAV-aware"
file-like content, and registered them for CMFDefault content types.
Tres Seaver
tseaver at palladion.com
Wed Sep 28 07:19:50 EDT 2005
Log message for revision 38663:
Added handlers for "DAV-aware" file-like content, and registered them for CMFDefault content types.
Also, added a sample extension profile which shows how the mappings work.
Changed:
U CMF/trunk/CMFCore/configure.zcml
U CMF/trunk/CMFCore/exportimport.py
A CMF/trunk/CMFCore/exportimport.zcml
U CMF/trunk/CMFDefault/__init__.py
U CMF/trunk/CMFDefault/configure.zcml
A CMF/trunk/CMFDefault/exportimport.zcml
A CMF/trunk/CMFDefault/profiles/sample_content/
A CMF/trunk/CMFDefault/profiles/sample_content/export_steps.xml
A CMF/trunk/CMFDefault/profiles/sample_content/import_steps.xml
A CMF/trunk/CMFDefault/profiles/sample_content/structure/
A CMF/trunk/CMFDefault/profiles/sample_content/structure/.objects
A CMF/trunk/CMFDefault/profiles/sample_content/structure/.preserve
A CMF/trunk/CMFDefault/profiles/sample_content/structure/.properties
A CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/
A CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/.objects
A CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/.properties
A CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/a_link
A CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/binary_file.tgz
A CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/binary_image.png
A CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/html_document
A CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/some_news
A CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/stx_document
-=-
Modified: CMF/trunk/CMFCore/configure.zcml
===================================================================
--- CMF/trunk/CMFCore/configure.zcml 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFCore/configure.zcml 2005-09-28 11:19:50 UTC (rev 38663)
@@ -1,5 +1,12 @@
-<configure xmlns="http://namespaces.zope.org/zope">
+<configure
+ xmlns="http://namespaces.zope.org/zope">
- <include package=".browser"/>
+ <include
+ package=".browser"
+ />
+ <include
+ file="exportimport.zcml"
+ />
+
</configure>
Modified: CMF/trunk/CMFCore/exportimport.py
===================================================================
--- CMF/trunk/CMFCore/exportimport.py 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFCore/exportimport.py 2005-09-28 11:19:50 UTC (rev 38663)
@@ -268,6 +268,9 @@
self._headers = {}
self._data.update(kw)
+ def __getitem__(self, key):
+ return self._data[key]
+
def get(self, key, default=None):
return self._data.get(key, default)
@@ -275,7 +278,10 @@
return self._headers.get(key, default)
class FauxDAVResponse:
- pass
+ def setHeader(self, key, value, lock=False):
+ pass # stub this out to mollify webdav.Resource
+ def setStatus(self, value, reason=None):
+ pass # stub this out to mollify webdav.Resource
class DAVAwareFileAdapter(object):
""" Exporter/importer for content who handle their own FTP / DAV PUTs.
@@ -308,6 +314,6 @@
import_context.note('SGAIFA',
'no .ini file for %s/%s' % (subdir, cid))
else:
- request = FauxDAVRequest(body=data)
+ request = FauxDAVRequest(BODY=data, BODYFILE=data)
response = FauxDAVResponse()
self.context.PUT(request, response)
Added: CMF/trunk/CMFCore/exportimport.zcml
===================================================================
--- CMF/trunk/CMFCore/exportimport.zcml 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFCore/exportimport.zcml 2005-09-28 11:19:50 UTC (rev 38663)
@@ -0,0 +1,55 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:five="http://namespaces.zope.org/five"
+ i18n_domain="cmf"
+ >
+
+ <adapter
+ for=".interfaces.IFolderish"
+ factory=".exportimport.StructureFolderWalkingAdapter"
+ provides=".interfaces.IFilesystemExporter"
+ />
+
+ <adapter
+ for=".interfaces.IFolderish"
+ factory=".exportimport.StructureFolderWalkingAdapter"
+ provides=".interfaces.IFilesystemImporter"
+ />
+
+ <adapter
+ for=".interfaces.ICSVAware"
+ factory=".exportimport.CSVAwareFileAdapter"
+ provides=".interfaces.IFilesystemExporter"
+ />
+
+ <adapter
+ for=".interfaces.ICSVAware"
+ factory=".exportimport.CSVAwareFileAdapter"
+ provides=".interfaces.IFilesystemImporter"
+ />
+
+ <adapter
+ for=".interfaces.IINIAware"
+ factory=".exportimport.INIAwareFileAdapter"
+ provides=".interfaces.IFilesystemExporter"
+ />
+
+ <adapter
+ for=".interfaces.IINIAware"
+ factory=".exportimport.INIAwareFileAdapter"
+ provides=".interfaces.IFilesystemImporter"
+ />
+
+ <adapter
+ for=".interfaces.IDAVAware"
+ factory=".exportimport.DAVAwareFileAdapter"
+ provides=".interfaces.IFilesystemExporter"
+ />
+
+ <adapter
+ for=".interfaces.IDAVAware"
+ factory=".exportimport.DAVAwareFileAdapter"
+ provides=".interfaces.IFilesystemImporter"
+ />
+
+</configure>
Modified: CMF/trunk/CMFDefault/__init__.py
===================================================================
--- CMF/trunk/CMFDefault/__init__.py 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/__init__.py 2005-09-28 11:19:50 UTC (rev 38663)
@@ -22,6 +22,7 @@
from Products.CMFCore.utils import ContentInit
from Products.CMFCore.utils import registerIcon
from Products.CMFSetup import BASE
+from Products.CMFSetup import EXTENSION
from Products.CMFSetup import profile_registry
import factory
@@ -116,6 +117,13 @@
'CMFDefault',
BASE)
+ profile_registry.registerProfile('sample_content',
+ 'Sample CMFDefault Content',
+ 'Content for a sample CMFSite.',
+ 'profiles/sample_content',
+ 'CMFDefault',
+ EXTENSION)
+
context.registerClass( Portal.CMFSite
, constructors=(factory.addConfiguredSiteForm,
factory.addConfiguredSite,
Modified: CMF/trunk/CMFDefault/configure.zcml
===================================================================
--- CMF/trunk/CMFDefault/configure.zcml 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/configure.zcml 2005-09-28 11:19:50 UTC (rev 38663)
@@ -2,6 +2,12 @@
xmlns="http://namespaces.zope.org/zope"
>
- <include package=".skin"/>
+ <include
+ package=".skin"
+ />
+ <include
+ file="exportimport.zcml"
+ />
+
</configure>
Added: CMF/trunk/CMFDefault/exportimport.zcml
===================================================================
--- CMF/trunk/CMFDefault/exportimport.zcml 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/exportimport.zcml 2005-09-28 11:19:50 UTC (rev 38663)
@@ -0,0 +1,38 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:five="http://namespaces.zope.org/five"
+ i18n_domain="cmf"
+ >
+
+ <five:implements
+ class=".Portal.CMFSite"
+ interface="Products.CMFCore.interfaces.ISiteRoot"
+ />
+
+ <five:implements
+ class=".Document.Document"
+ interface="Products.CMFCore.interfaces.IDAVAware"
+ />
+
+ <five:implements
+ class=".File.File"
+ interface="Products.CMFCore.interfaces.IDAVAware"
+ />
+
+ <five:implements
+ class=".Image.Image"
+ interface="Products.CMFCore.interfaces.IDAVAware"
+ />
+
+ <five:implements
+ class=".Link.Link"
+ interface="Products.CMFCore.interfaces.IDAVAware"
+ />
+
+ <five:implements
+ class=".NewsItem.NewsItem"
+ interface="Products.CMFCore.interfaces.IDAVAware"
+ />
+
+</configure>
+
Added: CMF/trunk/CMFDefault/profiles/sample_content/export_steps.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/sample_content/export_steps.xml 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/profiles/sample_content/export_steps.xml 2005-09-28 11:19:50 UTC (rev 38663)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<export-steps>
+
+ <export-step id="content"
+ handler="Products.CMFCore.exportimport.exportSiteStructure"
+ title="Content">
+
+
+
+ Export the site's structure and content.
+
+
+
+ </export-step>
+
+</export-steps>
Added: CMF/trunk/CMFDefault/profiles/sample_content/import_steps.xml
===================================================================
--- CMF/trunk/CMFDefault/profiles/sample_content/import_steps.xml 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/profiles/sample_content/import_steps.xml 2005-09-28 11:19:50 UTC (rev 38663)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<import-steps>
+
+ <import-step id="content" version="20050927-01"
+ handler="Products.CMFCore.exportimport.importSiteStructure"
+ title="Content">
+ <dependency step="toolset"/>
+ <!-- NYRFPT
+ <dependency step="catalog"/>
+ -->
+ <dependency step="typeinfo"/>
+ <dependency step="workflow"/>
+
+
+
+ Import the site's structure and content.
+
+
+
+ </import-step>
+
+</import-steps>
Added: CMF/trunk/CMFDefault/profiles/sample_content/structure/.objects
===================================================================
--- CMF/trunk/CMFDefault/profiles/sample_content/structure/.objects 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/profiles/sample_content/structure/.objects 2005-09-28 11:19:50 UTC (rev 38663)
@@ -0,0 +1 @@
+subfolder,Folder
Added: CMF/trunk/CMFDefault/profiles/sample_content/structure/.preserve
===================================================================
--- CMF/trunk/CMFDefault/profiles/sample_content/structure/.preserve 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/profiles/sample_content/structure/.preserve 2005-09-28 11:19:50 UTC (rev 38663)
@@ -0,0 +1 @@
+Members
Added: CMF/trunk/CMFDefault/profiles/sample_content/structure/.properties
===================================================================
--- CMF/trunk/CMFDefault/profiles/sample_content/structure/.properties 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/profiles/sample_content/structure/.properties 2005-09-28 11:19:50 UTC (rev 38663)
@@ -0,0 +1,4 @@
+[DEFAULT]
+description =
+title = Portal
+
Added: CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/.objects
===================================================================
--- CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/.objects 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/.objects 2005-09-28 11:19:50 UTC (rev 38663)
@@ -0,0 +1,6 @@
+html_document,Document
+stx_document,Document
+binary_file.tgz,File
+binary_image.png,Image
+a_link,Link
+some_news,News Item
Added: CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/.properties
===================================================================
--- CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/.properties 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/.properties 2005-09-28 11:19:50 UTC (rev 38663)
@@ -0,0 +1,4 @@
+[DEFAULT]
+description = This is a subfolder.
+title = Sub-Folder
+
Added: CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/a_link
===================================================================
--- CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/a_link 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/a_link 2005-09-28 11:19:50 UTC (rev 38663)
@@ -0,0 +1,13 @@
+Title: A Link
+Subject:
+Publisher:
+Description:
+Contributors:
+Effective_date: None
+Expiration_date: 2499-12-31 00:00:00
+Type: Link
+Format: text/url
+Language:
+Rights:
+
+http://palladion.com/
\ No newline at end of file
Added: CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/binary_file.tgz
===================================================================
(Binary files differ)
Property changes on: CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/binary_file.tgz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/binary_image.png
===================================================================
(Binary files differ)
Property changes on: CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/binary_image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/html_document
===================================================================
--- CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/html_document 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/html_document 2005-09-28 11:19:50 UTC (rev 38663)
@@ -0,0 +1,17 @@
+<html>
+ <head>
+ <title>HTML Document</title>
+ <meta name="Subject" content="" />
+ <meta name="Publisher" content="" />
+ <meta name="Description" content="" />
+ <meta name="Contributors" content="" />
+ <meta name="Effective_date" content="None" />
+ <meta name="Expiration_date" content="2499-12-31 00:00:00" />
+ <meta name="Type" content="Document" />
+ <meta name="Format" content="text/html" />
+ <meta name="Language" content="" />
+ <meta name="Rights" content="" />
+ <meta name="SafetyBelt" content="1127874889.26" />
+ </head>
+ <body><h1> A Sample HTML Document </h1></body>
+</html>
Added: CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/some_news
===================================================================
--- CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/some_news 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/some_news 2005-09-28 11:19:50 UTC (rev 38663)
@@ -0,0 +1,15 @@
+Title: Some News
+Subject:
+Publisher:
+Description: This is the lead paragraph, which is usually the same as
+ the Dublin Core "Description".
+Contributors:
+Effective_date: None
+Expiration_date: 2499-12-31 00:00:00
+Type: News Item
+Format: text/plain
+Language:
+Rights:
+SafetyBelt: 1127875101.99
+
+The body of the news item goes here.
\ No newline at end of file
Added: CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/stx_document
===================================================================
--- CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/stx_document 2005-09-28 11:16:22 UTC (rev 38662)
+++ CMF/trunk/CMFDefault/profiles/sample_content/structure/subfolder/stx_document 2005-09-28 11:19:50 UTC (rev 38663)
@@ -0,0 +1,17 @@
+Title: Structured Text Document
+Subject:
+Publisher:
+Description:
+Contributors:
+Effective_date: None
+Expiration_date: 2499-12-31 00:00:00
+Type: Document
+Format: text/plain
+Language:
+Rights:
+SafetyBelt: 1127874919.05
+
+Structured Text for Fun and Profit
+
+ This is a "structured text" document. It uses simple conventions, like those
+ found in plain-text e-mail, to indicate structure and formatting of text.
\ No newline at end of file
More information about the CMF-checkins
mailing list