First commit
authorThierry Florac <thierry.florac@onf.fr>
Thu, 19 Feb 2015 10:54:13 +0100
changeset 0 44692d47182f
child 1 b90ce037f872
First commit
.hgignore
.installed.cfg
LICENSE
MANIFEST.in
bootstrap.py
buildout.cfg
docs/HISTORY.txt
docs/README.txt
setup.py
src/pyams_pagelet.egg-info/PKG-INFO
src/pyams_pagelet.egg-info/SOURCES.txt
src/pyams_pagelet.egg-info/dependency_links.txt
src/pyams_pagelet.egg-info/entry_points.txt
src/pyams_pagelet.egg-info/namespace_packages.txt
src/pyams_pagelet.egg-info/not-zip-safe
src/pyams_pagelet.egg-info/requires.txt
src/pyams_pagelet.egg-info/top_level.txt
src/pyams_pagelet/__init__.py
src/pyams_pagelet/configure.zcml
src/pyams_pagelet/doctests/README.txt
src/pyams_pagelet/interfaces/__init__.py
src/pyams_pagelet/meta.zcml
src/pyams_pagelet/metaconfigure.py
src/pyams_pagelet/metadirectives.py
src/pyams_pagelet/pagelet.py
src/pyams_pagelet/tests/__init__.py
src/pyams_pagelet/tests/test_utilsdocs.py
src/pyams_pagelet/tests/test_utilsdocstrings.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,19 @@
+
+syntax: regexp
+^develop-eggs$
+syntax: regexp
+^parts$
+syntax: regexp
+^bin$
+syntax: regexp
+^\.installed\.cfg$
+syntax: regexp
+^\.settings$
+syntax: regexp
+^build$
+syntax: regexp
+^dist$
+syntax: regexp
+^\.idea$
+syntax: regexp
+.*\.pyc$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.installed.cfg	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,86 @@
+[buildout]
+installed_develop_eggs = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/develop-eggs/pyams-pagelet.egg-link
+parts = package i18n pyflakes test
+
+[package]
+__buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/pserve
+	/home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/proutes
+	/home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/pdistreport
+	/home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/pshell
+	/home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/pcreate
+	/home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/pviews
+	/home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/prequest
+	/home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/ptweens
+__buildout_signature__ = zc.recipe.egg-2.0.1-py3.4.egg setuptools-12.0.4-py3.4.egg zc.buildout-2.3.1-py3.4.egg
+_b = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin
+_d = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/develop-eggs
+_e = /var/local/env/pyams/eggs
+bin-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin
+develop-eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/develop-eggs
+eggs = pyams_pagelet
+	pyramid
+	zope.component
+	zope.interface
+eggs-directory = /var/local/env/pyams/eggs
+recipe = zc.recipe.egg
+
+[i18n]
+__buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/pybabel
+	/home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/polint
+	/home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/pot-create
+__buildout_signature__ = zc.recipe.egg-2.0.1-py3.4.egg setuptools-12.0.4-py3.4.egg zc.buildout-2.3.1-py3.4.egg
+_b = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin
+_d = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/develop-eggs
+_e = /var/local/env/pyams/eggs
+bin-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin
+develop-eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/develop-eggs
+eggs = babel
+	lingua
+eggs-directory = /var/local/env/pyams/eggs
+recipe = zc.recipe.egg
+
+[pyflakes]
+__buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/pyflakes
+	/home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/pyflakes
+__buildout_signature__ = zc.recipe.egg-2.0.1-py3.4.egg setuptools-12.0.4-py3.4.egg zc.buildout-2.3.1-py3.4.egg
+_b = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin
+_d = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/develop-eggs
+_e = /var/local/env/pyams/eggs
+bin-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin
+develop-eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/develop-eggs
+eggs = pyflakes
+eggs-directory = /var/local/env/pyams/eggs
+entry-points = pyflakes=pyflakes.scripts.pyflakes:main
+initialization = if not sys.argv[1:]: sys.argv[1:] = ["src"]
+recipe = zc.recipe.egg
+scripts = pyflakes
+
+[test]
+__buildout_installed__ = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/parts/test
+	/home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/test
+__buildout_signature__ = zc.recipe.testrunner-2.0.0-py3.4.egg zc.recipe.egg-2.0.1-py3.4.egg setuptools-12.0.4-py3.4.egg zope.testrunner-4.4.6-py3.4.egg zc.buildout-2.3.1-py3.4.egg zope.interface-4.1.2-py3.4-linux-x86_64.egg zope.exceptions-4.0.7-py3.4.egg six-45a2be65d681713a598787ec39be3290
+_b = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin
+_d = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/develop-eggs
+_e = /var/local/env/pyams/eggs
+bin-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin
+develop-eggs-directory = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/develop-eggs
+eggs = pyams_pagelet [test]
+eggs-directory = /var/local/env/pyams/eggs
+location = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/parts/test
+recipe = zc.recipe.testrunner
+script = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/bin/test
+
+[buildout]
+installed_develop_eggs = /home/tflorac/Dropbox/src/PyAMS/pyams_pagelet/develop-eggs/pyams-pagelet.egg-link
+
+[buildout]
+parts = i18n pyflakes test package
+
+[buildout]
+parts = pyflakes test package i18n
+
+[buildout]
+parts = test package i18n pyflakes
+
+[buildout]
+parts = package i18n pyflakes test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSE	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,42 @@
+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.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MANIFEST.in	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,5 @@
+include *.txt
+recursive-include docs *
+recursive-include src *
+global-exclude *.pyc
+global-exclude *.*~
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bootstrap.py	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,178 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""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.
+"""
+
+import os
+import shutil
+import sys
+import tempfile
+
+from optparse import OptionParser
+
+tmpeggs = tempfile.mkdtemp()
+
+usage = '''\
+[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
+
+Bootstraps a buildout-based project.
+
+Simply run this script in a directory containing a buildout.cfg, using the
+Python that you want bin/buildout to use.
+
+Note that by using --find-links to point to local resources, you can keep 
+this script from going over the network.
+'''
+
+parser = OptionParser(usage=usage)
+parser.add_option("-v", "--version", help="use a specific zc.buildout version")
+
+parser.add_option("-t", "--accept-buildout-test-releases",
+                  dest='accept_buildout_test_releases',
+                  action="store_true", default=False,
+                  help=("Normally, if you do not specify a --version, the "
+                        "bootstrap script and buildout gets the newest "
+                        "*final* versions of zc.buildout and its recipes and "
+                        "extensions for you.  If you use this flag, "
+                        "bootstrap and buildout will get the newest releases "
+                        "even if they are alphas or betas."))
+parser.add_option("-c", "--config-file",
+                  help=("Specify the path to the buildout configuration "
+                        "file to be used."))
+parser.add_option("-f", "--find-links",
+                  help=("Specify a URL to search for buildout releases"))
+parser.add_option("--allow-site-packages",
+                  action="store_true", default=False,
+                  help=("Let bootstrap.py use existing site packages"))
+
+
+options, args = parser.parse_args()
+
+######################################################################
+# load/install setuptools
+
+try:
+    if options.allow_site_packages:
+        import setuptools
+        import pkg_resources
+    from urllib.request import urlopen
+except ImportError:
+    from urllib2 import urlopen
+
+ez = {}
+exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)
+
+if not options.allow_site_packages:
+    # ez_setup imports site, which adds site packages
+    # this will remove them from the path to ensure that incompatible versions 
+    # of setuptools are not in the path
+    import site
+    # inside a virtualenv, there is no 'getsitepackages'. 
+    # We can't remove these reliably
+    if hasattr(site, 'getsitepackages'):
+        for sitepackage_path in site.getsitepackages():
+            sys.path[:] = [x for x in sys.path if sitepackage_path not in x]
+
+setup_args = dict(to_dir=tmpeggs, download_delay=0)
+ez['use_setuptools'](**setup_args)
+import setuptools
+import pkg_resources
+
+# This does not (always?) update the default working set.  We will
+# do it.
+for path in sys.path:
+    if path not in pkg_resources.working_set.entries:
+        pkg_resources.working_set.add_entry(path)
+
+######################################################################
+# Install buildout
+
+ws = pkg_resources.working_set
+
+cmd = [sys.executable, '-c',
+       'from setuptools.command.easy_install import main; main()',
+       '-mZqNxd', tmpeggs]
+
+find_links = os.environ.get(
+    'bootstrap-testing-find-links',
+    options.find_links or
+    ('http://downloads.buildout.org/'
+     if options.accept_buildout_test_releases else None)
+    )
+if find_links:
+    cmd.extend(['-f', find_links])
+
+setuptools_path = ws.find(
+    pkg_resources.Requirement.parse('setuptools')).location
+
+requirement = 'zc.buildout'
+version = options.version
+if version is None and not options.accept_buildout_test_releases:
+    # Figure out the most recent final version of zc.buildout.
+    import setuptools.package_index
+    _final_parts = '*final-', '*final'
+
+    def _final_version(parsed_version):
+        for part in parsed_version:
+            if (part[:1] == '*') and (part not in _final_parts):
+                return False
+        return True
+    index = setuptools.package_index.PackageIndex(
+        search_path=[setuptools_path])
+    if find_links:
+        index.add_find_links((find_links,))
+    req = pkg_resources.Requirement.parse(requirement)
+    if index.obtain(req) is not None:
+        best = []
+        bestv = None
+        for dist in index[req.project_name]:
+            distv = dist.parsed_version
+            if _final_version(distv):
+                if bestv is None or distv > bestv:
+                    best = [dist]
+                    bestv = distv
+                elif distv == bestv:
+                    best.append(dist)
+        if best:
+            best.sort()
+            version = best[-1].version
+if version:
+    requirement = '=='.join((requirement, version))
+cmd.append(requirement)
+
+import subprocess
+if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
+    raise Exception(
+        "Failed to execute command:\n%s" % repr(cmd)[1:-1])
+
+######################################################################
+# Import and run buildout
+
+ws.add_entry(tmpeggs)
+ws.require(requirement)
+import zc.buildout.buildout
+
+if not [a for a in args if '=' not in a]:
+    args.append('bootstrap')
+
+# if -c was provided, we push it back into args for buildout' main function
+if options.config_file is not None:
+    args[0:0] = ['-c', options.config_file]
+
+zc.buildout.buildout.main(args)
+shutil.rmtree(tmpeggs)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildout.cfg	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,64 @@
+[buildout]
+eggs-directory = /var/local/env/pyams/eggs
+
+socket-timeout = 3
+show-picked-versions = true
+newest = false
+
+allow-hosts =
+    bitbucket.org
+    *.python.org
+    *.sourceforge.net
+    github.com
+
+#extends = http://download.ztfy.org/webapp/ztfy.webapp.dev.cfg
+versions = versions
+newest = false
+#allow-picked-versions = false
+
+src = src
+develop = .
+
+parts =
+    package
+    i18n
+    pyflakes
+    test
+
+[package]
+recipe = zc.recipe.egg
+eggs =
+    pyams_pagelet
+    pyams_template
+    pyramid
+    pyramid_zcml
+    zope.component
+    zope.configuration
+    zope.contentprovider
+    zope.interface
+    zope.schema
+
+[i18n]
+recipe = zc.recipe.egg
+eggs =
+    babel
+    lingua
+
+[pyflakes]
+recipe = zc.recipe.egg
+eggs = pyflakes
+scripts = pyflakes
+entry-points = pyflakes=pyflakes.scripts.pyflakes:main
+initialization = if not sys.argv[1:]: sys.argv[1:] = ["${buildout:src}"]
+
+[pyflakesrun]
+recipe = collective.recipe.cmd
+on_install = true
+cmds = ${buildout:develop}/bin/${pyflakes:scripts}
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = pyams_pagelet [test]
+
+[versions]
+pyams_pagelet = 0.1.0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/setup.py	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,74 @@
+### -*- coding: utf-8 -*- ####################################################
+##############################################################################
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# 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.
+#
+##############################################################################
+
+"""
+This module contains pyams_pagelet package
+"""
+import os
+from setuptools import setup, find_packages
+
+DOCS = os.path.join(os.path.dirname(__file__),
+                    'docs')
+
+README = os.path.join(DOCS, 'README.txt')
+HISTORY = os.path.join(DOCS, 'HISTORY.txt')
+
+version = '0.1.0'
+long_description = open(README).read() + '\n\n' + open(HISTORY).read()
+
+tests_require = []
+
+setup(name='pyams_pagelet',
+      version=version,
+      description="PyAMS pagelet interfaces and classes",
+      long_description=long_description,
+      classifiers=[
+          "License :: OSI Approved :: Zope Public License",
+          "Development Status :: 4 - Beta",
+          "Programming Language :: Python",
+          "Framework :: Pyramid",
+          "Topic :: Software Development :: Libraries :: Python Modules",
+      ],
+      keywords='Pyramid PyAMS pagelet',
+      author='Thierry Florac',
+      author_email='tflorac@ulthar.net',
+      url='http://hg.ztfy.org/pyams/pyams_pagelet',
+      license='ZPL',
+      packages=find_packages('src'),
+      package_dir={'': 'src'},
+      namespace_packages=[],
+      include_package_data=True,
+      package_data={'': ['*.zcml', '*.txt', '*.pt', '*.pot', '*.po', '*.mo', '*.png', '*.gif', '*.jpeg', '*.jpg', '*.css', '*.js']},
+      zip_safe=False,
+      # uncomment this to be able to run tests with setup.py
+      test_suite="pyams_pagelet.tests.test_utilsdocs.test_suite",
+      tests_require=tests_require,
+      extras_require=dict(test=tests_require),
+      install_requires=[
+          'setuptools',
+          # -*- Extra requirements: -*-
+          'pyams_template',
+          'pyramid',
+          'pyramid_zcml',
+          'zope.component',
+          'zope.configuration',
+          'zope.contentprovider',
+          'zope.interface',
+          'zope.schema',
+      ],
+      entry_points="""
+      # -*- Entry points: -*-
+      """,
+      )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet.egg-info/PKG-INFO	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,18 @@
+Metadata-Version: 1.1
+Name: pyams-pagelet
+Version: 0.1.0
+Summary: PyAMS pagelet interfaces and classes
+Home-page: http://hg.ztfy.org/pyams/pyams_pagelet
+Author: Thierry Florac
+Author-email: tflorac@ulthar.net
+License: ZPL
+Description: 
+        
+        
+Keywords: Pyramid PyAMS pagelet
+Platform: UNKNOWN
+Classifier: License :: OSI Approved :: Zope Public License
+Classifier: Development Status :: 4 - Beta
+Classifier: Programming Language :: Python
+Classifier: Framework :: Pyramid
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet.egg-info/SOURCES.txt	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,23 @@
+MANIFEST.in
+setup.py
+docs/HISTORY.txt
+docs/README.txt
+src/pyams_pagelet/__init__.py
+src/pyams_pagelet/configure.zcml
+src/pyams_pagelet/meta.zcml
+src/pyams_pagelet/metaconfigure.py
+src/pyams_pagelet/metadirectives.py
+src/pyams_pagelet/pagelet.py
+src/pyams_pagelet.egg-info/PKG-INFO
+src/pyams_pagelet.egg-info/SOURCES.txt
+src/pyams_pagelet.egg-info/dependency_links.txt
+src/pyams_pagelet.egg-info/entry_points.txt
+src/pyams_pagelet.egg-info/namespace_packages.txt
+src/pyams_pagelet.egg-info/not-zip-safe
+src/pyams_pagelet.egg-info/requires.txt
+src/pyams_pagelet.egg-info/top_level.txt
+src/pyams_pagelet/doctests/README.txt
+src/pyams_pagelet/interfaces/__init__.py
+src/pyams_pagelet/tests/__init__.py
+src/pyams_pagelet/tests/test_utilsdocs.py
+src/pyams_pagelet/tests/test_utilsdocstrings.py
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet.egg-info/dependency_links.txt	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,1 @@
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet.egg-info/entry_points.txt	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,3 @@
+
+      # -*- Entry points: -*-
+      
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet.egg-info/namespace_packages.txt	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,1 @@
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet.egg-info/not-zip-safe	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,1 @@
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet.egg-info/requires.txt	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,11 @@
+setuptools
+pyams_template
+pyramid
+pyramid_zcml
+zope.component
+zope.configuration
+zope.contentprovider
+zope.interface
+zope.schema
+
+[test]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet.egg-info/top_level.txt	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,1 @@
+pyams_pagelet
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet/__init__.py	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,28 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# 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.
+#
+
+
+from pyramid.i18n import TranslationStringFactory
+_ = TranslationStringFactory('pyams_pagelet')
+
+
+def includeme(config):
+    """Pyramid include"""
+
+    # add translations
+    config.add_translation_dirs('pyams_pagelet:locales')
+
+    # load registry components
+    config.scan()
+
+    if hasattr(config, 'load_zcml'):
+        config.load_zcml('configure.zcml')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet/configure.zcml	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,8 @@
+<configure
+	xmlns="http://pylonshq.com/pyramid">
+
+	<include package="pyramid_zcml" />
+
+	<include file="meta.zcml" />
+
+</configure>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet/doctests/README.txt	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,3 @@
+=====================
+pyams_pagelet package
+=====================
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet/interfaces/__init__.py	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,46 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# 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 pyramid.interfaces import IView
+from zope.component.interfaces import IObjectEvent, ObjectEvent
+from zope.contentprovider.interfaces import IContentProvider
+
+# import packages
+from zope.interface import implementer
+
+
+class IPagelet(IView):
+    """Pagelet interface"""
+
+    def update(self):
+        """Update the pagelet data."""
+
+    def render(self):
+        """Render the pagelet content w/o o-wrap."""
+
+
+class IPageletRenderer(IContentProvider):
+    """Render a pagelet by calling it's 'render' method"""
+
+
+class IPageletCreatedEvent(IObjectEvent):
+    """Pagelet created event interface"""
+
+
+@implementer(IPageletCreatedEvent)
+class PageletCreatedEvent(ObjectEvent):
+    """Pagelet created event"""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet/meta.zcml	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,14 @@
+<configure
+	xmlns="http://pylonshq.com/pyramid"
+	xmlns:meta="http://namespaces.zope.org/meta">
+
+	<meta:directives namespace="http://namespaces.ztfy.org/pyams">
+
+		<meta:directive
+			name="pagelet"
+			schema=".metadirectives.IPageletDirective"
+			handler=".metaconfigure.PageletDirective" />
+
+	</meta:directives>
+
+</configure>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet/metaconfigure.py	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,67 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# 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.
+#
+
+
+# import standard packages
+
+# import interfaces
+from pyams_pagelet.interfaces import IPagelet
+from pyramid.interfaces import IRequest
+
+# import packages
+from pyams_pagelet.pagelet import Pagelet
+from pyramid.exceptions import ConfigurationError
+from pyramid_zcml import with_context
+from zope.component import zcml
+from zope.component.interface import provideInterface
+from zope.interface import Interface, classImplements
+
+
+def PageletDirective(_context, name, view,
+                     context=Interface,
+                     permission=None,
+                     layer=IRequest,
+                     **kwargs):
+    if not view:
+        raise ConfigurationError("You must specify a view class.")
+    cdict = {}
+    cdict['__name__'] = name
+    cdict['permission'] = permission
+    cdict.update(kwargs)
+    new_class = type(view.__name__, (view, Pagelet), cdict)
+
+    classImplements(new_class, IPagelet)
+
+    # Register the interfaces
+    _handle_for(_context, context)
+
+    # Register pagelet
+    _context.action(discriminator=('pagelet', context, layer, name),
+                    callable=zcml.handler,
+                    args=('registerAdapter', new_class,
+                          (context, layer),
+                          IPagelet, name, _context.info))
+
+    # Register view
+    config = with_context(_context)
+    config.add_view(name=name,
+                    view=new_class,
+                    context=context,
+                    permission=permission,
+                    request_type=layer)
+
+
+def _handle_for(_context, for_):
+    if for_ is not None:
+        _context.action(discriminator=None,
+                        callable=provideInterface,
+                        args=('', for_))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet/metadirectives.py	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# 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
+
+# import packages
+from zope.configuration.fields import GlobalObject
+from zope.interface import Interface
+from zope.schema import TextLine
+
+
+class IPageletDirective(Interface):
+    """Pagelet ZCML directive interface"""
+
+    name = TextLine(title='The name of the view',
+                    description='Shows up in URLs/paths. For example "foo" or "foo.html"',
+                    required=True)
+
+    context = GlobalObject(title='The interface or class this view is for',
+                           required=False)
+
+    layer = GlobalObject(title="The request interface or class this pagelet is for",
+                         description="Defaults to zope.publisher.interfaces.browser.IDefaultBrowserLayer.",
+                         required=False)
+
+    view = GlobalObject(title='View class',
+                        description='The view function or class',
+                        required=True)
+
+    permission = TextLine(title='Permission',
+                          description='The permission needed to use the view',
+                          required=False)
+
+
+IPageletDirective.setTaggedValue('keyword_arguments', True)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet/pagelet.py	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,150 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# 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 venusian
+
+# import interfaces
+from pyams_pagelet.interfaces import IPagelet, IPageletRenderer, PageletCreatedEvent
+from pyams_template.interfaces import IContentTemplate, ILayoutTemplate
+from pyramid.interfaces import IRequest
+from pyramid_chameleon.interfaces import IChameleonTranslate
+
+# import packages
+from pyams_utils.adapter import adapter_config
+from pyramid.httpexceptions import HTTPUnauthorized
+from pyramid.response import Response
+from zope.component import queryUtility
+from zope.interface import implementer, Interface
+
+
+REDIRECT_STATUS_CODES = (301, 302, 303)
+
+
+@implementer(IPagelet)
+class Pagelet(object):
+    """Content provider with layout support"""
+
+    template = None
+    layout = None
+    permission = None
+
+    def __init__(self, context, request):
+        self.context = context
+        self.request = request
+        if self.permission and not request.has_permission(self.permission):
+            raise HTTPUnauthorized('You are not authorized to access the page called `%s`.' %
+                                   request.view_name)
+        request.registry.notify(PageletCreatedEvent(self))
+
+    def update(self):
+        self.request.annotations['view'] = self
+
+    def render(self):
+        request = self.request
+        cdict = {'context': self.context,
+                 'request': request,
+                 'view': self,
+                 'translate': queryUtility(IChameleonTranslate)}
+        if self.template is None:
+            registry = request.registry
+            template = registry.queryMultiAdapter((self, request, self.context),
+                                                  IContentTemplate)
+            if template is None:
+                template = registry.getMultiAdapter((self, request), IContentTemplate)
+            return template(**cdict)
+        return self.template(**cdict)
+
+    def __call__(self, **kwargs):
+        """Call update and return layout template"""
+        self.update()
+        if self.request.response.status_code in REDIRECT_STATUS_CODES:
+            return ''
+
+        request = self.request
+        cdict = {'context': self.context,
+                 'request': request,
+                 'view': self,
+                 'translate': queryUtility(IChameleonTranslate)}
+        cdict.update(kwargs)
+        if self.layout is None:
+            registry = request.registry
+            layout = registry.queryMultiAdapter((self, request, self.context),
+                                                ILayoutTemplate)
+            if layout is None:
+                layout = registry.getMultiAdapter((self, request), ILayoutTemplate)
+            return Response(layout(**cdict))
+        return Response(self.layout(**cdict))
+
+
+@adapter_config(name='pagelet', context=(Interface, IRequest, IPagelet), provides=IPageletRenderer)
+class PageletRenderer(object):
+    """Pagelet renderer"""
+
+    def __init__(self, context, request, pagelet):
+        self.__updated = False
+        self.__parent__ = pagelet
+        self.context = context
+        self.request = request
+
+    def update(self):
+        pass
+
+    def render(self):
+        return self.__parent__.render()
+
+
+class pagelet_config(object):
+    """Function or class decorator used to declare a pagelet"""
+
+    venusian = venusian  # for testing injection
+
+    def __init__(self, **settings):
+        if 'for_' in settings:
+            if settings.get('context') is None:
+                settings['context'] = settings.pop('for_')
+        if 'layer' in settings:
+            settings['request_type'] = settings.pop('layer')
+        self.__dict__.update(settings)
+
+    def __call__(self, wrapped):
+        settings = self.__dict__.copy()
+        depth = settings.pop('_depth', 0)
+
+        def callback(context, name, ob):
+            cdict = {}
+            cdict['__name__'] = settings.get('name')
+            cdict['permission'] = settings.get('permission')
+            new_class = type(ob.__name__, (ob, Pagelet), cdict)
+
+            config = context.config.with_package(info.module)
+            config.registry.registerAdapter(new_class,
+                                            (settings.get('context', Interface),
+                                             settings.get('request_type', IRequest)),
+                                            IPagelet, settings.get('name'))
+            config.add_view(view=new_class, **settings)
+
+        info = self.venusian.attach(wrapped, callback, category='pyams_pagelet',
+                                    depth=depth + 1)
+
+        if info.scope == 'class':
+            # if the decorator was attached to a method in a class, or
+            # otherwise executed at class scope, we need to set an
+            # 'attr' into the settings if one isn't already in there
+            if settings.get('attr') is None:
+                settings['attr'] = wrapped.__name__
+
+        settings['_info'] = info.codeinfo  # fbo "action_method"
+        return wrapped
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet/tests/__init__.py	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,1 @@
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet/tests/test_utilsdocs.py	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,60 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# 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.
+#
+
+"""
+Generic Test case for pyams_pagelet doctest
+"""
+
+__docformat__ = 'restructuredtext'
+
+import unittest
+import doctest
+import sys
+import os
+
+
+current_dir = os.path.dirname(__file__)
+
+def doc_suite(test_dir, setUp=None, tearDown=None, globs=None):
+    """Returns a test suite, based on doctests found in /doctest."""
+    suite = []
+    if globs is None:
+        globs = globals()
+
+    flags = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE |
+             doctest.REPORT_ONLY_FIRST_FAILURE)
+
+    package_dir = os.path.split(test_dir)[0]
+    if package_dir not in sys.path:
+        sys.path.append(package_dir)
+
+    doctest_dir = os.path.join(package_dir, 'doctests')
+
+    # filtering files on extension
+    docs = [os.path.join(doctest_dir, doc) for doc in
+            os.listdir(doctest_dir) if doc.endswith('.txt')]
+
+    for test in docs:
+        suite.append(doctest.DocFileSuite(test, optionflags=flags,
+                                          globs=globs, setUp=setUp,
+                                          tearDown=tearDown,
+                                          module_relative=False))
+
+    return unittest.TestSuite(suite)
+
+def test_suite():
+    """returns the test suite"""
+    return doc_suite(current_dir)
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_pagelet/tests/test_utilsdocstrings.py	Thu Feb 19 10:54:13 2015 +0100
@@ -0,0 +1,63 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# 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.
+#
+
+"""
+Generic Test case for pyams_pagelet doc strings
+"""
+
+__docformat__ = 'restructuredtext'
+
+import unittest
+import doctest
+import sys
+import os
+
+
+current_dir = os.path.abspath(os.path.dirname(__file__))
+
+def doc_suite(test_dir, globs=None):
+    """Returns a test suite, based on doc tests strings found in /*.py"""
+    suite = []
+    if globs is None:
+        globs = globals()
+
+    flags = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE |
+             doctest.REPORT_ONLY_FIRST_FAILURE)
+
+    package_dir = os.path.split(test_dir)[0]
+    if package_dir not in sys.path:
+        sys.path.append(package_dir)
+
+    # filtering files on extension
+    docs = [doc for doc in
+            os.listdir(package_dir) if doc.endswith('.py')]
+    docs = [doc for doc in docs if not doc.startswith('__')]
+
+    for test in docs:
+        fd = open(os.path.join(package_dir, test))
+        content = fd.read()
+        fd.close()
+        if '>>> ' not in content:
+            continue
+        test = test.replace('.py', '')
+        location = 'pyams_pagelet.%s' % test
+        suite.append(doctest.DocTestSuite(location, optionflags=flags,
+                                          globs=globs))
+
+    return unittest.TestSuite(suite)
+
+def test_suite():
+    """returns the test suite"""
+    return doc_suite(current_dir)
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')