pyramid_chameleon-0.3/0000775000175000017500000000000012354572066015644 5ustar chrismchrism00000000000000pyramid_chameleon-0.3/pyramid_chameleon.egg-info/0000775000175000017500000000000012354572066023016 5ustar chrismchrism00000000000000pyramid_chameleon-0.3/pyramid_chameleon.egg-info/entry_points.txt0000664000175000017500000000000612354572062026304 0ustar chrismchrism00000000000000 pyramid_chameleon-0.3/pyramid_chameleon.egg-info/PKG-INFO0000664000175000017500000000342712354572062024115 0ustar chrismchrism00000000000000Metadata-Version: 1.1 Name: pyramid-chameleon Version: 0.3 Summary: pyramid_chameleon Home-page: https://github.com/Pylons/pyramid_chameleon Author: reed@koansys.com, Pylons & Pyramid community Author-email: pylons-discuss@googlegroups.com License: BSD-derived (http://www.repoze.org/LICENSE.txt) Description: Chameleon templating system Bindings for Pyramid ================================================= These are bindings for the `Chameleon templating system `_ for the Pyramid_ web framework. See http://docs.pylonsproject.org/projects/pyramid_chameleon/en/latest/ for documentation. .. _Pyramid: http://pylonsproject.org/ 0.3 (2014-07-01) ---------------- - Remove dependency on ``pyramid.interfaces.ITemplateRenderer`` (which is deprecated in Pyramid > 1.5). - Update Trove classifiers and tests to support Python 3.4. 0.2 (2014-02-09) ---------------- - Dropped dependency on ``nose-selecttests``. 0.1 (2013-09-07) ---------------- - Initial version Platform: UNKNOWN Classifier: Programming Language :: Python Classifier: Framework :: Pylons Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Intended Audience :: Developers Classifier: License :: Repoze Public License Classifier: Topic :: Text Processing :: Markup :: XML Classifier: Topic :: Text Processing :: Markup :: HTML pyramid_chameleon-0.3/pyramid_chameleon.egg-info/not-zip-safe0000664000175000017500000000000112212267032025227 0ustar chrismchrism00000000000000 pyramid_chameleon-0.3/pyramid_chameleon.egg-info/dependency_links.txt0000664000175000017500000000000112354572062027060 0ustar chrismchrism00000000000000 pyramid_chameleon-0.3/pyramid_chameleon.egg-info/top_level.txt0000664000175000017500000000002212354572062025536 0ustar chrismchrism00000000000000pyramid_chameleon pyramid_chameleon-0.3/pyramid_chameleon.egg-info/SOURCES.txt0000664000175000017500000000215412354572065024703 0ustar chrismchrism00000000000000.gitignore CHANGES.txt CONTRIBUTORS.txt COPYRIGHT.txt LICENSE.txt README.rst rtd.txt setup.cfg setup.py tox.ini docs/.gitignore docs/Makefile docs/api.rst docs/conf.py docs/glossary.rst docs/index.rst docs/.static/logo_hi.gif docs/.static/repoze.css pyramid_chameleon/__init__.py pyramid_chameleon/interfaces.py pyramid_chameleon/localization.py pyramid_chameleon/renderer.py pyramid_chameleon/text.py pyramid_chameleon/zpt.py pyramid_chameleon.egg-info/PKG-INFO pyramid_chameleon.egg-info/SOURCES.txt pyramid_chameleon.egg-info/dependency_links.txt pyramid_chameleon.egg-info/entry_points.txt pyramid_chameleon.egg-info/not-zip-safe pyramid_chameleon.egg-info/requires.txt pyramid_chameleon.egg-info/top_level.txt pyramid_chameleon/tests/__init__.py pyramid_chameleon/tests/test_localization.py pyramid_chameleon/tests/test_renderers.py pyramid_chameleon/tests/test_text.py pyramid_chameleon/tests/test_zpt.py pyramid_chameleon/tests/fixtures/minimal.pt pyramid_chameleon/tests/fixtures/minimal.txt pyramid_chameleon/tests/fixtures/nonminimal.txt pyramid_chameleon/tests/fixtures/pp.pt pyramid_chameleon/tests/fixtures/withmacro.ptpyramid_chameleon-0.3/pyramid_chameleon.egg-info/requires.txt0000664000175000017500000000015212354572062025410 0ustar chrismchrism00000000000000pyramid Chameleon [docs] Sphinx docutils repoze.sphinx.autointerface [testing] nose coverage virtualenv pyramid_chameleon-0.3/PKG-INFO0000664000175000017500000000342712354572066016747 0ustar chrismchrism00000000000000Metadata-Version: 1.1 Name: pyramid_chameleon Version: 0.3 Summary: pyramid_chameleon Home-page: https://github.com/Pylons/pyramid_chameleon Author: reed@koansys.com, Pylons & Pyramid community Author-email: pylons-discuss@googlegroups.com License: BSD-derived (http://www.repoze.org/LICENSE.txt) Description: Chameleon templating system Bindings for Pyramid ================================================= These are bindings for the `Chameleon templating system `_ for the Pyramid_ web framework. See http://docs.pylonsproject.org/projects/pyramid_chameleon/en/latest/ for documentation. .. _Pyramid: http://pylonsproject.org/ 0.3 (2014-07-01) ---------------- - Remove dependency on ``pyramid.interfaces.ITemplateRenderer`` (which is deprecated in Pyramid > 1.5). - Update Trove classifiers and tests to support Python 3.4. 0.2 (2014-02-09) ---------------- - Dropped dependency on ``nose-selecttests``. 0.1 (2013-09-07) ---------------- - Initial version Platform: UNKNOWN Classifier: Programming Language :: Python Classifier: Framework :: Pylons Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Intended Audience :: Developers Classifier: License :: Repoze Public License Classifier: Topic :: Text Processing :: Markup :: XML Classifier: Topic :: Text Processing :: Markup :: HTML pyramid_chameleon-0.3/COPYRIGHT.txt0000664000175000017500000000015212212557166017750 0ustar chrismchrism00000000000000Copyright (c) 2013 Pylons Project and Contributors. , All Rights Reserved pyramid_chameleon-0.3/docs/0000775000175000017500000000000012354572066016574 5ustar chrismchrism00000000000000pyramid_chameleon-0.3/docs/index.rst0000664000175000017500000005445312354565400020442 0ustar chrismchrism00000000000000================= pyramid_chameleon ================= Overview ======== :mod:`pyramid_chameleon` is a set of bindings that make templates written for the :term:`Chameleon` templating system work under the Pyramid web framework. Installation ============ Install using setuptools, e.g. (within a virtualenv):: $ $myvenv/bin/easy_install pyramid_chameleon Setup ===== There are several ways to make sure that :mod:`pyramid_chameleon` is active. They are completely equivalent: #) Add pyramid_chameleon to the `pyramid.includes` section of your applications main configuration section:: [app:main] ... pyramid.includes = pyramid_chameleon #) Use the ``includeme`` function via ``config.include``:: config.include('pyramid_chameleon') Once activated, files with the ``.pt`` extension are considered to be :term:`Chameleon` templates. .. _using_chameleon_templates: Using Chameleon Templates ========================= Once :mod:`pyramid_chameleon` been activated ``.pt`` templates can be loaded either by looking up names that would be found on the :term:`Chameleon` search path or by looking up an absolute asset specification (see :ref:`asset_specifications` for more information). Quick example 1. Look up a template named ``foo.pt`` within the ``templates`` directory of a Python package named ``mypackage``: .. code-block:: python :linenos: @view_config(renderer="mypackage:templates/foo.pt) def sample_view(request): return {'foo':1, 'bar':2} Quick example 2. Look up a template named ``foo.pt`` within the ``templates`` directory of the "current" Python package (the package in which this Python code is defined): .. code-block:: python :linenos: @view_config(renderer="templates/foo.pt) def sample_view(request): return {'foo':1, 'bar':2} Quick example 3: manufacturing a response object using the result of :func:`~pyramid.renderers.render` (a string) using a Chameleon template: .. code-block:: python :linenos: from pyramid.renderers import render from pyramid.response import Response def sample_view(request): result = render('mypackage:templates/foo.pt', {'foo':1, 'bar':2}, request=request) response = Response(result) response.content_type = 'text/plain' return response Here's an example view configuration which uses a Chameleon ZPT renderer registered imperatively: .. code-block:: python :linenos: # config is an instance of pyramid.config.Configurator config.add_view('myproject.views.sample_view', renderer='myproject:templates/foo.pt') Here's an example view configuration which uses a Chameleon text renderer registered imperatively: .. code-block:: python :linenos: config.add_view('myproject.views.sample_view', renderer='myproject:templates/foo.txt') .. _chameleon_zpt_templates: Chameleon ZPT Templates ----------------------- :term:`Chameleon` is an implementation of :term:`ZPT` (Zope Page Templates) templating language. The Chameleon engine complies largely with the `Zope Page Template `_ template specification. However, it is significantly faster than the default implementation that is represented by ``zope.pagetemplates``. The language definition documentation for Chameleon ZPT-style templates is available from `the Chameleon website `_. Given a :term:`Chameleon` ZPT template named ``foo.pt`` in a directory in your application named ``templates``, you can render the template as a :term:`renderer` like so: .. code-block:: python :linenos: from pyramid.view import view_config @view_config(renderer='templates/foo.pt') def my_view(request): return {'foo':1, 'bar':2} Two built-in renderers exist for :term:`Chameleon` templates. If the ``renderer`` parameter of a view configuration is an absolute path, a relative path or :term:`asset specification` which has a final path element with a filename extension of ``.pt``, the Chameleon ZPT renderer is used. If the extension is ``.txt``, the :term:`Chameleon` text renderer is used. The behavior of these renderers is the same, except for the engine used to render the template. When a Chameleon renderer is used in a view configuration, the view must return a :term:`Response` object or a Python *dictionary*. If the view callable with an associated template returns a Python dictionary, the named template will be passed the dictionary as its keyword arguments, and the template renderer implementation will return the resulting rendered template in a response to the user. If the view callable returns anything but a Response object or a dictionary, an error will be raised. Before passing keywords to the template, the keyword arguments derived from the dictionary returned by the view are augmented. The callable object -- whatever object was used to define the view -- will be automatically inserted into the set of keyword arguments passed to the template as the ``view`` keyword. If the view callable was a class, the ``view`` keyword will be an instance of that class. Also inserted into the keywords passed to the template are ``renderer_name`` (the string used in the ``renderer`` attribute of the directive), ``renderer_info`` (an object containing renderer-related information), ``context`` (the context resource of the view used to render the template), and ``request`` (the request passed to the view used to render the template). ``request`` is also available as ``req`` in Pyramid 1.3+. .. index:: single: ZPT template (sample) A Sample ZPT Template ~~~~~~~~~~~~~~~~~~~~~ Here's what a simple :term:`Chameleon` ZPT template used under :app:`Pyramid` might look like: .. code-block:: xml :linenos: ${project} Application

