# HG changeset patch # User Thierry Florac # Date 1574758896 -3600 # Node ID c3d0112a61f6a555a27db5e1760583174bbd41a6 # Parent b1ad46aa2d16ca04d3e8dc6adee2e015b5550b5c Code cleanup diff -r b1ad46aa2d16 -r c3d0112a61f6 src/pyams_template/__init__.py --- a/src/pyams_template/__init__.py Mon Nov 25 15:46:23 2019 +0100 +++ b/src/pyams_template/__init__.py Tue Nov 26 10:01:36 2019 +0100 @@ -10,6 +10,14 @@ # FOR A PARTICULAR PURPOSE. # +"""PyAMS_template package + +This template is used to assign Chamelon templates to views or layouts. It's essentially an +adaptation of "z3c.template" package for use with Pyramid. + +Templates are registered as adapters for a context and a request, and so can easily be overriden. +You can also define view templates and layout templates, or use named adapters if needed. +""" from pyramid.i18n import TranslationStringFactory _ = TranslationStringFactory('pyams_template') @@ -19,8 +27,8 @@ """Pyramid include""" # define configuration settings - from pyams_template import template - template.configuration_settings = config.registry.settings + from pyams_template import template # pylint: disable=import-outside-toplevel + template.CONFIGURATION_SETTINGS = config.registry.settings # load registry components config.scan() diff -r b1ad46aa2d16 -r c3d0112a61f6 src/pyams_template/interfaces.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_template/interfaces.py Tue Nov 26 10:01:36 2019 +0100 @@ -0,0 +1,32 @@ +# +# Copyright (c) 2008-2015 Thierry Florac +# 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. +# + +"""PyAMS_template.interfaces module + +Templates marker interfaces definitions +""" + +from zope.interface import Interface + +__docformat__ = 'restructuredtext' + + +class IPageTemplate(Interface): + """Base page template interface""" + + +class ILayoutTemplate(IPageTemplate): + """A template used for render the layout.""" + + +class IContentTemplate(IPageTemplate): + """A template used for render the content.""" diff -r b1ad46aa2d16 -r c3d0112a61f6 src/pyams_template/interfaces/__init__.py --- a/src/pyams_template/interfaces/__init__.py Mon Nov 25 15:46:23 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -# -# Copyright (c) 2008-2015 Thierry Florac -# 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. -# - -__docformat__ = 'restructuredtext' - - -# import standard packages - -# import interfaces -from zope.interface import Interface - -# import packages - - -class IPageTemplate(Interface): - """Base page template interface""" - - -class ILayoutTemplate(IPageTemplate): - """A template used for render the layout.""" - - -class IContentTemplate(IPageTemplate): - """A template used for render the content.""" diff -r b1ad46aa2d16 -r c3d0112a61f6 src/pyams_template/metaconfigure.py --- a/src/pyams_template/metaconfigure.py Mon Nov 25 15:46:23 2019 +0100 +++ b/src/pyams_template/metaconfigure.py Tue Nov 26 10:01:36 2019 +0100 @@ -10,36 +10,41 @@ # FOR A PARTICULAR PURPOSE. # -__docformat__ = 'restructuredtext' +"""PyAMS_template.metadirectives module +Is module allows to handle