z3c.macro-1.4.2/ 0000775 0001771 0002004 00000000000 11716773276 014464 5 ustar menesis menesis 0000000 0000000 z3c.macro-1.4.2/setup.py 0000664 0001771 0002004 00000005325 11716773266 016202 0 ustar menesis menesis 0000000 0000000 ##############################################################################
#
# 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: setup.py 124407 2012-02-15 18:16:13Z menesis $
"""
import os
from setuptools import setup, find_packages
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(
name='z3c.macro',
version='1.4.2',
author = "Roger Ineichen and the Zope Community",
author_email = "zope-dev@zope.org",
description = "Simpler definition of ZPT macros.",
long_description=(
read('README.txt')
+ '\n\n' +
'Detailed Documentation\n'
'======================\n'
+ '\n\n' +
read('src', 'z3c', 'macro', 'README.txt')
+ '\n\n' +
read('src', 'z3c', 'macro', 'zcml.txt')
+ '\n\n' +
read('CHANGES.txt')
),
license = "ZPL 2.1",
keywords = "zope3 macro pagetemplate zpt",
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Natural Language :: English',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Zope3'],
url = 'http://pypi.python.org/pypi/z3c.macro',
packages = find_packages('src'),
package_dir = {'':'src'},
namespace_packages = ['z3c'],
extras_require = dict(
test = [
'z3c.pt >= 2.1',
'z3c.ptcompat>=1.0',
'z3c.template',
'zope.app.testing',
'zope.browserpage>=3.12',
'zope.testing',
],
chameleon = [
'z3c.pt >= 2.1',
'z3c.ptcompat>=1.0',
],
),
install_requires = [
'setuptools',
'zope.component',
'zope.configuration',
'zope.interface',
'zope.pagetemplate >= 3.6.2',
'zope.publisher',
'zope.schema',
'zope.tales',
],
include_package_data = True,
zip_safe = False,
)
z3c.macro-1.4.2/CHANGES.txt 0000664 0001771 0002004 00000004765 11716773266 016310 0 ustar menesis menesis 0000000 0000000 =======
CHANGES
=======
1.4.2 (2012-02-15)
------------------
- Remove hooks to use ViewPageTemplateFile from z3c.pt because this breaks when
z3c.pt is available, but z3c.ptcompat is not included. As recommended by notes
in 1.4.0 release.
1.4.1 (2011-11-15)
------------------
- bugfix, missing comma in setup install_requires list
1.4.0 (2011-10-29)
------------------
- Moved z3c.pt include to extras_require chameleon. This makes the package
independent from chameleon and friends and allows to include this
dependencies in your own project.
- Upgrade to chameleon 2.0 template engine and use the newest z3c.pt and
z3c.ptcompat packages adjusted to work with chameleon 2.0.
See the notes from the z3c.ptcompat package:
Update z3c.ptcompat implementation to use component-based template engine
configuration, plugging directly into the Zope Toolkit framework.
The z3c.ptcompat package no longer provides template classes, or ZCML
directives; you should import directly from the ZTK codebase.
Note that the ``PREFER_Z3C_PT`` environment option has been
rendered obsolete; instead, this is now managed via component
configuration.
Also note that the chameleon CHAMELEON_CACHE environment value changed from
True/False to a path. Skip this property if you don't like to use a cache.
None or False defined in buildout environment section doesn't work. At least
with chameleon <= 2.5.4
Attention: You need to include the configure.zcml file from z3c.ptcompat
for enable the z3c.pt template engine. The configure.zcml will plugin the
template engine. Also remove any custom built hooks which will import
z3c.ptcompat in your tests or other places.
1.3.0 (2010-07-05)
------------------
- Tests now require ``zope.browserpage >= 3.12`` instead of
``zope.app.pagetemplate`` as the expression type registration has
been moved there recently.
- No longer using deprecated ``zope.testing.doctestunit`` but built-in
``doctest`` instead.
1.2.1 (2009-03-07)
------------------
- Presence of ``z3c.pt`` is not sufficient to register macro-utility,
``chameleon.zpt`` is required otherwise the factory for the utility
is not defined.
1.2.0 (2009-03-07)
------------------
- Allow use of ``z3c.pt`` using ``z3c.ptcompat`` compatibility layer.
- Change package's mailing list address to zope-dev at zope.org.
1.1.0 (2007-11-01)
------------------
- Update package info data.
- Add z3c namespace package declaration.
1.0.0 (2007-09-30)
------------------
- Initial release.
z3c.macro-1.4.2/PKG-INFO 0000664 0001771 0002004 00000035131 11716773276 015564 0 ustar menesis menesis 0000000 0000000 Metadata-Version: 1.1
Name: z3c.macro
Version: 1.4.2
Summary: Simpler definition of ZPT macros.
Home-page: http://pypi.python.org/pypi/z3c.macro
Author: Roger Ineichen and the Zope Community
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: This package provides an adapter and a TALES expression for a more explicit and
more flexible macro handling using the adapter registry for macros.
Detailed Documentation
======================
=====
Macro
=====
This package provides a adapter and a TALES expression for a expliciter and
flexibler macro handling using the adapter registry for macros.
We start with creating a content object that is used as a view context later:
>>> import zope.interface
>>> import zope.component
>>> from zope.publisher.interfaces.browser import IBrowserView
>>> from zope.publisher.interfaces.browser import IDefaultBrowserLayer
>>> class Content(object):
... zope.interface.implements(zope.interface.Interface)
>>> content = Content()
We also create a temp dir for sample templates which we define later for
testing:
>>> import os, tempfile
>>> temp_dir = tempfile.mkdtemp()
Macro Template
--------------
We define a macro template as a adapter providing IMacroTemplate:
>>> path = os.path.join(temp_dir, 'navigation.pt')
>>> open(path, 'w').write('''
...
... ---
...
... ''')
Let's define the macro factory
>>> from z3c.macro import interfaces
>>> from z3c.macro import zcml
>>> navigationMacro = zcml.MacroFactory(path, 'navigation', 'text/html')
and register them as adapter:
>>> zope.component.provideAdapter(
... navigationMacro,
... (zope.interface.Interface, IBrowserView, IDefaultBrowserLayer),
... interfaces.IMacroTemplate,
... name='navigation')
The TALES ``macro`` Expression
------------------------------
The ``macro`` expression will look up the name of the macro, call a adapter
providing IMacroTemplate and uses them or fills a slot if defined in the
``macro`` expression.
Let's create a page template using the ``navigation`` macros:
>>> path = os.path.join(temp_dir, 'first.pt')
>>> open(path, 'w').write('''
...
...
... First Page
...
...
...
...
...
...
... Content here
...
...
...
... ''')
As you can see, we used the ``macro`` expression to simply look up a macro
called navigation whihc get inserted and replaces the HTML content at this
place.
Let's now create a view using this page template:
>>> from zope.publisher.browser import BrowserView
>>> class simple(BrowserView):
... def __getitem__(self, name):
... return self.index.macros[name]
...
... def __call__(self, **kwargs):
... return self.index(**kwargs)
>>> from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
>>> def SimpleViewClass(path, name=u''):
... return type(
... "SimpleViewClass", (simple,),
... {'index': ViewPageTemplateFile(path), '__name__': name})
>>> FirstPage = SimpleViewClass(path, name='first.html')
>>> zope.component.provideAdapter(
... FirstPage,
... (zope.interface.Interface, IDefaultBrowserLayer),
... zope.interface.Interface,
... name='first.html')
Finally we look up the view and render it:
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
>>> view = zope.component.getMultiAdapter((content, request),
... name='first.html')
>>> print view().strip()
First Page
Content here
Slot
----
We can also define a macro slot and fill it with given content:
>>> path = os.path.join(temp_dir, 'addons.pt')
>>> open(path, 'w').write('''
...
... Content before header
...
... My Header
...
... Content after header
...
... ''')
Let's define the macro factory
>>> addonsMacro = zcml.MacroFactory(path, 'addons', 'text/html')
and register them as adapter:
>>> zope.component.provideAdapter(
... addonsMacro,
... (zope.interface.Interface, IBrowserView, IDefaultBrowserLayer),
... interfaces.IMacroTemplate,
... name='addons')
Let's create a page template using the ``addons`` macros:
>>> path = os.path.join(temp_dir, 'second.pt')
>>> open(path, 'w').write('''
...
...
... Second Page
...
...
...
... ''')
Let's now create a view using this page template:
>>> SecondPage = SimpleViewClass(path, name='second.html')
>>> zope.component.provideAdapter(
... SecondPage,
... (zope.interface.Interface, IDefaultBrowserLayer),
... zope.interface.Interface,
... name='second.html')
Finally we look up the view and render it:
>>> view = zope.component.getMultiAdapter((content, request),
... name='second.html')
>>> print view().strip()
Second Page
Cleanup
-------
>>> import shutil
>>> shutil.rmtree(temp_dir)
===============
macro directive
===============
A macro directive can be used for register macros. Take a look at the
README.txt which explains the macro TALES expression.
>>> import sys
>>> from zope.configuration import xmlconfig
>>> import z3c.template
>>> context = xmlconfig.file('meta.zcml', z3c.macro)
First define a template which defines a macro:
>>> import os, tempfile
>>> temp_dir = tempfile.mkdtemp()
>>> file = os.path.join(temp_dir, 'file.pt')
>>> open(file, 'w').write('''
...
...
...
... Pagelet skin
...
...
...
... content
...
...
... ''')
and register the macro provider within the ``z3c:macroProvider`` directive:
>>> context = xmlconfig.string("""
...
...
...
... """ % file, context=context)
We need a content object...
>>> import zope.interface
>>> class Content(object):
... zope.interface.implements(zope.interface.Interface)
>>> content = Content()
and we need a view...
>>> import zope.interface
>>> import zope.component
>>> from zope.publisher.browser import BrowserPage
>>> class View(BrowserPage):
... def __init__(self, context, request):
... self.context = context
... self.request = request
and we need a request:
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
Check if we get the macro template:
>>> from z3c.macro import interfaces
>>> view = View(content, request)
>>> macro = zope.component.queryMultiAdapter((content, view, request),
... interface=interfaces.IMacroTemplate, name='title')
>>> macro is not None
True
>>> import os, tempfile
>>> temp_dir = tempfile.mkdtemp()
>>> file = os.path.join(temp_dir, 'test.pt')
>>> open(file, 'w').write('''
...
...
...
...
...
... ''')
>>> from zope.browserpage.viewpagetemplatefile import BoundPageTemplate
>>> from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
>>> template = ViewPageTemplateFile(file)
>>> print BoundPageTemplate(template, view)(macro=macro)
Pagelet skin
=======
CHANGES
=======
1.4.2 (2012-02-15)
------------------
- Remove hooks to use ViewPageTemplateFile from z3c.pt because this breaks when
z3c.pt is available, but z3c.ptcompat is not included. As recommended by notes
in 1.4.0 release.
1.4.1 (2011-11-15)
------------------
- bugfix, missing comma in setup install_requires list
1.4.0 (2011-10-29)
------------------
- Moved z3c.pt include to extras_require chameleon. This makes the package
independent from chameleon and friends and allows to include this
dependencies in your own project.
- Upgrade to chameleon 2.0 template engine and use the newest z3c.pt and
z3c.ptcompat packages adjusted to work with chameleon 2.0.
See the notes from the z3c.ptcompat package:
Update z3c.ptcompat implementation to use component-based template engine
configuration, plugging directly into the Zope Toolkit framework.
The z3c.ptcompat package no longer provides template classes, or ZCML
directives; you should import directly from the ZTK codebase.
Note that the ``PREFER_Z3C_PT`` environment option has been
rendered obsolete; instead, this is now managed via component
configuration.
Also note that the chameleon CHAMELEON_CACHE environment value changed from
True/False to a path. Skip this property if you don't like to use a cache.
None or False defined in buildout environment section doesn't work. At least
with chameleon <= 2.5.4
Attention: You need to include the configure.zcml file from z3c.ptcompat
for enable the z3c.pt template engine. The configure.zcml will plugin the
template engine. Also remove any custom built hooks which will import
z3c.ptcompat in your tests or other places.
1.3.0 (2010-07-05)
------------------
- Tests now require ``zope.browserpage >= 3.12`` instead of
``zope.app.pagetemplate`` as the expression type registration has
been moved there recently.
- No longer using deprecated ``zope.testing.doctestunit`` but built-in
``doctest`` instead.
1.2.1 (2009-03-07)
------------------
- Presence of ``z3c.pt`` is not sufficient to register macro-utility,
``chameleon.zpt`` is required otherwise the factory for the utility
is not defined.
1.2.0 (2009-03-07)
------------------
- Allow use of ``z3c.pt`` using ``z3c.ptcompat`` compatibility layer.
- Change package's mailing list address to zope-dev at zope.org.
1.1.0 (2007-11-01)
------------------
- Update package info data.
- Add z3c namespace package declaration.
1.0.0 (2007-09-30)
------------------
- Initial release.
Keywords: zope3 macro pagetemplate zpt
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Programming Language :: Python
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Framework :: Zope3
z3c.macro-1.4.2/bootstrap.py 0000664 0001771 0002004 00000003372 11716773266 017057 0 ustar menesis menesis 0000000 0000000 ##############################################################################
#
# 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.
#
##############################################################################
"""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: bootstrap.py 113955 2010-06-28 06:32:10Z icemac $
"""
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)
z3c.macro-1.4.2/COPYRIGHT.txt 0000664 0001771 0002004 00000000040 11716773266 016566 0 ustar menesis menesis 0000000 0000000 Zope Foundation and Contributors z3c.macro-1.4.2/src/ 0000775 0001771 0002004 00000000000 11716773276 015253 5 ustar menesis menesis 0000000 0000000 z3c.macro-1.4.2/src/z3c/ 0000775 0001771 0002004 00000000000 11716773276 015752 5 ustar menesis menesis 0000000 0000000 z3c.macro-1.4.2/src/z3c/macro/ 0000775 0001771 0002004 00000000000 11716773276 017053 5 ustar menesis menesis 0000000 0000000 z3c.macro-1.4.2/src/z3c/macro/meta.zcml 0000664 0001771 0002004 00000000521 11716773266 020665 0 ustar menesis menesis 0000000 0000000
z3c.macro-1.4.2/src/z3c/macro/configure.zcml 0000664 0001771 0002004 00000001002 11716773266 021713 0 ustar menesis menesis 0000000 0000000
z3c.macro-1.4.2/src/z3c/macro/tests.py 0000664 0001771 0002004 00000003624 11716773266 020573 0 ustar menesis menesis 0000000 0000000 ##############################################################################
#
# Copyright (c) 2004 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.
#
##############################################################################
"""Viewlet tests
$Id: tests.py 124402 2012-02-15 18:00:33Z menesis $
"""
__docformat__ = 'restructuredtext'
from zope.app.testing import setup
from zope.configuration import xmlconfig
import doctest
import itertools
import unittest
import z3c.macro.tales
import z3c.macro.zcml
def setUp(test):
root = setup.placefulSetUp(site=True)
test.globs['root'] = root
def setUpZPT(test):
setUp(test)
from zope.browserpage import metaconfigure
metaconfigure.registerType('macro', z3c.macro.tales.MacroExpression)
def setUpZ3CPT(suite):
setUp(suite)
import z3c.pt
import z3c.ptcompat
xmlconfig.XMLConfig('configure.zcml', z3c.pt)()
xmlconfig.XMLConfig('configure.zcml', z3c.ptcompat)()
def tearDown(test):
setup.placefulTearDown()
def test_suite():
tests = ((
doctest.DocFileSuite('README.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
),
doctest.DocFileSuite('zcml.txt', setUp=setUp, tearDown=tearDown,
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,),
) for setUp in (setUpZ3CPT, setUpZPT))
return unittest.TestSuite(itertools.chain(*tests))
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
z3c.macro-1.4.2/src/z3c/macro/tales.py 0000664 0001771 0002004 00000005120 11716773266 020532 0 ustar menesis menesis 0000000 0000000 ##############################################################################
#
# Copyright (c) 2004 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.
#
##############################################################################
"""Provider tales expression registrations
$Id: tales.py 123179 2011-10-29 21:00:50Z rogerineichen $
"""
__docformat__ = 'restructuredtext'
import re
import zope.component
import zope.interface
from zope.tales import expressions
from z3c.macro import interfaces
def get_macro_template(context, view, request, name):
return zope.component.getMultiAdapter(
(context, view, request), interface=interfaces.IMacroTemplate, name=name)
class MacroExpression(expressions.StringExpr):
"""Collect named IMacroTemplate via a TAL namespace called ``macro``."""
zope.interface.implements(interfaces.IMacroExpression)
def __call__(self, econtext):
name = super(MacroExpression, self).__call__(econtext)
context = econtext.vars['context']
request = econtext.vars['request']
view = econtext.vars['view']
return get_macro_template(context, view, request, name)
try:
# define chameleon ``macro`` expression
from chameleon.tales import StringExpr
from chameleon.astutil import Static
from chameleon.astutil import Symbol
from chameleon.codegen import template
class MacroGetter(object):
"""Collect named IMacroTemplate via a TAL namespace called ``macro``."""
def __call__(self, context, request, view, name):
return zope.component.getMultiAdapter(
(context, view, request), interface=interfaces.IMacroTemplate,
name=name)
class MacroExpr(StringExpr):
traverser = Static(
template("cls()", cls=Symbol(MacroGetter), mode="eval")
)
def __call__(self, target, engine):
assignment = super(MacroExpr, self).__call__(target, engine)
return assignment + \
template(
"target = traverse(context, request, view, target.strip())",
target=target,
traverse=self.traverser,
)
except ImportError:
pass
z3c.macro-1.4.2/src/z3c/macro/zcml.txt 0000664 0001771 0002004 00000004724 11716773266 020567 0 ustar menesis menesis 0000000 0000000 ===============
macro directive
===============
A macro directive can be used for register macros. Take a look at the
README.txt which explains the macro TALES expression.
>>> import sys
>>> from zope.configuration import xmlconfig
>>> import z3c.template
>>> context = xmlconfig.file('meta.zcml', z3c.macro)
First define a template which defines a macro:
>>> import os, tempfile
>>> temp_dir = tempfile.mkdtemp()
>>> file = os.path.join(temp_dir, 'file.pt')
>>> open(file, 'w').write('''
...
...
...
... Pagelet skin
...
...
...
... content
...
...
... ''')
and register the macro provider within the ``z3c:macroProvider`` directive:
>>> context = xmlconfig.string("""
...
...
...
... """ % file, context=context)
We need a content object...
>>> import zope.interface
>>> class Content(object):
... zope.interface.implements(zope.interface.Interface)
>>> content = Content()
and we need a view...
>>> import zope.interface
>>> import zope.component
>>> from zope.publisher.browser import BrowserPage
>>> class View(BrowserPage):
... def __init__(self, context, request):
... self.context = context
... self.request = request
and we need a request:
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
Check if we get the macro template:
>>> from z3c.macro import interfaces
>>> view = View(content, request)
>>> macro = zope.component.queryMultiAdapter((content, view, request),
... interface=interfaces.IMacroTemplate, name='title')
>>> macro is not None
True
>>> import os, tempfile
>>> temp_dir = tempfile.mkdtemp()
>>> file = os.path.join(temp_dir, 'test.pt')
>>> open(file, 'w').write('''
...
...
...
...
...
... ''')
>>> from zope.browserpage.viewpagetemplatefile import BoundPageTemplate
>>> from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
>>> template = ViewPageTemplateFile(file)
>>> print BoundPageTemplate(template, view)(macro=macro)
Pagelet skin
z3c.macro-1.4.2/src/z3c/macro/README.txt 0000664 0001771 0002004 00000013102 11716773266 020545 0 ustar menesis menesis 0000000 0000000 =====
Macro
=====
This package provides a adapter and a TALES expression for a expliciter and
flexibler macro handling using the adapter registry for macros.
We start with creating a content object that is used as a view context later:
>>> import zope.interface
>>> import zope.component
>>> from zope.publisher.interfaces.browser import IBrowserView
>>> from zope.publisher.interfaces.browser import IDefaultBrowserLayer
>>> class Content(object):
... zope.interface.implements(zope.interface.Interface)
>>> content = Content()
We also create a temp dir for sample templates which we define later for
testing:
>>> import os, tempfile
>>> temp_dir = tempfile.mkdtemp()
Macro Template
--------------
We define a macro template as a adapter providing IMacroTemplate:
>>> path = os.path.join(temp_dir, 'navigation.pt')
>>> open(path, 'w').write('''
...
... ---
...
... ''')
Let's define the macro factory
>>> from z3c.macro import interfaces
>>> from z3c.macro import zcml
>>> navigationMacro = zcml.MacroFactory(path, 'navigation', 'text/html')
and register them as adapter:
>>> zope.component.provideAdapter(
... navigationMacro,
... (zope.interface.Interface, IBrowserView, IDefaultBrowserLayer),
... interfaces.IMacroTemplate,
... name='navigation')
The TALES ``macro`` Expression
------------------------------
The ``macro`` expression will look up the name of the macro, call a adapter
providing IMacroTemplate and uses them or fills a slot if defined in the
``macro`` expression.
Let's create a page template using the ``navigation`` macros:
>>> path = os.path.join(temp_dir, 'first.pt')
>>> open(path, 'w').write('''
...
...
... First Page
...
...
...
...
...
...
... Content here
...
...
...
... ''')
As you can see, we used the ``macro`` expression to simply look up a macro
called navigation whihc get inserted and replaces the HTML content at this
place.
Let's now create a view using this page template:
>>> from zope.publisher.browser import BrowserView
>>> class simple(BrowserView):
... def __getitem__(self, name):
... return self.index.macros[name]
...
... def __call__(self, **kwargs):
... return self.index(**kwargs)
>>> from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
>>> def SimpleViewClass(path, name=u''):
... return type(
... "SimpleViewClass", (simple,),
... {'index': ViewPageTemplateFile(path), '__name__': name})
>>> FirstPage = SimpleViewClass(path, name='first.html')
>>> zope.component.provideAdapter(
... FirstPage,
... (zope.interface.Interface, IDefaultBrowserLayer),
... zope.interface.Interface,
... name='first.html')
Finally we look up the view and render it:
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
>>> view = zope.component.getMultiAdapter((content, request),
... name='first.html')
>>> print view().strip()
First Page
Content here
Slot
----
We can also define a macro slot and fill it with given content:
>>> path = os.path.join(temp_dir, 'addons.pt')
>>> open(path, 'w').write('''
...
... Content before header
...
... My Header
...
... Content after header
...
... ''')
Let's define the macro factory
>>> addonsMacro = zcml.MacroFactory(path, 'addons', 'text/html')
and register them as adapter:
>>> zope.component.provideAdapter(
... addonsMacro,
... (zope.interface.Interface, IBrowserView, IDefaultBrowserLayer),
... interfaces.IMacroTemplate,
... name='addons')
Let's create a page template using the ``addons`` macros:
>>> path = os.path.join(temp_dir, 'second.pt')
>>> open(path, 'w').write('''
...
...
... Second Page
...
...
...
... ''')
Let's now create a view using this page template:
>>> SecondPage = SimpleViewClass(path, name='second.html')
>>> zope.component.provideAdapter(
... SecondPage,
... (zope.interface.Interface, IDefaultBrowserLayer),
... zope.interface.Interface,
... name='second.html')
Finally we look up the view and render it:
>>> view = zope.component.getMultiAdapter((content, request),
... name='second.html')
>>> print view().strip()
Second Page
Cleanup
-------
>>> import shutil
>>> shutil.rmtree(temp_dir)
z3c.macro-1.4.2/src/z3c/macro/__init__.py 0000664 0001771 0002004 00000002221 11716773266 021160 0 ustar menesis menesis 0000000 0000000 ##############################################################################
#
# Copyright (c) 2006 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.
#
##############################################################################
"""
$Id: __init__.py 123179 2011-10-29 21:00:50Z rogerineichen $
"""
try:
# register chameleon ``macro`` tales expression for BaseTemplate
# there is not adapter or other registration support built in in
# z3c.pt and apply our tales expression to any page template or
# offer a custom PageTemplate is no option
from z3c.macro import tales
import z3c.pt.pagetemplate
z3c.pt.pagetemplate.BaseTemplate.expression_types['macro'] = tales.MacroExpr
except ImportError:
# we do not support z3c.pt
pass
z3c.macro-1.4.2/src/z3c/macro/zcml.py 0000664 0001771 0002004 00000011167 11716773266 020377 0 ustar menesis menesis 0000000 0000000 ##############################################################################
#
# Copyright (c) 2005 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.
#
##############################################################################
"""
$Id: zcml.py 124402 2012-02-15 18:00:33Z menesis $
"""
__docformat__ = "reStructuredText"
import os
import zope.interface
import zope.schema
import zope.configuration.fields
from zope.configuration.exceptions import ConfigurationError
from zope.component import zcml
from zope.publisher.interfaces.browser import IBrowserView
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
from z3c.macro import interfaces
class IMacroDirective(zope.interface.Interface):
"""Parameters for the template directive."""
template = zope.configuration.fields.Path(
title=u'Template defining a named macro.',
description=u"""Refers to a file containing a page template
(should end in extension ``.pt`` or ``.html``).
""",
required=True,
)
name = zope.schema.TextLine(
title=u'Name',
description=u"""
The macro name which this macro is registered for. The macro
name can be the same defined in metal:define-macro but does
not have to be the same. If no macro attribute is given the
name is used as the name defined in metal:define-macro. If you
need to register a macro under a different name as the defined
one, you can use the macro attribute which have to reference
the metal.define-macro name. The TALES expression calls macros
by this name and returns the macro within the same name or with
the name defined in the macro attribute.
""",
required=True,
default=u'',
)
macro = zope.schema.TextLine(
title=u'Macro',
description=u"""
The name of the macro to be used. This allows us to reference
the named macro defined with metal:define-macro if we use a
different IMacroDirective name.
""",
required=False,
default=u'',
)
for_ = zope.configuration.fields.GlobalObject(
title=u'Context',
description=u'The context for which the macro should be used',
required=False,
default=zope.interface.Interface,
)
view = zope.configuration.fields.GlobalObject(
title=u'View',
description=u'The view for which the macro should be used',
required=False,
default=IBrowserView)
layer = zope.configuration.fields.GlobalObject(
title=u'Layer',
description=u'The layer for which the macro should be used',
required=False,
default=IDefaultBrowserLayer,
)
contentType = zope.schema.BytesLine(
title=u'Content Type',
description=u'The content type identifies the type of data.',
default='text/html',
required=False,
)
class MacroFactory(object):
"""Macro factory."""
def __init__(self, path, macro, contentType):
self.path = path
self.macro = macro
self.contentType = contentType
def __call__(self, context, view, request):
template = ViewPageTemplateFile(self.path,
content_type=self.contentType)
return template.macros[self.macro]
def registerMacroFactory(_context, path, name, macro, for_, view, layer,
contentType):
"""Register a named macro factory adapter."""
factory = MacroFactory(path, macro, contentType)
# register the macro
zcml.adapter(_context, (factory,), interfaces.IMacroTemplate,
(for_, view, layer), name=name)
def macroDirective(_context, template, name, macro=u'',
for_=zope.interface.Interface, view=IBrowserView,
layer=IDefaultBrowserLayer, contentType='text/html'):
# Make sure that the template exists
path = os.path.abspath(str(_context.path(template)))
if not os.path.isfile(path):
raise ConfigurationError("No such file", template)
if not macro:
macro = name
registerMacroFactory(_context, path, name, macro, for_, view, layer,
contentType)
z3c.macro-1.4.2/src/z3c/macro/interfaces.py 0000664 0001771 0002004 00000003150 11716773266 021546 0 ustar menesis menesis 0000000 0000000 ##############################################################################
#
# Copyright (c) 2005 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.
#
##############################################################################
"""
$Id: interfaces.py 72084 2007-01-18 01:02:26Z rogerineichen $
"""
from zope.tales import interfaces
from zope.pagetemplate.interfaces import IPageTemplate
class IMacroTemplate(IPageTemplate):
"""A macro template."""
class IMacroExpression(interfaces.ITALESExpression):
"""Return the HTML content of the named provider.
To call a macro from a page template use the the following syntax::
this content get rendered in the defined slot of the macro
<\metal:block>
<\metal:block>
or
this content get replaced by the defined macro
The ``macro:`` TALES expression calles a named adapter adapting
(context, request) or (context, request, view), depending on the usage
of the view attribute in the macro directive. A macro provides the
interface IMacroTemplate.
"""
z3c.macro-1.4.2/src/z3c/__init__.py 0000664 0001771 0002004 00000000174 11716773266 020064 0 ustar menesis menesis 0000000 0000000 # this is a namespace package
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
pass
z3c.macro-1.4.2/src/z3c.macro.egg-info/ 0000775 0001771 0002004 00000000000 11716773276 020544 5 ustar menesis menesis 0000000 0000000 z3c.macro-1.4.2/src/z3c.macro.egg-info/PKG-INFO 0000664 0001771 0002004 00000035131 11716773271 021637 0 ustar menesis menesis 0000000 0000000 Metadata-Version: 1.1
Name: z3c.macro
Version: 1.4.2
Summary: Simpler definition of ZPT macros.
Home-page: http://pypi.python.org/pypi/z3c.macro
Author: Roger Ineichen and the Zope Community
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: This package provides an adapter and a TALES expression for a more explicit and
more flexible macro handling using the adapter registry for macros.
Detailed Documentation
======================
=====
Macro
=====
This package provides a adapter and a TALES expression for a expliciter and
flexibler macro handling using the adapter registry for macros.
We start with creating a content object that is used as a view context later:
>>> import zope.interface
>>> import zope.component
>>> from zope.publisher.interfaces.browser import IBrowserView
>>> from zope.publisher.interfaces.browser import IDefaultBrowserLayer
>>> class Content(object):
... zope.interface.implements(zope.interface.Interface)
>>> content = Content()
We also create a temp dir for sample templates which we define later for
testing:
>>> import os, tempfile
>>> temp_dir = tempfile.mkdtemp()
Macro Template
--------------
We define a macro template as a adapter providing IMacroTemplate:
>>> path = os.path.join(temp_dir, 'navigation.pt')
>>> open(path, 'w').write('''
...
... ---
...
... ''')
Let's define the macro factory
>>> from z3c.macro import interfaces
>>> from z3c.macro import zcml
>>> navigationMacro = zcml.MacroFactory(path, 'navigation', 'text/html')
and register them as adapter:
>>> zope.component.provideAdapter(
... navigationMacro,
... (zope.interface.Interface, IBrowserView, IDefaultBrowserLayer),
... interfaces.IMacroTemplate,
... name='navigation')
The TALES ``macro`` Expression
------------------------------
The ``macro`` expression will look up the name of the macro, call a adapter
providing IMacroTemplate and uses them or fills a slot if defined in the
``macro`` expression.
Let's create a page template using the ``navigation`` macros:
>>> path = os.path.join(temp_dir, 'first.pt')
>>> open(path, 'w').write('''
...
...
... First Page
...
...
...
...
...
...
... Content here
...
...
...
... ''')
As you can see, we used the ``macro`` expression to simply look up a macro
called navigation whihc get inserted and replaces the HTML content at this
place.
Let's now create a view using this page template:
>>> from zope.publisher.browser import BrowserView
>>> class simple(BrowserView):
... def __getitem__(self, name):
... return self.index.macros[name]
...
... def __call__(self, **kwargs):
... return self.index(**kwargs)
>>> from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
>>> def SimpleViewClass(path, name=u''):
... return type(
... "SimpleViewClass", (simple,),
... {'index': ViewPageTemplateFile(path), '__name__': name})
>>> FirstPage = SimpleViewClass(path, name='first.html')
>>> zope.component.provideAdapter(
... FirstPage,
... (zope.interface.Interface, IDefaultBrowserLayer),
... zope.interface.Interface,
... name='first.html')
Finally we look up the view and render it:
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
>>> view = zope.component.getMultiAdapter((content, request),
... name='first.html')
>>> print view().strip()
First Page
Content here
Slot
----
We can also define a macro slot and fill it with given content:
>>> path = os.path.join(temp_dir, 'addons.pt')
>>> open(path, 'w').write('''
...
... Content before header
...
... My Header
...
... Content after header
...
... ''')
Let's define the macro factory
>>> addonsMacro = zcml.MacroFactory(path, 'addons', 'text/html')
and register them as adapter:
>>> zope.component.provideAdapter(
... addonsMacro,
... (zope.interface.Interface, IBrowserView, IDefaultBrowserLayer),
... interfaces.IMacroTemplate,
... name='addons')
Let's create a page template using the ``addons`` macros:
>>> path = os.path.join(temp_dir, 'second.pt')
>>> open(path, 'w').write('''
...
...
... Second Page
...
...
...
... ''')
Let's now create a view using this page template:
>>> SecondPage = SimpleViewClass(path, name='second.html')
>>> zope.component.provideAdapter(
... SecondPage,
... (zope.interface.Interface, IDefaultBrowserLayer),
... zope.interface.Interface,
... name='second.html')
Finally we look up the view and render it:
>>> view = zope.component.getMultiAdapter((content, request),
... name='second.html')
>>> print view().strip()
Second Page
Cleanup
-------
>>> import shutil
>>> shutil.rmtree(temp_dir)
===============
macro directive
===============
A macro directive can be used for register macros. Take a look at the
README.txt which explains the macro TALES expression.
>>> import sys
>>> from zope.configuration import xmlconfig
>>> import z3c.template
>>> context = xmlconfig.file('meta.zcml', z3c.macro)
First define a template which defines a macro:
>>> import os, tempfile
>>> temp_dir = tempfile.mkdtemp()
>>> file = os.path.join(temp_dir, 'file.pt')
>>> open(file, 'w').write('''
...
...
...
... Pagelet skin
...
...
...
... content
...
...
... ''')
and register the macro provider within the ``z3c:macroProvider`` directive:
>>> context = xmlconfig.string("""
...
...
...
... """ % file, context=context)
We need a content object...
>>> import zope.interface
>>> class Content(object):
... zope.interface.implements(zope.interface.Interface)
>>> content = Content()
and we need a view...
>>> import zope.interface
>>> import zope.component
>>> from zope.publisher.browser import BrowserPage
>>> class View(BrowserPage):
... def __init__(self, context, request):
... self.context = context
... self.request = request
and we need a request:
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
Check if we get the macro template:
>>> from z3c.macro import interfaces
>>> view = View(content, request)
>>> macro = zope.component.queryMultiAdapter((content, view, request),
... interface=interfaces.IMacroTemplate, name='title')
>>> macro is not None
True
>>> import os, tempfile
>>> temp_dir = tempfile.mkdtemp()
>>> file = os.path.join(temp_dir, 'test.pt')
>>> open(file, 'w').write('''
...
...
...
...
...
... ''')
>>> from zope.browserpage.viewpagetemplatefile import BoundPageTemplate
>>> from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
>>> template = ViewPageTemplateFile(file)
>>> print BoundPageTemplate(template, view)(macro=macro)
Pagelet skin
=======
CHANGES
=======
1.4.2 (2012-02-15)
------------------
- Remove hooks to use ViewPageTemplateFile from z3c.pt because this breaks when
z3c.pt is available, but z3c.ptcompat is not included. As recommended by notes
in 1.4.0 release.
1.4.1 (2011-11-15)
------------------
- bugfix, missing comma in setup install_requires list
1.4.0 (2011-10-29)
------------------
- Moved z3c.pt include to extras_require chameleon. This makes the package
independent from chameleon and friends and allows to include this
dependencies in your own project.
- Upgrade to chameleon 2.0 template engine and use the newest z3c.pt and
z3c.ptcompat packages adjusted to work with chameleon 2.0.
See the notes from the z3c.ptcompat package:
Update z3c.ptcompat implementation to use component-based template engine
configuration, plugging directly into the Zope Toolkit framework.
The z3c.ptcompat package no longer provides template classes, or ZCML
directives; you should import directly from the ZTK codebase.
Note that the ``PREFER_Z3C_PT`` environment option has been
rendered obsolete; instead, this is now managed via component
configuration.
Also note that the chameleon CHAMELEON_CACHE environment value changed from
True/False to a path. Skip this property if you don't like to use a cache.
None or False defined in buildout environment section doesn't work. At least
with chameleon <= 2.5.4
Attention: You need to include the configure.zcml file from z3c.ptcompat
for enable the z3c.pt template engine. The configure.zcml will plugin the
template engine. Also remove any custom built hooks which will import
z3c.ptcompat in your tests or other places.
1.3.0 (2010-07-05)
------------------
- Tests now require ``zope.browserpage >= 3.12`` instead of
``zope.app.pagetemplate`` as the expression type registration has
been moved there recently.
- No longer using deprecated ``zope.testing.doctestunit`` but built-in
``doctest`` instead.
1.2.1 (2009-03-07)
------------------
- Presence of ``z3c.pt`` is not sufficient to register macro-utility,
``chameleon.zpt`` is required otherwise the factory for the utility
is not defined.
1.2.0 (2009-03-07)
------------------
- Allow use of ``z3c.pt`` using ``z3c.ptcompat`` compatibility layer.
- Change package's mailing list address to zope-dev at zope.org.
1.1.0 (2007-11-01)
------------------
- Update package info data.
- Add z3c namespace package declaration.
1.0.0 (2007-09-30)
------------------
- Initial release.
Keywords: zope3 macro pagetemplate zpt
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Programming Language :: Python
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Framework :: Zope3
z3c.macro-1.4.2/src/z3c.macro.egg-info/dependency_links.txt 0000664 0001771 0002004 00000000001 11716773271 024605 0 ustar menesis menesis 0000000 0000000
z3c.macro-1.4.2/src/z3c.macro.egg-info/namespace_packages.txt 0000664 0001771 0002004 00000000004 11716773271 025064 0 ustar menesis menesis 0000000 0000000 z3c
z3c.macro-1.4.2/src/z3c.macro.egg-info/not-zip-safe 0000664 0001771 0002004 00000000001 11716773266 022771 0 ustar menesis menesis 0000000 0000000
z3c.macro-1.4.2/src/z3c.macro.egg-info/top_level.txt 0000664 0001771 0002004 00000000004 11716773271 023263 0 ustar menesis menesis 0000000 0000000 z3c
z3c.macro-1.4.2/src/z3c.macro.egg-info/requires.txt 0000664 0001771 0002004 00000000423 11716773271 023136 0 ustar menesis menesis 0000000 0000000 setuptools
zope.component
zope.configuration
zope.interface
zope.pagetemplate >= 3.6.2
zope.publisher
zope.schema
zope.tales
[test]
z3c.pt >= 2.1
z3c.ptcompat>=1.0
z3c.template
zope.app.testing
zope.browserpage>=3.12
zope.testing
[chameleon]
z3c.pt >= 2.1
z3c.ptcompat>=1.0 z3c.macro-1.4.2/src/z3c.macro.egg-info/SOURCES.txt 0000664 0001771 0002004 00000001120 11716773271 022415 0 ustar menesis menesis 0000000 0000000 CHANGES.txt
COPYRIGHT.txt
LICENSE.txt
README.txt
bootstrap.py
buildout.cfg
setup.py
src/z3c/__init__.py
src/z3c.macro.egg-info/PKG-INFO
src/z3c.macro.egg-info/SOURCES.txt
src/z3c.macro.egg-info/dependency_links.txt
src/z3c.macro.egg-info/namespace_packages.txt
src/z3c.macro.egg-info/not-zip-safe
src/z3c.macro.egg-info/requires.txt
src/z3c.macro.egg-info/top_level.txt
src/z3c/macro/README.txt
src/z3c/macro/__init__.py
src/z3c/macro/configure.zcml
src/z3c/macro/interfaces.py
src/z3c/macro/meta.zcml
src/z3c/macro/tales.py
src/z3c/macro/tests.py
src/z3c/macro/zcml.py
src/z3c/macro/zcml.txt z3c.macro-1.4.2/buildout.cfg 0000664 0001771 0002004 00000001072 11716773266 016773 0 ustar menesis menesis 0000000 0000000 [buildout]
develop = .
parts = test coverage-test coverage-report
versions = versions
[versions]
lxml = 2.3 # no windows release for 3.2.1
[test-environment]
CHAMELEON_DEBUG = False
[test]
recipe = zc.recipe.testrunner
eggs = z3c.macro [test]
environment = test-environment
[coverage-test]
recipe = zc.recipe.testrunner
eggs = z3c.macro [test]
defaults = ['--coverage', '../../coverage']
environment = test-environment
[coverage-report]
recipe = zc.recipe.egg
eggs = z3c.coverage
scripts = coveragereport
arguments = ('parts/coverage', 'parts/coverage/report')
z3c.macro-1.4.2/README.txt 0000664 0001771 0002004 00000000224 11716773266 016157 0 ustar menesis menesis 0000000 0000000 This package provides an adapter and a TALES expression for a more explicit and
more flexible macro handling using the adapter registry for macros.
z3c.macro-1.4.2/setup.cfg 0000664 0001771 0002004 00000000073 11716773276 016305 0 ustar menesis menesis 0000000 0000000 [egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0
z3c.macro-1.4.2/LICENSE.txt 0000664 0001771 0002004 00000004026 11716773266 016310 0 ustar menesis menesis 0000000 0000000 Zope Public License (ZPL) Version 2.1
A copyright notice accompanies this license document that identifies the
copyright holders.
This license has been certified as open source. It has also been designated as
GPL compatible by the Free Software Foundation (FSF).
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions in source code must retain the accompanying copyright
notice, this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the accompanying copyright
notice, this list of conditions, and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Names of the copyright holders must not be used to endorse or promote
products derived from this software without prior written permission from the
copyright holders.
4. The right to distribute this software or to use it for any purpose does not
give you the right to use Servicemarks (sm) or Trademarks (tm) of the
copyright
holders. Use of them is covered by separate agreement with the copyright
holders.
5. If any files are modified, you must cause the modified files to carry
prominent notices stating that you changed the files and the date of any
change.
Disclaimer
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.