Welcome to ${project}, an application generated by the pyramid web application framework.

Note the use of :term:`Mako` and/or :term:`Genshi` -style ``${replacements}`` above. This is one of the ways that :term:`Chameleon` ZPT differs from standard ZPT. The above template expects to find a ``project`` key in the set of keywords passed in to it via :func:`~pyramid.renderers.render` or :func:`~pyramid.renderers.render_to_response`. Typical ZPT attribute-based syntax (e.g. ``tal:content`` and ``tal:replace``) also works in these templates. .. index:: single: ZPT macros single: Chameleon ZPT macros Using ZPT Macros in Pyramid ~~~~~~~~~~~~~~~~~~~~~~~~~~~ When a :term:`renderer` is used to render a template, :app:`Pyramid` makes at least two top-level names available to the template by default: ``context`` and ``request``. One of the common needs in ZPT-based templates is to use one template's "macros" from within a different template. In Zope, this is typically handled by retrieving the template from the ``context``. But the context in :app:`Pyramid` is a :term:`resource` object, and templates cannot usually be retrieved from resources. To use macros in :app:`Pyramid`, you need to make the macro template itself available to the rendered template by passing the macro template, or even the macro itself, *into* the rendered template. To do this you can use the :func:`pyramid.renderers.get_renderer` API to retrieve the macro template, and pass it into the template being rendered via the dictionary returned by the view. For example, using a :term:`view configuration` via a :class:`~pyramid.view.view_config` decorator that uses a :term:`renderer`: .. code-block:: python :linenos: from pyramid.renderers import get_renderer from pyramid.view import view_config @view_config(renderer='templates/mytemplate.pt') def my_view(request): main = get_renderer('templates/master.pt').implementation() return {'main':main} Where ``templates/master.pt`` might look like so: .. code-block:: xml :linenos:

Hello Fred!

