[Checkins] SVN: z3c.template/trunk/ This is now eggified. Tests pass.

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue May 22 08:25:27 EDT 2007


Log message for revision 75865:
  This is now eggified. Tests pass.
  
  

Changed:
  A   z3c.template/trunk/bootstrap.py
  A   z3c.template/trunk/buildout.cfg
  A   z3c.template/trunk/setup.cfg
  A   z3c.template/trunk/setup.py
  U   z3c.template/trunk/src/z3c/template/README.txt

-=-
Added: z3c.template/trunk/bootstrap.py
===================================================================
--- z3c.template/trunk/bootstrap.py	                        (rev 0)
+++ z3c.template/trunk/bootstrap.py	2007-05-22 12:25:25 UTC (rev 75865)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id$
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+ez = {}
+exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                     ).read() in ez
+ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+    cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+    os.P_WAIT, sys.executable, sys.executable,
+    '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+    dict(os.environ,
+         PYTHONPATH=
+         ws.find(pkg_resources.Requirement.parse('setuptools')).location
+         ),
+    ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)


Property changes on: z3c.template/trunk/bootstrap.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: z3c.template/trunk/buildout.cfg
===================================================================
--- z3c.template/trunk/buildout.cfg	                        (rev 0)
+++ z3c.template/trunk/buildout.cfg	2007-05-22 12:25:25 UTC (rev 75865)
@@ -0,0 +1,7 @@
+[buildout]
+develop = .
+parts = test
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = z3c.template [test]

Added: z3c.template/trunk/setup.cfg
===================================================================
--- z3c.template/trunk/setup.cfg	                        (rev 0)
+++ z3c.template/trunk/setup.cfg	2007-05-22 12:25:25 UTC (rev 75865)
@@ -0,0 +1,2 @@
+[egg_info]
+tag_svn_revision = 1

Added: z3c.template/trunk/setup.py
===================================================================
--- z3c.template/trunk/setup.py	                        (rev 0)
+++ z3c.template/trunk/setup.py	2007-05-22 12:25:25 UTC (rev 75865)
@@ -0,0 +1,49 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Foundation 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.
+#
+##############################################################################
+"""Setup
+
+$Id$
+"""
+from setuptools import setup, find_packages
+
+setup (
+    name='z3c.template',
+    version='1.0',
+    author = "Roger Ineichen and the Zope Community",
+    author_email = "zope3-dev at zope.org",
+    description = "A package implementing advanced Page Template patterns.",
+    license = "ZPL 2.1",
+    keywords = "zope3 template layout zpt pagetemplate",
+    url = 'svn://svn.zope.org/repos/main/z3c.template',
+    packages = find_packages('src'),
+    include_package_data = True,
+    package_dir = {'':'src'},
+    namespace_packages = ['z3c'],
+    extras_require = dict(
+        test = ['zope.app.testing', 'zope.testing'],
+        ),
+    install_requires = [
+        'setuptools',
+        'zope.app.pagetemplate',
+        'zope.component',
+        'zope.configuration',
+        'zope.interface',
+        'zope.pagetemplate',
+        'zope.publisher',
+        'zope.schema',
+        'zope.tal',
+        ],
+    dependency_links = ['http://download.zope.org/distribution'],
+    zip_safe = False,
+    )


Property changes on: z3c.template/trunk/setup.py
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: z3c.template/trunk/src/z3c/template/README.txt
===================================================================
--- z3c.template/trunk/src/z3c/template/README.txt	2007-05-21 17:42:46 UTC (rev 75864)
+++ z3c.template/trunk/src/z3c/template/README.txt	2007-05-22 12:25:25 UTC (rev 75865)
@@ -1,28 +1,28 @@
-======
-README
-======
+=============
+Z3C Templates
+=============
 
 This package allows us to separate the registration of the view code and the
 layout.
 
-A template is used for separate the HTML part from a view. This is done in 
-z3 via a page templates. Such page template are implemented in the view, 
+A template is used for separate the HTML part from a view. This is done in
+z3 via a page templates. Such page template are implemented in the view,
 registered included in a page directive etc. But they do not use the adapter
 pattern which makes it hard to replace existing templates.
 
 Another part of template is, that they normaly separate one part presenting
-content from a view and another part offer a layout used by the content 
+content from a view and another part offer a layout used by the content
 template.
 
 How can this package make it simpler to use templates?
 
-Templates can be registered as adapters adapting context, request where the 
+Templates can be registered as adapters adapting context, request where the
 context is a view implementation. Such a template get adapted from the view
 if the template is needed. This adaption makes it very pluggable and modular.
 
 We offer two base template directive for register content producing templates
 and layout producing tempaltes. This is most the time enough but you also
-can register different type of templates using a specific interface. This 
+can register different type of templates using a specific interface. This
 could be usefull if your view implementation needs to separate HTMl in
 more then one template. Now let's take a look how we an use this templates.
 
@@ -87,7 +87,7 @@
   >>> template
   <zope.app.pagetemplate.viewpagetemplatefile.ViewPageTemplateFile object at ...>
 
-Now that we have a registered layout template for the default layer we can 
+Now that we have a registered layout template for the default layer we can
 call our view again.
 
   >>> print view.render()
