[Checkins] SVN: GenericSetup/trunk/ * adding support for
PageTemplate import / export; modeled closely after
Rob Miller
ra at burningman.com
Sat May 13 03:58:14 EDT 2006
Log message for revision 68119:
* adding support for PageTemplate import / export; modeled closely after
existing PythonScript support
-This line, and those below, will be ignored--
M configure.zcml
A PageTemplates
A PageTemplates/tests
AM PageTemplates/tests/test_exportimport.py
AM PageTemplates/tests/__init__.py
AM PageTemplates/exportimport.py
AM PageTemplates/configure.zcml
AM PageTemplates/__init__.py
AM PageTemplates/interfaces.py
M CHANGES.txt
Changed:
U GenericSetup/trunk/CHANGES.txt
A GenericSetup/trunk/PageTemplates/
A GenericSetup/trunk/PageTemplates/__init__.py
A GenericSetup/trunk/PageTemplates/configure.zcml
A GenericSetup/trunk/PageTemplates/exportimport.py
A GenericSetup/trunk/PageTemplates/interfaces.py
A GenericSetup/trunk/PageTemplates/tests/
A GenericSetup/trunk/PageTemplates/tests/__init__.py
A GenericSetup/trunk/PageTemplates/tests/test_exportimport.py
U GenericSetup/trunk/configure.zcml
-=-
Modified: GenericSetup/trunk/CHANGES.txt
===================================================================
--- GenericSetup/trunk/CHANGES.txt 2006-05-13 07:28:22 UTC (rev 68118)
+++ GenericSetup/trunk/CHANGES.txt 2006-05-13 07:58:14 UTC (rev 68119)
@@ -1,6 +1,12 @@
GenericSetup Product Changelog
+ GenericSetup 1.2 (unreleased)
+
+ - Added support for PageTemplate import/export, modeled closely after
+ existing PythonScript support
+
GenericSetup 1.1 (2006/04/16)
+
- The dependency sorting was highly reliant on steps being added in the
right order to work. If import step A depends on import step B which
depends on step C, and step C gets processed early, and they were
Added: GenericSetup/trunk/PageTemplates/__init__.py
===================================================================
--- GenericSetup/trunk/PageTemplates/__init__.py 2006-05-13 07:28:22 UTC (rev 68118)
+++ GenericSetup/trunk/PageTemplates/__init__.py 2006-05-13 07:58:14 UTC (rev 68119)
@@ -0,0 +1,16 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""PythonScript support.
+
+$Id$
+"""
Property changes on: GenericSetup/trunk/PageTemplates/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: GenericSetup/trunk/PageTemplates/configure.zcml
===================================================================
--- GenericSetup/trunk/PageTemplates/configure.zcml 2006-05-13 07:28:22 UTC (rev 68118)
+++ GenericSetup/trunk/PageTemplates/configure.zcml 2006-05-13 07:58:14 UTC (rev 68119)
@@ -0,0 +1,18 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:five="http://namespaces.zope.org/five"
+ >
+
+ <adapter
+ factory=".exportimport.PageTemplateBodyAdapter"
+ provides="Products.GenericSetup.interfaces.IBody"
+ for=".interfaces.IPageTemplate
+ Products.GenericSetup.interfaces.ISetupEnviron"
+ />
+
+ <five:implements
+ class="Products.PageTemplates.PageTemplate.PageTemplate"
+ interface=".interfaces.IPageTemplate"
+ />
+
+</configure>
Property changes on: GenericSetup/trunk/PageTemplates/configure.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: GenericSetup/trunk/PageTemplates/exportimport.py
===================================================================
--- GenericSetup/trunk/PageTemplates/exportimport.py 2006-05-13 07:28:22 UTC (rev 68118)
+++ GenericSetup/trunk/PageTemplates/exportimport.py 2006-05-13 07:58:14 UTC (rev 68119)
@@ -0,0 +1,46 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""PythonScript export / import support.
+
+$Id$
+"""
+
+from Products.GenericSetup.utils import BodyAdapterBase
+
+from interfaces import IPageTemplate
+
+
+class PageTemplateBodyAdapter(BodyAdapterBase):
+
+ """Body im- and exporter for PythonScript.
+ """
+
+ __used_for__ = IPageTemplate
+
+ def _exportBody(self):
+ """Export the object as a file body.
+ """
+ if self.context.meta_type == 'Page Template':
+ return self.context.read()
+ return None
+
+ def _importBody(self, body):
+ """Import the object from the file body.
+ """
+ self.context.write(body)
+
+ body = property(_exportBody, _importBody)
+
+ mime_type = 'text/html'
+
+ suffix = '.pt'
Property changes on: GenericSetup/trunk/PageTemplates/exportimport.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: GenericSetup/trunk/PageTemplates/interfaces.py
===================================================================
--- GenericSetup/trunk/PageTemplates/interfaces.py 2006-05-13 07:28:22 UTC (rev 68118)
+++ GenericSetup/trunk/PageTemplates/interfaces.py 2006-05-13 07:58:14 UTC (rev 68119)
@@ -0,0 +1,35 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""PageTemplate interfaces.
+
+$Id$
+"""
+
+from zope.interface import Interface
+
+
+class IPageTemplate(Interface):
+
+ """Page Templates using TAL, TALES, and METAL.
+ """
+
+ def read():
+ """Generate a text representation of the Template source.
+
+ Includes specially formatted comment lines for parameters, bindings
+ and the title.
+ """
+
+ def write(text):
+ """Change the Template by parsing a read()-style source text.
+ """
Property changes on: GenericSetup/trunk/PageTemplates/interfaces.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: GenericSetup/trunk/PageTemplates/tests/__init__.py
===================================================================
--- GenericSetup/trunk/PageTemplates/tests/__init__.py 2006-05-13 07:28:22 UTC (rev 68118)
+++ GenericSetup/trunk/PageTemplates/tests/__init__.py 2006-05-13 07:58:14 UTC (rev 68119)
@@ -0,0 +1,16 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""PythonScript support tests.
+
+$Id$
+"""
Property changes on: GenericSetup/trunk/PageTemplates/tests/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: GenericSetup/trunk/PageTemplates/tests/test_exportimport.py
===================================================================
--- GenericSetup/trunk/PageTemplates/tests/test_exportimport.py 2006-05-13 07:28:22 UTC (rev 68118)
+++ GenericSetup/trunk/PageTemplates/tests/test_exportimport.py 2006-05-13 07:58:14 UTC (rev 68119)
@@ -0,0 +1,63 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""PageTemplate export / import support unit tests.
+
+$Id$
+"""
+
+import unittest
+import Testing
+
+from Products.Five import zcml
+
+from Products.GenericSetup.testing import BodyAdapterTestCase
+
+
+_PAGETEMPLATE_BODY = """\
+<html>
+ <div>Foo</div>
+</html>
+"""
+
+
+class PageTemplateBodyAdapterTests(BodyAdapterTestCase):
+
+ def _getTargetClass(self):
+ from Products.GenericSetup.PageTemplates.exportimport \
+ import PageTemplateBodyAdapter
+
+ return PageTemplateBodyAdapter
+
+ def _populate(self, obj):
+ obj.write(_PAGETEMPLATE_BODY)
+
+ def setUp(self):
+ import Products.GenericSetup.PageTemplates
+ from Products.PageTemplates.PageTemplate import PageTemplate
+
+ BodyAdapterTestCase.setUp(self)
+ zcml.load_config('configure.zcml',
+ Products.GenericSetup.PageTemplates)
+
+ self._obj = PageTemplate('foo_template')
+ self._obj.meta_type = 'Page Template'
+ self._BODY = _PAGETEMPLATE_BODY
+
+
+def test_suite():
+ return unittest.TestSuite((
+ unittest.makeSuite(PageTemplateBodyAdapterTests),
+ ))
+
+if __name__ == '__main__':
+ unittest.main(defaultTest='test_suite')
Property changes on: GenericSetup/trunk/PageTemplates/tests/test_exportimport.py
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: GenericSetup/trunk/configure.zcml
===================================================================
--- GenericSetup/trunk/configure.zcml 2006-05-13 07:28:22 UTC (rev 68118)
+++ GenericSetup/trunk/configure.zcml 2006-05-13 07:58:14 UTC (rev 68119)
@@ -10,6 +10,8 @@
<include package=".PythonScripts"/>
+ <include package=".PageTemplates"/>
+
<include package=".ZCatalog"/>
<include package=".ZCTextIndex"/>
More information about the Checkins
mailing list