And ``templates/mytemplate.pt`` might look like so: .. code-block:: xml :linenos: Chris .. index:: single: Chameleon text templates .. _chameleon_text_templates: Chameleon Text Templates ------------------------ :mod:`pyramid_chameleon` also allows for the use of templates which are composed entirely of non-XML text via :term:`Chameleon`. To do so, you can create templates that are entirely composed of text except for ``${name}`` -style substitution points. Here's an example usage of a Chameleon text template. Create a file on disk named ``mytemplate.txt`` in your project's ``templates`` directory with the following contents: .. code-block:: text Hello, ${name}! Then in your project's ``views.py`` module, you can create a view which renders this template: .. code-block:: python :linenos: from pyramid.view import view_config @view_config(renderer='templates/mytemplate.txt') def my_view(request): return {'name':'world'} When the template is rendered, it will show: .. code-block:: text Hello, world! If you'd rather use templates directly within a view callable (without the indirection of using ``renderer`` in view configuration), see the functions in :mod:`pyramid.renderers` for APIs which allow you to render templates imperatively. Template Variables provided by Pyramid -------------------------------------- Pyramid by default will provide a set of variables that are available within your templates, please see :ref:`renderer_system_values` for more information about those variables. Using A Chameleon Macro Name Within a Renderer Name --------------------------------------------------- At times, you may want to render a macro inside of a Chameleon ZPT template instead of the full Chameleon ZPT template. To render the content of a ``define-macro`` field inside a Chameleon ZPT template, given a Chameleon template file named ``foo.pt`` and a macro named ``bar`` defined within it (e.g. ``
...
``), you can configure the template as a :term:`renderer` like so: .. code-block:: python :linenos: from pyramid.view import view_config @view_config(renderer='foo#bar.pt') def my_view(request): return {'project':'my project'} The above will render only the ``bar`` macro defined within the ``foo.pt`` template instead of the entire template. .. index:: single: template renderer side effects Side Effects of Rendering a Chameleon Template ---------------------------------------------- When a Chameleon template is rendered from a file, the templating engine writes a file in the same directory as the template file itself as a kind of cache, in order to do less work the next time the template needs to be read from disk. If you see "strange" ``.py`` files showing up in your ``templates`` directory (or otherwise directly "next" to your templates), it is due to this feature. If you're using a version control system such as Subversion, you should configure it to ignore these files. Here's the contents of the author's ``svn propedit svn:ignore .`` in each of my ``templates`` directories. .. code-block:: text *.pt.py *.txt.py Note that I always name my Chameleon ZPT template files with a ``.pt`` extension and my Chameleon text template files with a ``.txt`` extension so that these ``svn:ignore`` patterns work. .. index:: pair: debugging; templates .. _debug_templates_section: Nicer Exceptions in Chameleon Templates --------------------------------------- The exceptions raised by Chameleon templates when a rendering fails are sometimes less than helpful. :app:`Pyramid` allows you to configure your application development environment so that exceptions generated by Chameleon during template compilation and execution will contain nicer debugging information. .. warning:: Template-debugging behavior is not recommended for production sites as it slows renderings; it's usually only desirable during development. In order to turn on template exception debugging, you can use an environment variable setting or a configuration file setting. To use an environment variable, start your application under a shell using the ``PYRAMID_DEBUG_TEMPLATES`` operating system environment variable set to ``1``, For example: .. code-block:: text $ PYRAMID_DEBUG_TEMPLATES=1 bin/pserve myproject.ini To use a setting in the application ``.ini`` file for the same purpose, set the ``pyramid.debug_templates`` key to ``true`` within the application's configuration section, e.g.: .. code-block:: ini :linenos: [app:main] use = egg:MyProject pyramid.debug_templates = true With template debugging off, a :exc:`NameError` exception resulting from rendering a template with an undefined variable (e.g. ``${wrong}``) might end like this: .. code-block:: text File "...", in __getitem__ raise NameError(key) NameError: wrong Note that the exception has no information about which template was being rendered when the error occured. But with template debugging on, an exception resulting from the same problem might end like so: .. code-block:: text RuntimeError: Caught exception rendering template. - Expression: ``wrong`` - Filename: /home/fred/env/proj/proj/templates/mytemplate.pt - Arguments: renderer_name: proj:templates/mytemplate.pt template: xincludes: request: project: proj macros: context: view: NameError: wrong The latter tells you which template the error occurred in, as well as displaying the arguments passed to the template itself. .. note:: Turning on ``pyramid.debug_templates`` has the same effect as using the Chameleon environment variable ``CHAMELEON_DEBUG``. See `Chameleon Environment Variables `_ for more information. .. index:: single: automatic reloading of templates single: template automatic reload .. _reload_templates_section: Automatically Reloading Templates --------------------------------- It's often convenient to see changes you make to a template file appear immediately without needing to restart the application process. :app:`Pyramid` allows you to configure your application development environment so that a change to a template will be automatically detected, and the template will be reloaded on the next rendering. .. warning:: Auto-template-reload behavior is not recommended for production sites as it slows rendering slightly; it's usually only desirable during development. In order to turn on automatic reloading of templates, you can use an environment variable, or a configuration file setting. To use an environment variable, start your application under a shell using the ``PYRAMID_RELOAD_TEMPLATES`` operating system environment variable set to ``1``, For example: .. code-block:: text $ PYRAMID_RELOAD_TEMPLATES=1 bin/pserve myproject.ini To use a setting in the application ``.ini`` file for the same purpose, set the ``pyramid.reload_templates`` key to ``true`` within the application's configuration section, e.g.: .. code-block:: ini :linenos: [app:main] use = egg:MyProject pyramid.reload_templates = true Settings -------- Chameleon derives additional settings to configure its template renderer. Many of these settings are optional and only need to be set if they should be different from the default. The below values can be present in the ``.ini`` file used to configure the Pyramid application (in the ``app`` section representing your Pyramid app) or they can be passed directly within the ``settings`` argument passed to a Pyramid Configurator. ``pyramid.reload_templates`` ``true`` or ``false`` representing whether Chameleon templates should be reloaded when they change on disk. Useful for development to be ``true``. ``pyramid.debug_templates`` ``true`` or ``false`` representing whether Chameleon templates should be have extra debugging info turned on in tracebacks it generates. Changing the Content-Type of a Chameleon-Renderered Response ------------------------------------------------------------ Here's an example of changing the content-type and status of the response object returned by a Chameleon-rendered Pyramid view: .. code-block:: python :linenos: @view_config(renderer='foo.pt') def sample_view(request): request.response.content_type = 'text/plain' response.status_int = 204 return response See :ref:`request_response_attr` for more information. .. index:: single: template internationalization single: internationalization (of templates) Chameleon Template Internationalization --------------------------------------- Chameleon supports internationalized units of text by reusing the translation facilities provided within Pyramid. See :ref:`i18n_chapter` for a general description of these facilities. Translating Template Content ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You need to add a few boilerplate lines to your application's ``setup.py`` file in order to properly generate :term:`gettext` files from your application's templates. .. note:: See :ref:`project_narr` to learn about the composition of an application's ``setup.py`` file. In particular, add the ``Babel`` and ``lingua`` distributions to the ``install_requires`` list and insert a set of references to :term:`Babel` *message extractors* within the call to :func:`setuptools.setup` inside your application's ``setup.py`` file: .. code-block:: python :linenos: setup(name="mypackage", # ... install_requires = [ # ... 'Babel', 'lingua', ], message_extractors = { '.': [ ('**.py', 'lingua_python', None ), ('**.pt', 'lingua_xml', None ), ]}, ) The ``message_extractors`` stanza placed into the ``setup.py`` file causes the Babel message catalog extraction machinery to also consider ``*.pt`` files when doing message id extraction. Once this is done you can generate ``.pot`` files derived from your Chameleon templates (and Python code). See :ref:`extracting_messages` in the Pyramid documentation for general information about this. Chameleon Template Support for Translation Strings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When a Pyramid "translation string" (see :ref:`i18n_chapter`) is used as the subject of textual rendering by a ``pyramid_chameleon`` template renderer, it will automatically be translated to the requesting user's language if a suitable translation exists. This is true of both the ZPT and text variants of the Chameleon template renderers. For example, in a Chameleon ZPT template, the translation string represented by "some_translation_string" in each example below will go through translation before being rendered: .. code-block:: xml :linenos: .. code-block:: xml :linenos: .. code-block:: xml :linenos: ${some_translation_string} .. code-block:: xml :linenos: Click here The features represented by attributes of the ``i18n`` namespace of Chameleon will also consult the :app:`Pyramid` translations. See `http://chameleon.repoze.org/docs/latest/i18n.html#the-i18n-namespace `_. .. note:: Unlike when Chameleon is used outside of :app:`Pyramid`, when it is used *within* :app:`Pyramid`, it does not support use of the ``zope.i18n`` translation framework. Applications which use :app:`Pyramid` should use the features documented in this chapter rather than ``zope.i18n``. You can always disuse this automatic translation and perform a more manual translation as described in :ref:`performing_a_translation`. Unit Testing ------------ When you are running unit tests, you will be required to use ``config.include('pyramid_chameleon')`` to add ``pyramid_chameleon`` so that its renderers are added to the config and can be used.:: from pyramid import testing from pyramid.response import Response from pyramid.renderers import render # The view we want to test def some_view(request): return Response(render('mypkg:templates/home.pt', {'var': 'testing'})) class TestViews(unittest.TestCase): def setUp(self): self.config = testing.setUp() self.config.include('pyramid_chameleon') def tearDown(self): testing.tearDown() def test_some_view(self): from pyramid.testing import DummyRequest request = DummyRequest() response = some_view(request) # templates/home.pt starts with the standard tag for HTML5 self.assertTrue('>>ԾԾտѻԿLKIԶľBBA@@?|||??>AAAȼEEEHGEڷcccյųMMM˽͸̾vur@??YYYxCCCþihc:::ӽ!,3 H*\ȰÇ#JHŋ3jȱdžIrCȲ˅.ȜI^F͟?ѬIhE*XMJu! j%D. MjJ?_Ŗ@D|"݅t['Y EHG8._7CW"7)Tv'r֦+RcN+'n c ZMd#g׎9f _HrA\FSAUR`rMq`E"Wҥ&7ĄB5BU t fM?~O?5WGՂ|,ȢC4D54Xc8+pA , 9$ C- Cy  & E(q0 t$ ܴf(D.@>yXM4+ 7H‚JhTBE BZ0'@YN16tQbP X*:ab lTåuQf jJ dBDNC tP<P _PPRlpʴ ;D2$$aQCk72/Dx0(g& J#̐A:r AD!8(a 8žT4΃»@ 3(h.@B氽T@L;|B١sC@khQ:QęCt 0`=GJX-W|A !,@3zrasA rnqRh2[K\ Djئ<9E*Z8p@!p.n B x| ՐtS%=a,$`h %@A'6xB †) 6x;50bLPxF+90bA00)4l#QC-D&lp}PGvG<ڠ'cC!u!,._h ZN_a $ @Ҏ+P2R(ՇMosP/`qg.b Ed_ D 2,%vvm!^+P/yz"<S?yH€WPR C4;@`b9-@_0jj`!`\8lyxw WH0 `cPaQ 0$ W}GJ l   aCЍpqQ@PA dvyGP pYP E" (P{ 0@@ 1 F@d s @ 900) ٟ ;pyramid_chameleon-0.3/docs/.static/repoze.css0000664000175000017500000000057212212266270022151 0ustar chrismchrism00000000000000@import url('default.css'); body { background-color: #006339; } div.document { background-color: #dad3bd; } div.sphinxsidebar h3, h4, h5, a { color: #127c56 !important; } div.related { color: #dad3bd !important; background-color: #00744a; } div.related a { color: #dad3bd !important; } div.body p, div.body dd, div.body li { text-align: left; } pyramid_chameleon-0.3/docs/conf.py0000664000175000017500000001731012354571321020066 0ustar chrismchrism00000000000000# -*- coding: utf-8 -*- # # pyramid_chameleon documentation build configuration file # # This file is execfile()d with the current directory set to its containing # dir. # # The contents of this file are pickled, so don't put values in the # namespace that aren't pickleable (module imports are okay, they're # removed automatically). # # All configuration values have a default value; values that are commented # out serve to show the default value. # If your extensions are in another directory, add it here. If the # directory is relative to the documentation root, use os.path.abspath to # make it absolute, like shown here. #sys.path.append(os.path.abspath('some/directory')) import datetime import sys import os import pkg_resources from docutils import nodes from docutils import utils # Add and use Pylons theme if 'sphinx-build' in ' '.join(sys.argv): # protect against dumb importers from subprocess import call, Popen, PIPE p = Popen('which git', shell=True, stdout=PIPE) git = p.stdout.read().strip() cwd = os.getcwd() _themes = os.path.join(cwd, '_themes') if not os.path.isdir(_themes): call([git, 'clone', 'git://github.com/Pylons/pylons_sphinx_theme.git', '_themes']) else: os.chdir(_themes) call([git, 'checkout', 'master']) call([git, 'pull']) os.chdir(cwd) sys.path.append(os.path.abspath('_themes')) parent = os.path.dirname(os.path.dirname(__file__)) sys.path.append(os.path.abspath(parent)) wd = os.getcwd() os.chdir(parent) os.system('%s setup.py test -q' % sys.executable) os.chdir(wd) for item in os.listdir(parent): if item.endswith('.egg'): sys.path.append(os.path.join(parent, item)) # General configuration # --------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'repoze.sphinx.autointerface' ] # Looks for pyramid's objects intersphinx_mapping = { 'pyramid': ('http://docs.pylonsproject.org/projects/pyramid/en/latest/', None)} # Add any paths that contain templates here, relative to this directory. templates_path = ['.templates'] # The suffix of source filenames. source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General substitutions. project = 'pyramid_chameleon: Chameleon Bindings for the Pyramid Web Framework' copyright = '2011-%s, Pylons Project' % datetime.datetime.now().year # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. # # The short X.Y version. version = pkg_resources.get_distribution('pyramid_chameleon').version # The full version, including alpha/beta/rc tags. release = version # There are two options for replacing |today|: either, you set today to # some non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. #unused_docs = [] # List of directories, relative to source directories, that shouldn't be # searched for source files. #exclude_dirs = [] exclude_patterns = ['_themes/README.rst',] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. #pygments_style = 'sphinx' # Options for HTML output # ----------------------- # Add and use Pylons theme sys.path.append(os.path.abspath('_themes')) html_theme_path = ['_themes'] html_theme = 'pyramid' html_theme_options = { 'github_url': 'https://github.com/Pylons/pyramid_chameleon' } # The style sheet to use for HTML and HTML Help pages. A file of that name # must exist either in Sphinx' static/ path, or in one of the custom paths # given in html_static_path. # html_style = 'repoze.css' # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as # html_title. #html_short_title = None # The name of an image file (within the static path) to place at the top of # the sidebar. # html_logo = '.static/logo_hi.gif' # The name of an image file (within the static path) to use as favicon of # the docs. This file should be a Windows icon file (.ico) being 16x16 or # 32x32 pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) # here, relative to this directory. They are copied after the builtin # static files, so a file named "default.css" will overwrite the builtin # "default.css". #html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page # bottom, using the given strftime format. html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_use_modindex = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, the reST sources are included in the HTML build as # _sources/. #html_copy_source = True # If true, an OpenSearch description file will be output, and all pages # will contain a tag referring to it. The value of this option must # be the base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'atemplatedoc' # Options for LaTeX output # ------------------------ # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, document class [howto/manual]). latex_documents = [ ('index', 'pyramid_chameleon.tex', 'pyramid_chameleon Documentation', 'Repoze Developers', 'manual'), ] # The name of an image file (relative to this directory) to place at the # top of the title page. latex_logo = '.static/logo_hi.gif' # For "manual" documents, if this is true, then toplevel headings are # parts, not chapters. #latex_use_parts = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True def app_role(role, rawtext, text, lineno, inliner, options={}, content=[]): """custom role for :app: marker, does nothing in particular except allow :app:`Pyramid` to work (for later search and replace).""" if 'class' in options: assert 'classes' not in options options['classes'] = options['class'] del options['class'] return [nodes.inline(rawtext, utils.unescape(text), **options)], [] def setup(app): app.add_role('app', app_role) pyramid_chameleon-0.3/docs/api.rst0000664000175000017500000000047512212266270020073 0ustar chrismchrism00000000000000.. _pyramid_chameleon_api: :mod:`pyramid_chameleon` API ---------------------------- .. automodule:: pyramid_chameleon .. autofunction:: includeme .. automodule:: pyramid_chameleon.interfaces .. autointerface:: IChameleonLookup .. autointerface:: IChameleonTranslate .. automodule:: pyramid_chameleon.renderer pyramid_chameleon-0.3/docs/Makefile0000664000175000017500000000521412212570251020221 0ustar chrismchrism00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = -W SPHINXBUILD = sphinx-build PAPER = # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html web pickle htmlhelp latex changes linkcheck help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " pickle to make pickle files (usable by e.g. sphinx-web)" @echo " htmlhelp to make HTML files and a HTML help project" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " changes to make an overview over all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" clean: -rm -rf _build/* html: mkdir -p _build/html _build/doctrees $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html @echo @echo "Build finished. The HTML pages are in _build/html." text: mkdir -p _build/text _build/doctrees $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) _build/text @echo @echo "Build finished. The HTML pages are in _build/text." pickle: mkdir -p _build/pickle _build/doctrees $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle @echo @echo "Build finished; now you can process the pickle files or run" @echo " sphinx-web _build/pickle" @echo "to start the sphinx-web server." web: pickle htmlhelp: mkdir -p _build/htmlhelp _build/doctrees $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in _build/htmlhelp." latex: mkdir -p _build/latex _build/doctrees $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex cp _static/*.png _build/latex ./convert_images.sh cp _static/latex-warning.png _build/latex cp _static/latex-note.png _build/latex @echo @echo "Build finished; the LaTeX files are in _build/latex." @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." changes: mkdir -p _build/changes _build/doctrees $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes @echo @echo "The overview file is in _build/changes." linkcheck: mkdir -p _build/linkcheck _build/doctrees $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in _build/linkcheck/output.txt." epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) _build/epub @echo @echo "Build finished. The epub file is in _build/epub." pyramid_chameleon-0.3/docs/.gitignore0000664000175000017500000000002112212266270020543 0ustar chrismchrism00000000000000_themes/ _build/ pyramid_chameleon-0.3/setup.cfg0000664000175000017500000000050412354572066017464 0ustar chrismchrism00000000000000[easy_install] zip_ok = false [nosetests] match = ^test where = pyramid_chameleon nocapture = 1 cover-package = pyramid_chameleon cover-erase = 1 [aliases] dev = develop easy_install pyramid_chameleon[testing] docs = develop easy_install pyramid_chameleon[docs] [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 pyramid_chameleon-0.3/CONTRIBUTORS.txt0000664000175000017500000001172112212536404020331 0ustar chrismchrism00000000000000Pylons Project Contributor Agreement ==================================== The submitter agrees by adding his or her name within the section below named "Contributors" and submitting the resulting modified document to the canonical shared repository location for this software project (whether directly, as a user with "direct commit access", or via a "pull request"), he or she is signing a contract electronically. The submitter becomes a Contributor after a) he or she signs this document by adding their name beneath the "Contributors" section below, and b) the resulting document is accepted into the canonical version control repository. Treatment of Account --------------------- Contributor will not allow anyone other than the Contributor to use his or her username or source repository login to submit code to a Pylons Project source repository. Should Contributor become aware of any such use, Contributor will immediately by notifying Agendaless Consulting. Notification must be performed by sending an email to webmaster@agendaless.com. Until such notice is received, Contributor will be presumed to have taken all actions made through Contributor's account. If the Contributor has direct commit access, Agendaless Consulting will have complete control and discretion over capabilities assigned to Contributor's account, and may disable Contributor's account for any reason at any time. Legal Effect of Contribution ---------------------------- Upon submitting a change or new work to a Pylons Project source Repository (a "Contribution"), you agree to assign, and hereby do assign, a one-half interest of all right, title and interest in and to copyright and other intellectual property rights with respect to your new and original portions of the Contribution to Agendaless Consulting. You and Agendaless Consulting each agree that the other shall be free to exercise any and all exclusive rights in and to the Contribution, without accounting to one another, including without limitation, the right to license the Contribution to others under the Repoze Public License. This agreement shall run with title to the Contribution. Agendaless Consulting does not convey to you any right, title or interest in or to the Program or such portions of the Contribution that were taken from the Program. Your transmission of a submission to the Pylons Project source Repository and marks of identification concerning the Contribution itself constitute your intent to contribute and your assignment of the work in accordance with the provisions of this Agreement. License Terms ------------- Code committed to the Pylons Project source repository (Committed Code) must be governed by the Repoze Public License (http://repoze.org/LICENSE.txt, aka "the RPL") or another license acceptable to Agendaless Consulting. Until Agendaless Consulting declares in writing an acceptable license other than the RPL, only the RPL shall be used. A list of exceptions is detailed within the "Licensing Exceptions" section of this document, if one exists. Representations, Warranty, and Indemnification ---------------------------------------------- Contributor represents and warrants that the Committed Code does not violate the rights of any person or entity, and that the Contributor has legal authority to enter into this Agreement and legal authority over Contributed Code. Further, Contributor indemnifies Agendaless Consulting against violations. Cryptography ------------ Contributor understands that cryptographic code may be subject to government regulations with which Agendaless Consulting and/or entities using Committed Code must comply. Any code which contains any of the items listed below must not be checked-in until Agendaless Consulting staff has been notified and has approved such contribution in writing. - Cryptographic capabilities or features - Calls to cryptographic features - User interface elements which provide context relating to cryptography - Code which may, under casual inspection, appear to be cryptographic. Notices ------- Contributor confirms that any notices required will be included in any Committed Code. Licensing Exceptions ==================== Code committed within the ``docs/`` subdirectory of the Pyramid source control repository and "docstrings" which appear in the documentation generated by runnning "make" within this directory is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License (http://creativecommons.org/licenses/by-nc-sa/3.0/us/). List of Contributors ==================== The below-signed are contributors to a code repository that is part of the project named "pyramid_jinja2". Each below-signed contributor has read, understand and agrees to the terms above in the section within this document entitled "Pylons Project Contributor Agreement" as of the date beside his or her name. Contributors ------------ Chris McDonough, 2010/11/08 Tres Seaver, 2010/11/09 Blaise Laflamme, 2010/11/14 Reed O'Brien, 2012/03/12 Bert JW Regeer, 2013-09-06 pyramid_chameleon-0.3/setup.py0000664000175000017500000000333712354571756017371 0ustar chrismchrism00000000000000import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.rst')).read() CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() requires = [ 'pyramid', 'Chameleon', ] docs_extras = [ 'Sphinx', 'docutils', 'repoze.sphinx.autointerface', ] testing_extras = [ 'nose', 'coverage', 'virtualenv', # for scaffolding tests ] setup(name='pyramid_chameleon', version='0.3', description='pyramid_chameleon', long_description=README + '\n\n' + CHANGES, classifiers=[ "Programming Language :: Python", "Framework :: Pylons", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Intended Audience :: Developers", "License :: Repoze Public License", "Topic :: Text Processing :: Markup :: XML", "Topic :: Text Processing :: Markup :: HTML", ], author="reed@koansys.com, Pylons & Pyramid community", author_email="pylons-discuss@googlegroups.com", url="https://github.com/Pylons/pyramid_chameleon", license="BSD-derived (http://www.repoze.org/LICENSE.txt)", packages=find_packages(), include_package_data=True, zip_safe=False, install_requires=requires, tests_require=requires, extras_require = { 'testing':testing_extras, 'docs':docs_extras, }, test_suite="pyramid_chameleon", entry_points="""\ """, ) pyramid_chameleon-0.3/tox.ini0000664000175000017500000000126312354571473017162 0ustar chrismchrism00000000000000[tox] envlist = py26,py27,py32,py33,py34,pypy,cover,docs [testenv] commands = python setup.py dev python setup.py test -q [testenv:cover] basepython = python2.6 commands = python setup.py dev python setup.py nosetests --with-xunit --with-xcoverage deps = nosexcover [testenv:docs] basepython = python2.7 commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html deps = Sphinx repoze.sphinx.autointerface # we separate coverage into its own testenv because a) "last run wins" wrt # cobertura jenkins reporting and b) pypy and jython can't handle any # combination of versions of coverage and nosexcover that i can find. pyramid_chameleon-0.3/pyramid_chameleon/0000775000175000017500000000000012354572066021324 5ustar chrismchrism00000000000000pyramid_chameleon-0.3/pyramid_chameleon/text.py0000664000175000017500000000236712354571044022665 0ustar chrismchrism00000000000000from zope.interface import implementer from pyramid.decorator import reify from pyramid_chameleon import renderer from pyramid_chameleon.interfaces import ITemplateRenderer def renderer_factory(info): return renderer.template_renderer_factory(info, TextTemplateRenderer) @implementer(ITemplateRenderer) class TextTemplateRenderer(object): def __init__(self, path, lookup, macro=None): self.path = path self.lookup = lookup # text template renderers have no macros, so we ignore the # macro arg @reify # avoid looking up reload_templates before manager pushed def template(self): from chameleon.zpt.template import PageTextTemplateFile return PageTextTemplateFile(self.path, auto_reload=self.lookup.auto_reload, debug=self.lookup.debug, translate=self.lookup.translate) def implementation(self): return self.template def __call__(self, value, system): try: system.update(value) except (TypeError, ValueError): raise ValueError('renderer was passed non-dictionary as value') result = self.template(**system) return result pyramid_chameleon-0.3/pyramid_chameleon/renderer.py0000664000175000017500000001160712354571044023504 0ustar chrismchrism00000000000000import os import re import threading import pkg_resources from zope.interface import implementer from pyramid.asset import asset_spec_from_abspath from pyramid.path import ( caller_package, package_path ) from pyramid_chameleon.interfaces import ( IChameleonLookup, IChameleonTranslate, ITemplateRenderer, ) @implementer(IChameleonLookup) class ChameleonRendererLookup(object): spec_re = re.compile( r'(?P[\w_.:/-]+)' r'(?:\#(?P[\w_]+))?' r'(\.(?P.*))' ) def __init__(self, impl, registry): self.impl = impl self.registry = registry self.lock = threading.Lock() def get_spec(self, name, package): if not package: # if there's no package, we can't do any conversion return name spec = name isabspath = os.path.isabs(name) colon_in_name = ':' in name isabsspec = colon_in_name and (not isabspath) isrelspec = (not isabsspec) and (not isabspath) # if it's already an absolute spec, we don't need to do anything, # but if it's a relative spec or an absolute path, we need to try # to convert it to an absolute spec if isrelspec: # convert relative asset spec to absolute asset spec pp = package_path(package) spec = os.path.join(pp, spec) spec = asset_spec_from_abspath(spec, package) elif isabspath: # convert absolute path to absolute asset spec spec = asset_spec_from_abspath(spec, package) return spec @property # wait until completely necessary to look up translator def translate(self): return self.registry.queryUtility(IChameleonTranslate) @property # wait until completely necessary to look up debug_templates def debug(self): settings = self.registry.settings if settings is None: return False return settings.get('debug_templates', False) @property # wait until completely necessary to look up reload_templates def auto_reload(self): settings = self.registry.settings if settings is None: return False return settings.get('reload_templates', False) def _crack_spec(self, spec): asset, macro, ext = self.spec_re.match(spec).group( 'asset', 'defname', 'ext' ) return asset, macro, ext def __call__(self, info): spec = self.get_spec(info.name, info.package) registry = info.registry if os.path.isabs(spec): # 'spec' is an absolute filename if not os.path.exists(spec): raise ValueError('Missing template file: %s' % spec) renderer = registry.queryUtility(ITemplateRenderer, name=spec) if renderer is None: renderer = self.impl(spec, self, macro=None) # cache the template with self.lock: registry.registerUtility(renderer, ITemplateRenderer, name=spec) else: # spec is a package:relpath asset spec renderer = registry.queryUtility(ITemplateRenderer, name=spec) if renderer is None: asset, macro, ext = self._crack_spec(spec) spec_without_macro = '%s.%s' % (asset, ext) try: package_name, filename = spec_without_macro.split(':', 1) except ValueError: # pragma: no cover # somehow we were passed a relative pathname; this # should die package_name = caller_package(4).__name__ filename = spec_without_macro abspath = pkg_resources.resource_filename(package_name, filename) if not pkg_resources.resource_exists(package_name, filename): raise ValueError( 'Missing template asset: %s (%s)' % ( spec_without_macro, abspath) ) renderer = self.impl(abspath, self, macro=macro) settings = info.settings if not settings.get('reload_assets'): # cache the template with self.lock: registry.registerUtility(renderer, ITemplateRenderer, name=spec) return renderer registry_lock = threading.Lock() def template_renderer_factory(info, impl, lock=registry_lock): registry = info.registry lookup = registry.queryUtility(IChameleonLookup, name=info.type) if lookup is None: lookup = ChameleonRendererLookup(impl, registry) with lock: registry.registerUtility(lookup, IChameleonLookup, name=info.type) return lookup(info) pyramid_chameleon-0.3/pyramid_chameleon/__init__.py0000664000175000017500000000052212212565364023430 0ustar chrismchrism00000000000000from . import ( text, zpt, ) def includeme(config): # pragma: no cover """ Adds renderers for .pt and .txt as well as registers Chameleon localization features. """ config.add_renderer('.pt', zpt.renderer_factory) config.add_renderer('.txt', text.renderer_factory) config.include('.localization') pyramid_chameleon-0.3/pyramid_chameleon/interfaces.py0000664000175000017500000000203512354571044024014 0ustar chrismchrism00000000000000from zope.interface import ( Attribute, Interface, ) from pyramid.interfaces import IRenderer class IChameleonLookup(Interface): translate = Attribute('IChameleonTranslate object') debug = Attribute('The ``debug_templates`` setting for this application') auto_reload = Attribute('The ``reload_templates`` setting for this app') def __call__(self, info): """ Return an ITemplateRenderer based on IRendererInfo ``info`` """ class IChameleonTranslate(Interface): """ Internal interface representing a chameleon translate function """ def __call__(msgid, domain=None, mapping=None, context=None, target_language=None, default=None): """ Translate a mess of arguments to a Unicode object """ class ITemplateRenderer(IRenderer): def implementation(): """ Return the object that the underlying templating system uses to render the template; it is typically a callable that accepts arbitrary keyword arguments and returns a string or unicode object """ pyramid_chameleon-0.3/pyramid_chameleon/tests/0000775000175000017500000000000012354572066022466 5ustar chrismchrism00000000000000pyramid_chameleon-0.3/pyramid_chameleon/tests/test_zpt.py0000664000175000017500000001457512354571044024723 0ustar chrismchrism00000000000000import sys import unittest from pyramid import testing from pyramid.compat import text_type class Base(object): def setUp(self): self.config = testing.setUp() def tearDown(self): testing.tearDown() def _getTemplatePath(self, name): import os here = os.path.abspath(os.path.dirname(__file__)) return os.path.join(here, 'fixtures', name) class Test_renderer_factory(Base, unittest.TestCase): def _callFUT(self, info): from pyramid_chameleon.zpt import renderer_factory return renderer_factory(info) def test_it(self): # this test is way too functional from pyramid_chameleon.zpt import ZPTTemplateRenderer info = DummyInfo() result = self._callFUT(info) self.assertEqual(result.__class__, ZPTTemplateRenderer) class ZPTTemplateRendererTests(Base, unittest.TestCase): def _getTargetClass(self): from pyramid_chameleon.zpt import ZPTTemplateRenderer return ZPTTemplateRenderer def _makeOne(self, *arg, **kw): klass = self._getTargetClass() return klass(*arg, **kw) def test_instance_implements_ITemplateRenderer(self): from zope.interface.verify import verifyObject from pyramid_chameleon.interfaces import ITemplateRenderer path = self._getTemplatePath('minimal.pt') lookup = DummyLookup() verifyObject(ITemplateRenderer, self._makeOne(path, lookup)) def test_class_implements_ITemplateRenderer(self): from zope.interface.verify import verifyClass from pyramid_chameleon.interfaces import ITemplateRenderer verifyClass(ITemplateRenderer, self._getTargetClass()) def test_call(self): minimal = self._getTemplatePath('minimal.pt') lookup = DummyLookup() instance = self._makeOne(minimal, lookup) result = instance({}, {}) self.assertTrue(isinstance(result, text_type)) self.assertEqual(result.rstrip('\n'), '
\n
') def test_template_reified(self): minimal = self._getTemplatePath('minimal.pt') lookup = DummyLookup() instance = self._makeOne(minimal, lookup) self.assertFalse('template' in instance.__dict__) template = instance.template self.assertEqual(template, instance.__dict__['template']) def test_template_with_ichameleon_translate(self): minimal = self._getTemplatePath('minimal.pt') lookup = DummyLookup() instance = self._makeOne(minimal, lookup) self.assertFalse('template' in instance.__dict__) template = instance.template self.assertEqual(template.translate, lookup.translate) def test_template_with_debug_templates(self): minimal = self._getTemplatePath('minimal.pt') lookup = DummyLookup() lookup.debug = True instance = self._makeOne(minimal, lookup) self.assertFalse('template' in instance.__dict__) template = instance.template self.assertEqual(template.debug, True) def test_template_without_debug_templates(self): minimal = self._getTemplatePath('minimal.pt') lookup = DummyLookup() lookup.debug = False instance = self._makeOne(minimal, lookup) self.assertFalse('template' in instance.__dict__) template = instance.template self.assertEqual(template.debug, False) def test_template_with_reload_templates(self): minimal = self._getTemplatePath('minimal.pt') lookup = DummyLookup() lookup.auto_reload = True instance = self._makeOne(minimal, lookup) self.assertFalse('template' in instance.__dict__) template = instance.template self.assertEqual(template.auto_reload, True) def test_template_without_reload_templates(self): minimal = self._getTemplatePath('minimal.pt') lookup = DummyLookup() lookup.auto_reload = False instance = self._makeOne(minimal, lookup) self.assertFalse('template' in instance.__dict__) template = instance.template self.assertEqual(template.auto_reload, False) def test_call_with_nondict_value(self): minimal = self._getTemplatePath('minimal.pt') lookup = DummyLookup() instance = self._makeOne(minimal, lookup) self.assertRaises(ValueError, instance, None, {}) def test_implementation(self): minimal = self._getTemplatePath('minimal.pt') lookup = DummyLookup() instance = self._makeOne(minimal, lookup) result = instance.implementation()() self.assertTrue(isinstance(result, text_type)) self.assertEqual(result.rstrip('\n'), '
\n
') def test_macro_supplied(self): minimal = self._getTemplatePath('withmacro.pt') lookup = DummyLookup() instance = self._makeOne(minimal, lookup, macro='foo') result = instance.implementation()() self.assertEqual(result, '\n Hello!\n') def test_macro_notsupplied(self): minimal = self._getTemplatePath('withmacro.pt') lookup = DummyLookup() instance = self._makeOne(minimal, lookup) result = instance.implementation()() self.assertEqual(result, '\nOutside macro\n\n Hello!\n\n\n\n') def test_macro_template_reload(self): minimal = self._getTemplatePath('withmacro.pt') lookup = DummyLookup() instance = self._makeOne(minimal, lookup, macro='foo') result = instance.implementation()() self.assertEqual(result, '\n Hello!\n') instance.template.cook( '\nOutside macro\n\n Hello!\n\n\n\n' ) result = instance.implementation()() self.assertEqual(result, '\n Hello!\n') class DummyLookup(object): auto_reload=True debug = True def translate(self, msg): pass class DummyRegistry(object): def queryUtility(self, iface, name): self.queried = iface, name return None def registerUtility(self, impl, iface, name): self.registered = impl, iface, name class DummyInfo(object): def __init__(self): self.registry = DummyRegistry() self.type = '.pt' self.name = 'fixtures/minimal.pt' self.package = sys.modules[__name__] self.settings = {} pyramid_chameleon-0.3/pyramid_chameleon/tests/fixtures/0000775000175000017500000000000012354572066024337 5ustar chrismchrism00000000000000pyramid_chameleon-0.3/pyramid_chameleon/tests/fixtures/nonminimal.txt0000664000175000017500000000002012212266270027217 0ustar chrismchrism00000000000000Hello, ${name}! pyramid_chameleon-0.3/pyramid_chameleon/tests/fixtures/pp.pt0000664000175000017500000000017712212266270025316 0ustar chrismchrism00000000000000