@@ -124,7 +124,7 @@
   ...         return self.template()
   >>> contentView = MyViewWithTemplate(root, request)
 
-If we render this view we get the implemented layout template and not the 
+If we render this view we get the implemented layout template and not the
 registered one.
 
   >>> print contentView.render()
@@ -156,18 +156,18 @@
   >>> open(layoutTemplate, 'w').write('''<div>demo layout</div>''')
   >>> factory = TemplateFactory(layoutTemplate, 'text/html')
 
-We register the template factory on a view interface and a layer providing the 
+We register the template factory on a view interface and a layer providing the
 ILayoutTemplate interface.
 
   >>> component.provideAdapter(factory,
-  ...     (zope.interface.Interface, IDefaultBrowserLayer), 
+  ...     (zope.interface.Interface, IDefaultBrowserLayer),
   ...      interfaces.ILayoutTemplate)
   >>> layout = component.getMultiAdapter(
   ...     (view2, request), interfaces.ILayoutTemplate)
   >>> layout
   <zope.app.pagetemplate.viewpagetemplatefile.ViewPageTemplateFile ...>
 
-Now that we have a registered layout template for the default layer we can 
+Now that we have a registered layout template for the default layer we can
 call our view again.
 
   >>> print view2()
@@ -196,13 +196,13 @@
   ...     layout = ViewPageTemplateFile(viewLayout)
   ...     def __call__(self):
   ...         if self.layout is None:
-  ...             layout = zope.component.getMultiAdapter((self, self.request), 
+  ...             layout = zope.component.getMultiAdapter((self, self.request),
   ...                 interfaces.ILayoutTemplate)
   ...             return layout(self)
   ...         return self.layout()
   >>> layoutView = LayoutViewWithLayoutTemplate(root, request)
 
-If we render this view we get the implemented layout template and not the 
+If we render this view we get the implemented layout template and not the
 registered one.
 
   >>> print layoutView()
@@ -210,14 +210,14 @@
 
 
 Since we return the layout template in the sample views above, how can we get
-the content from the used view? This is not directly a part of this package 
+the content from the used view? This is not directly a part of this package
 but let's show some pattern were can be used for render content in a used
 layout template. Note, since we offer to register each layout template for
 a specific view, you can always very selectiv this layout pattern. This means
-you can use the defualt z3 macro based layout registration in combination with 
+you can use the defualt z3 macro based layout registration in combination with
 this layout concept if you register a own layout template.
 
-The simplest concept is calling the content from the view in the layout 
+The simplest concept is calling the content from the view in the layout
 template is to call it from a method. Let's define a view providing a layout
 template and offer a method for call content.
 
@@ -231,7 +231,7 @@
   ...         return u'rendered content'
   ...     def __call__(self):
   ...         if self.layout is None:
-  ...             layout = zope.component.getMultiAdapter((self, self.request), 
+  ...             layout = zope.component.getMultiAdapter((self, self.request),
   ...                 interfaces.ILayoutTemplate)
   ...             return layout(self)
   ...         return self.layout()
@@ -250,7 +250,7 @@
   >>> component.provideAdapter(factory,
   ...     (IFullView, IDefaultBrowserLayer), interfaces.ILayoutTemplate)
 
-Now let's see if the layout template can call the content via calling render 
+Now let's see if the layout template can call the content via calling render
 on the view:
 
   >>> print completeView.__call__()
@@ -281,7 +281,7 @@
   ...     def __call__(self):
   ...         self.update()
   ...         if self.layout is None:
-  ...             layout = zope.component.getMultiAdapter((self, self.request), 
+  ...             layout = zope.component.getMultiAdapter((self, self.request),
   ...                 interfaces.ILayoutTemplate)
   ...             return layout(self)
   ...         return self.layout()
@@ -359,9 +359,9 @@
 Use case ``simple template``
 ----------------------------
 
-And for the simplest possible use we provide a hook for call registered 
+And for the simplest possible use we provide a hook for call registered
 templates. Such page templates can get called with the getPageTemplate method
-and return a registered bound ViewTemplate a la ViewPageTemplateFile or 
+and return a registered bound ViewTemplate a la ViewPageTemplateFile or
 NamedTemplate.
 
 The getViewTemplate allows us to use the new template registration
@@ -443,7 +443,7 @@
 
   >>> factory = TemplateFactory(contentTemplate, 'text/html')
   >>> component.provideAdapter(factory,
-  ...     (zope.interface.Interface, IDefaultBrowserLayer), IMyNamedTemplate, 
+  ...     (zope.interface.Interface, IDefaultBrowserLayer), IMyNamedTemplate,
   ...     name='my template')
 
 Now define a view using such a custom named template registration:
@@ -492,7 +492,7 @@
   ...
   ...     def __call__(self):
   ...         if self.layout is None:
-  ...             layout = zope.component.getMultiAdapter((self, self.request), 
+  ...             layout = zope.component.getMultiAdapter((self, self.request),
   ...                 interfaces.ILayoutTemplate)
   ...             return layout(self)
   ...         return self.layout()



More information about the Checkins mailing list