WRAPPED

pyramid_chameleon-0.3/pyramid_chameleon/tests/fixtures/withmacro.pt0000664000175000017500000000011712212266270026666 0ustar chrismchrism00000000000000 Outside macro Hello! pyramid_chameleon-0.3/pyramid_chameleon/tests/fixtures/minimal.pt0000664000175000017500000000014612212266270026321 0ustar chrismchrism00000000000000
pyramid_chameleon-0.3/pyramid_chameleon/tests/fixtures/minimal.txt0000664000175000017500000000000712212266270026511 0ustar chrismchrism00000000000000Hello. pyramid_chameleon-0.3/pyramid_chameleon/tests/test_localization.py0000644000175000017500000000250512212566075026563 0ustar chrismchrism00000000000000import unittest from pyramid import testing class Test_maybe_add_translator(unittest.TestCase): def _callFUT(self, registry): from ..localization import maybe_add_translator return maybe_add_translator(registry) def test_translation_dirs_exist(self): registry = DummyRegistry(None) self._callFUT(registry) self.assertEqual(registry.registered, None) def test_no_translation_dirs(self): registry = DummyRegistry(True) self._callFUT(registry) self.assertTrue(registry.registered) class Test_translator(unittest.TestCase): def setUp(self): from pyramid.request import Request request = Request.blank('/') self.config = testing.setUp(request=request) request.registry = self.config.registry def tearDown(self): testing.tearDown() def _callFUT(self, msg): from ..localization import translator return translator(msg) def test_it(self): result = self._callFUT('foo') self.assertEqual(result, 'foo') class DummyRegistry(object): registered = None def __init__(self, result): self.result = result def queryUtility(self, iface): return self.result def registerUtility(self, impl, iface): self.registered = (impl, iface) pyramid_chameleon-0.3/pyramid_chameleon/tests/__init__.py0000664000175000017500000000001512212266270024561 0ustar chrismchrism00000000000000## a package pyramid_chameleon-0.3/pyramid_chameleon/tests/test_text.py0000664000175000017500000001221312354571044025055 0ustar chrismchrism00000000000000import sys import unittest from pyramid.compat import binary_type from pyramid import testing class Base(object): def setUp(self): self.config = testing.setUp() def tearDown(self): testing.tearDown() def _getTemplatePath(self, name): import os here = os.path.abspath(os.path.dirname(__file__)) return os.path.join(here, 'fixtures', name) class Test_renderer_factory(Base, unittest.TestCase): def _callFUT(self, info): from pyramid_chameleon.text import renderer_factory return renderer_factory(info) def test_it(self): # this test is way too functional from pyramid_chameleon.text import TextTemplateRenderer info = DummyInfo() result = self._callFUT(info) self.assertEqual(result.__class__, TextTemplateRenderer) class TextTemplateRendererTests(Base, unittest.TestCase): def _getTargetClass(self): from pyramid_chameleon.text import TextTemplateRenderer return TextTemplateRenderer def _makeOne(self, *arg, **kw): klass = self._getTargetClass() return klass(*arg, **kw) def test_instance_implements_ITemplateRenderer(self): from zope.interface.verify import verifyObject from pyramid_chameleon.interfaces import ITemplateRenderer path = self._getTemplatePath('minimal.txt') lookup = DummyLookup() verifyObject(ITemplateRenderer, self._makeOne(path, lookup)) def test_class_implements_ITemplateRenderer(self): from zope.interface.verify import verifyClass from pyramid_chameleon.interfaces import ITemplateRenderer verifyClass(ITemplateRenderer, self._getTargetClass()) def test_template_reified(self): minimal = self._getTemplatePath('minimal.txt') lookup = DummyLookup() instance = self._makeOne(minimal, lookup) self.assertFalse('template' in instance.__dict__) template = instance.template self.assertEqual(template, instance.__dict__['template']) def test_template_with_ichameleon_translate(self): minimal = self._getTemplatePath('minimal.txt') lookup = DummyLookup() instance = self._makeOne(minimal, lookup) self.assertFalse('template' in instance.__dict__) template = instance.template self.assertEqual(template.translate, lookup.translate) def test_template_with_debug_templates(self): minimal = self._getTemplatePath('minimal.txt') lookup = DummyLookup() lookup.debug = True instance = self._makeOne(minimal, lookup) self.assertFalse('template' in instance.__dict__) template = instance.template self.assertEqual(template.debug, True) def test_template_with_reload_templates(self): minimal = self._getTemplatePath('minimal.txt') lookup = DummyLookup() lookup.auto_reload = True instance = self._makeOne(minimal, lookup) self.assertFalse('template' in instance.__dict__) template = instance.template self.assertEqual(template.auto_reload, True) def test_template_without_reload_templates(self): minimal = self._getTemplatePath('minimal.txt') lookup = DummyLookup() lookup.auto_reload = False instance = self._makeOne(minimal, lookup) self.assertFalse('template' in instance.__dict__) template = instance.template self.assertEqual(template.auto_reload, False) def test_call(self): minimal = self._getTemplatePath('minimal.txt') lookup = DummyLookup() instance = self._makeOne(minimal, lookup) result = instance({}, {}) self.assertTrue(isinstance(result, binary_type)) self.assertEqual(result, b'Hello.\n') def test_call_with_nondict_value(self): minimal = self._getTemplatePath('minimal.txt') lookup = DummyLookup() instance = self._makeOne(minimal, lookup) self.assertRaises(ValueError, instance, None, {}) def test_call_nonminimal(self): nonminimal = self._getTemplatePath('nonminimal.txt') lookup = DummyLookup() instance = self._makeOne(nonminimal, lookup) result = instance({'name':'Chris'}, {}) self.assertTrue(isinstance(result, binary_type)) self.assertEqual(result, b'Hello, Chris!\n') def test_implementation(self): minimal = self._getTemplatePath('minimal.txt') lookup = DummyLookup() instance = self._makeOne(minimal, lookup) result = instance.implementation()() self.assertTrue(isinstance(result, binary_type)) self.assertEqual(result, b'Hello.\n') class DummyLookup(object): auto_reload=True debug = True def translate(self, msg): pass class DummyRegistry(object): def queryUtility(self, iface, name): self.queried = iface, name return None def registerUtility(self, impl, iface, name): self.registered = impl, iface, name class DummyInfo(object): def __init__(self): self.registry = DummyRegistry() self.type = '.pt' self.name = 'fixtures/minimal.pt' self.package = sys.modules[__name__] self.settings = {} pyramid_chameleon-0.3/pyramid_chameleon/tests/test_renderers.py0000664000175000017500000003256712354571044026100 0ustar chrismchrism00000000000000import unittest from pyramid.testing import cleanUp from pyramid import testing class TestTemplateRendererFactory(unittest.TestCase): def setUp(self): self.config = cleanUp() def tearDown(self): cleanUp() def _callFUT(self, info, impl): from pyramid_chameleon.renderer import template_renderer_factory return template_renderer_factory(info, impl) def test_lookup_found(self): from pyramid_chameleon.interfaces import IChameleonLookup L = [] def dummy(info): L.append(info) return True self.config.registry.registerUtility(dummy, IChameleonLookup, name='abc') class DummyInfo(object): pass info = DummyInfo() info.registry = self.config.registry info.type = 'abc' result = self._callFUT(info, None) self.assertEqual(result, True) self.assertEqual(L, [info]) def test_lookup_miss(self): from pyramid_chameleon.interfaces import ITemplateRenderer import os abspath = os.path.abspath(__file__) renderer = {} self.config.registry.registerUtility( renderer, ITemplateRenderer, name=abspath) info = DummyRendererInfo({ 'name': abspath, 'package': None, 'registry': self.config.registry, 'settings': {}, 'type': 'type', }) result = self._callFUT(info, None) self.assertTrue(result is renderer) class TestChameleonRendererLookup(unittest.TestCase): def setUp(self): self.config = testing.setUp() def tearDown(self): testing.tearDown() def _makeOne(self, impl): from pyramid_chameleon.renderer import ChameleonRendererLookup return ChameleonRendererLookup(impl, self.config.registry) def _registerTemplateRenderer(self, renderer, name): from pyramid_chameleon.interfaces import ITemplateRenderer self.config.registry.registerUtility( renderer, ITemplateRenderer, name=name) def test_get_spec_not_abspath_no_colon_no_package(self): lookup = self._makeOne(None) result = lookup.get_spec('foo', None) self.assertEqual(result, 'foo') def test_get_spec_not_abspath_no_colon_with_package(self): from pyramid_chameleon import tests lookup = self._makeOne(None) result = lookup.get_spec('foo', tests) self.assertEqual(result, 'pyramid_chameleon.tests:foo') def test_get_spec_not_abspath_with_colon_no_package(self): lookup = self._makeOne(None) result = lookup.get_spec('fudge:foo', None) self.assertEqual(result, 'fudge:foo') def test_get_spec_not_abspath_with_colon_with_package(self): from pyramid_chameleon import tests lookup = self._makeOne(None) result = lookup.get_spec('fudge:foo', tests) self.assertEqual(result, 'fudge:foo') def test_get_spec_is_abspath_no_colon_no_package(self): import os lookup = self._makeOne(None) spec = os.path.abspath(__file__) result = lookup.get_spec(spec, None) self.assertEqual(result, spec) def test_get_spec_is_abspath_no_colon_with_path_in_package(self): from pyramid_chameleon import tests import os lookup = self._makeOne(None) f = __file__ spec = os.path.abspath(f) result = lookup.get_spec(spec, tests) self.assertEqual(result, 'pyramid_chameleon.tests:%s' % os.path.split(f)[-1]) def test_get_spec_is_abspath_no_colon_with_path_outside_package(self): # venusian used only because it's outside of pyramid_chameleon.tests import venusian import os lookup = self._makeOne(None) f = __file__ spec = os.path.abspath(f) result = lookup.get_spec(spec, venusian) self.assertEqual(result, spec) def test_get_spec_is_abspath_with_colon_no_package(self): import os lookup = self._makeOne(None) spec = os.path.join(os.path.abspath(__file__), ':foo') result = lookup.get_spec(spec, None) self.assertEqual(result, spec) def test_get_spec_is_abspath_with_colon_with_path_in_package(self): from pyramid_chameleon import tests import os lookup = self._makeOne(None) f = os.path.abspath(__file__) spec = os.path.join(f, ':foo') result = lookup.get_spec(spec, tests) tail = spec.split(os.sep)[-2:] self.assertEqual(result, 'pyramid_chameleon.tests:%s/%s' % tuple(tail)) def test_get_spec_is_abspath_with_colon_with_path_outside_package(self): # venusian used only because it's outside of pyramid_chameleon.tests import venusian import os lookup = self._makeOne(None) spec = os.path.join(os.path.abspath(__file__), ':foo') result = lookup.get_spec(spec, venusian) self.assertEqual(result, spec) def test_translate(self): from pyramid_chameleon.interfaces import IChameleonTranslate def t(): pass self.config.registry.registerUtility(t, IChameleonTranslate) lookup = self._makeOne(None) self.assertEqual(lookup.translate, t) def test_debug_settings_None(self): self.config.registry.settings = None lookup = self._makeOne(None) self.assertEqual(lookup.debug, False) def test_debug_settings_not_None(self): self.config.registry.settings = {'debug_templates':True} lookup = self._makeOne(None) self.assertEqual(lookup.debug, True) def test_auto_reload_settings_None(self): self.config.registry.settings = None lookup = self._makeOne(None) self.assertEqual(lookup.auto_reload, False) def test_auto_reload_settings_not_None(self): self.config.registry.settings = {'reload_templates':True} lookup = self._makeOne(None) self.assertEqual(lookup.auto_reload, True) def test___call__abspath_path_notexists(self): abspath = '/wont/exist' self._registerTemplateRenderer({}, abspath) info = DummyRendererInfo({ 'name':abspath, 'package':None, 'registry':self.config.registry, 'settings':{}, 'type':'type', }) lookup = self._makeOne(None) self.assertRaises(ValueError, lookup.__call__, info) def test___call__abspath_alreadyregistered(self): import os abspath = os.path.abspath(__file__) renderer = {} self._registerTemplateRenderer(renderer, abspath) info = DummyRendererInfo({ 'name':abspath, 'package':None, 'registry':self.config.registry, 'settings':{}, 'type':'type', }) lookup = self._makeOne(None) result = lookup(info) self.assertTrue(result is renderer) def test___call__abspath_notyetregistered(self): import os abspath = os.path.abspath(__file__) renderer = {} factory = DummyFactory(renderer) info = DummyRendererInfo({ 'name':abspath, 'package':None, 'registry':self.config.registry, 'settings':{}, 'type':'type', }) lookup = self._makeOne(factory) result = lookup(info) self.assertEqual(result, renderer) def test___call__relpath_path_registered(self): renderer = {} spec = 'foo/bar' self._registerTemplateRenderer(renderer, spec) info = DummyRendererInfo({ 'name':spec, 'package':None, 'registry':self.config.registry, 'settings':{}, 'type':'type', }) lookup = self._makeOne(None) result = lookup(info) self.assertTrue(renderer is result) def test___call__relpath_has_package_registered(self): renderer = {} import pyramid_chameleon.tests spec = 'bar/baz' self._registerTemplateRenderer( renderer, 'pyramid_chameleon.tests:bar/baz') info = DummyRendererInfo({ 'name':spec, 'package':pyramid_chameleon.tests, 'registry':self.config.registry, 'settings':{}, 'type':'type', }) lookup = self._makeOne(None) result = lookup(info) self.assertTrue(renderer is result) def test___call__spec_notfound(self): spec = 'pyramid_chameleon.tests:wont/exist' info = DummyRendererInfo({ 'name':spec, 'package':None, 'registry':self.config.registry, 'settings':{}, 'type':'type', }) lookup = self._makeOne(None) self.assertRaises(ValueError, lookup.__call__, info) def test___call__spec_alreadyregistered(self): from pyramid import tests module_name = tests.__name__ relpath = 'test_renderers.py' spec = '%s:%s' % (module_name, relpath) info = DummyRendererInfo({ 'name':spec, 'package':None, 'registry':self.config.registry, 'settings':{}, 'type':'type', }) renderer = {} self._registerTemplateRenderer(renderer, spec) lookup = self._makeOne(None) result = lookup(info) self.assertTrue(result is renderer) def test___call__spec_notyetregistered(self): import os from pyramid_chameleon import tests module_name = tests.__name__ relpath = 'test_renderers.py' renderer = {} factory = DummyFactory(renderer) spec = '%s:%s' % (module_name, relpath) info = DummyRendererInfo({ 'name':spec, 'package':None, 'registry':self.config.registry, 'settings':{}, 'type':'type', }) lookup = self._makeOne(factory) result = lookup(info) self.assertTrue(result is renderer) path = os.path.abspath(__file__).split('$')[0] # jython if path.endswith('.pyc'): # pragma: no cover path = path[:-1] self.assertTrue(factory.path.startswith(path)) self.assertEqual(factory.kw, {'macro':None}) def test___call__spec_withmacro(self): from pyramid_chameleon.interfaces import ITemplateRenderer import os from pyramid_chameleon import tests module_name = tests.__name__ relpath = 'fixtures/withmacro#foo.pt' renderer = {} factory = DummyFactory(renderer) spec = '%s:%s' % (module_name, relpath) reg = self.config.registry info = DummyRendererInfo({ 'name':spec, 'package':None, 'registry':reg, 'settings':{}, 'type':'type', }) lookup = self._makeOne(factory) result = lookup(info) self.assertTrue(result is renderer) path = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'fixtures', 'withmacro.pt') self.assertTrue(factory.path.startswith(path)) self.assertEqual(factory.kw, {'macro':'foo'}) self.assertTrue( reg.getUtility(ITemplateRenderer, name=spec) is renderer ) def test___call__reload_assets_true(self): import pyramid_chameleon.tests from pyramid.interfaces import ISettings from pyramid_chameleon.interfaces import ITemplateRenderer settings = {'reload_assets':True} self.config.registry.registerUtility(settings, ISettings) renderer = {} factory = DummyFactory(renderer) spec = 'test_renderers.py' reg = self.config.registry info = DummyRendererInfo({ 'name':spec, 'package':pyramid_chameleon.tests, 'registry':reg, 'settings':settings, 'type':'type', }) lookup = self._makeOne(factory) result = lookup(info) self.assertTrue(result is renderer) spec = '%s:%s' % ('pyramid_chameleon.tests', 'test_renderers.py') self.assertEqual(reg.queryUtility(ITemplateRenderer, name=spec), None) def test___call__reload_assets_false(self): import pyramid_chameleon.tests from pyramid_chameleon.interfaces import ITemplateRenderer settings = {'reload_assets':False} renderer = {} factory = DummyFactory(renderer) spec = 'test_renderers.py' reg = self.config.registry info = DummyRendererInfo({ 'name':spec, 'package':pyramid_chameleon.tests, 'registry':reg, 'settings':settings, 'type':'type', }) lookup = self._makeOne(factory) result = lookup(info) self.assertTrue(result is renderer) spec = '%s:%s' % ('pyramid_chameleon.tests', 'test_renderers.py') self.assertNotEqual(reg.queryUtility(ITemplateRenderer, name=spec), None) class Dummy: pass class DummyResponse: status = '200 OK' headerlist = () app_iter = () body = '' class DummyFactory: def __init__(self, renderer): self.renderer = renderer def __call__(self, path, lookup, **kw): self.path = path self.kw = kw return self.renderer class DummyRendererInfo(object): def __init__(self, kw): self.__dict__.update(kw) pyramid_chameleon-0.3/pyramid_chameleon/localization.py0000644000175000017500000000212112212567147024355 0ustar chrismchrism00000000000000from translationstring import ChameleonTranslate from pyramid.interfaces import ITranslationDirectories from pyramid.threadlocal import get_current_request from pyramid.i18n import get_localizer from .interfaces import IChameleonTranslate def translator(msg): request = get_current_request() localizer = get_localizer(request) return localizer.translate(msg) def maybe_add_translator(registry): # only conditionally register a translator if there are actually # translation directories (for performance reasons) if registry.queryUtility(ITranslationDirectories) is not None: ctranslate = ChameleonTranslate(translator) registry.registerUtility(ctranslate, IChameleonTranslate) def includeme(config): # pragma: no cover """ Adds renderers for .pt and .txt as well as registers a Chameleon translation utility """ # use order=1000 to take effect very late (in particular, after # any effect that config.add_translation_dirs has) config.action(None, callable=maybe_add_translator, args=(config.registry,), order=1000) pyramid_chameleon-0.3/pyramid_chameleon/zpt.py0000664000175000017500000000304312354571044022506 0ustar chrismchrism00000000000000from zope.interface import implementer from pyramid.decorator import reify from pyramid_chameleon import renderer from pyramid_chameleon.interfaces import ITemplateRenderer from chameleon.zpt.template import PageTemplateFile def renderer_factory(info): return renderer.template_renderer_factory(info, ZPTTemplateRenderer) class PyramidPageTemplateFile(PageTemplateFile): def cook(self, body): PageTemplateFile.cook(self, body) if self.macro: # render only the portion of the template included in a # define-macro named the value of self.macro macro_renderer = self.macros[self.macro].include self._render = macro_renderer @implementer(ITemplateRenderer) class ZPTTemplateRenderer(object): def __init__(self, path, lookup, macro=None): self.path = path self.lookup = lookup self.macro = macro @reify # avoid looking up reload_templates before manager pushed def template(self): tf = PyramidPageTemplateFile( self.path, auto_reload=self.lookup.auto_reload, debug=self.lookup.debug, translate=self.lookup.translate, macro=self.macro, ) return tf def implementation(self): return self.template def __call__(self, value, system): try: system.update(value) except (TypeError, ValueError): raise ValueError('renderer was passed non-dictionary as value') result = self.template(**system) return result pyramid_chameleon-0.3/CHANGES.txt0000664000175000017500000000052312354571775017463 0ustar chrismchrism000000000000000.3 (2014-07-01) ---------------- - Remove dependency on ``pyramid.interfaces.ITemplateRenderer`` (which is deprecated in Pyramid > 1.5). - Update Trove classifiers and tests to support Python 3.4. 0.2 (2014-02-09) ---------------- - Dropped dependency on ``nose-selecttests``. 0.1 (2013-09-07) ---------------- - Initial version pyramid_chameleon-0.3/.gitignore0000664000175000017500000000011112212571203017606 0ustar chrismchrism00000000000000.coverage .tox/ coverage.xml env*/ nosetests.xml *.egg-info/ *.pyc dist/ pyramid_chameleon-0.3/rtd.txt0000664000175000017500000000003412212567552017170 0ustar chrismchrism00000000000000repoze.sphinx.autointerface pyramid_chameleon-0.3/README.rst0000664000175000017500000000053612212571157017330 0ustar chrismchrism00000000000000Chameleon templating system Bindings for Pyramid ================================================= These are bindings for the `Chameleon templating system `_ for the Pyramid_ web framework. See http://docs.pylonsproject.org/projects/pyramid_chameleon/en/latest/ for documentation. .. _Pyramid: http://pylonsproject.org/ pyramid_chameleon-0.3/LICENSE.txt0000664000175000017500000000333312354565400017463 0ustar chrismchrism00000000000000License A copyright notice accompanies this license document that identifies the copyright holders. 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. 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.