[Checkins] SVN: z3c.request/trunk/ first implementation of z3c.request

Fabio Tranchitella kobold at kobold.it
Tue Aug 18 10:46:52 EDT 2009


Log message for revision 102911:
  first implementation of z3c.request

Changed:
  _U  z3c.request/trunk/
  A   z3c.request/trunk/CHANGES.txt
  A   z3c.request/trunk/bootstrap.py
  A   z3c.request/trunk/buildout.cfg
  A   z3c.request/trunk/setup.py
  A   z3c.request/trunk/src/
  A   z3c.request/trunk/src/z3c/
  A   z3c.request/trunk/src/z3c/__init__.py
  A   z3c.request/trunk/src/z3c/request/
  A   z3c.request/trunk/src/z3c/request/README.txt
  A   z3c.request/trunk/src/z3c/request/__init__.py
  A   z3c.request/trunk/src/z3c/request/interfaces.py
  A   z3c.request/trunk/src/z3c/request/tests.py

-=-

Property changes on: z3c.request/trunk
___________________________________________________________________
Added: svn:ignore
   + *.pyc
*.pyo
bin
parts
eggs
develop-eggs
.installed.cfg


Added: z3c.request/trunk/CHANGES.txt
===================================================================
--- z3c.request/trunk/CHANGES.txt	                        (rev 0)
+++ z3c.request/trunk/CHANGES.txt	2009-08-18 14:46:51 UTC (rev 102911)
@@ -0,0 +1,7 @@
+CHANGES
+=======
+
+0.1.0 (unreleased)
+------------------
+
+- First public release.

Added: z3c.request/trunk/bootstrap.py
===================================================================
--- z3c.request/trunk/bootstrap.py	                        (rev 0)
+++ z3c.request/trunk/bootstrap.py	2009-08-18 14:46:51 UTC (rev 102911)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id: bootstrap.py 73408 2007-03-21 05:53:10Z baijum $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+ez = {}
+exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                     ).read() in ez
+ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+    cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+    os.P_WAIT, sys.executable, sys.executable,
+    '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+    dict(os.environ,
+         PYTHONPATH=
+         ws.find(pkg_resources.Requirement.parse('setuptools')).location
+         ),
+    ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)

Added: z3c.request/trunk/buildout.cfg
===================================================================
--- z3c.request/trunk/buildout.cfg	                        (rev 0)
+++ z3c.request/trunk/buildout.cfg	2009-08-18 14:46:51 UTC (rev 102911)
@@ -0,0 +1,7 @@
+[buildout]
+develop = .
+parts = test
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = z3c.request [test]

Added: z3c.request/trunk/setup.py
===================================================================
--- z3c.request/trunk/setup.py	                        (rev 0)
+++ z3c.request/trunk/setup.py	2009-08-18 14:46:51 UTC (rev 102911)
@@ -0,0 +1,36 @@
+from setuptools import setup, find_packages
+
+setup(
+    name='z3c.request',
+    version='0.1.0dev',
+    url='http://pypi.python.org/pypi/z3c.request',
+    license='ZPL 2.1',
+    author='Fabio Tranchitella and the Zope Community',
+    author_email='zope-dev at zope.org',
+    description="Common interface for browser request implementations.",
+    long_description=(
+        open('src/z3c/request/README.txt').read() + '\n\n' +
+        open('CHANGES.txt').read()
+    ),
+    packages=find_packages('src'),
+    package_dir={'': 'src'},
+    namespace_packages=['z3c'],
+    tests_require=[
+        'WebOb',
+        'zope.publisher',
+        'zope.testing',
+    ],
+    install_requires=[
+        'setuptools',
+        'zope.interface',
+    ],
+    extras_require=dict(
+        test=[
+            'WebOb',
+            'zope.publisher',
+            'zope.testing',
+        ],
+    ),
+    include_package_data=True,
+    zip_safe=False,
+)


Property changes on: z3c.request/trunk/src
___________________________________________________________________
Added: svn:ignore
   + z3c.request.egg-info


Added: z3c.request/trunk/src/z3c/__init__.py
===================================================================
--- z3c.request/trunk/src/z3c/__init__.py	                        (rev 0)
+++ z3c.request/trunk/src/z3c/__init__.py	2009-08-18 14:46:51 UTC (rev 102911)
@@ -0,0 +1 @@
+__import__('pkg_resources').declare_namespace(__name__)

Added: z3c.request/trunk/src/z3c/request/README.txt
===================================================================
--- z3c.request/trunk/src/z3c/request/README.txt	                        (rev 0)
+++ z3c.request/trunk/src/z3c/request/README.txt	2009-08-18 14:46:51 UTC (rev 102911)
@@ -0,0 +1,38 @@
+z3c.request
+===========
+
+This package provides a common interface for browser request implementations.
+
+There is not much we can test except that IView is importable and an interface:
+
+    >>> from z3c.request.interfaces import IRequest
+    >>> from zope.interface import Interface
+    >>> Interface.providedBy(IRequest)
+    True
+
+The WebOb Request class will automatically implement the IRequest interface:
+
+    >>> import webob
+    >>> IRequest.implementedBy(webob.Request)
+    True
+
+WebOb Request objects will automatically provide the IRequest interface:
+
+    >>> obj = webob.Request({})
+    >>> IRequest.providedBy(obj)
+    True
+
+The zope.publisher Request classes will automatically implement the IRequest
+interface:
+
+    >>> from zope.publisher.base import BaseRequest
+    >>> IRequest.implementedBy(BaseRequest)
+    True
+
+The zope.publisher Request objects will automatically provide the IRequest
+interface:
+
+    >>> request = BaseRequest(None, None)
+    >>> IRequest.providedBy(request)
+    True
+

Added: z3c.request/trunk/src/z3c/request/__init__.py
===================================================================
--- z3c.request/trunk/src/z3c/request/__init__.py	                        (rev 0)
+++ z3c.request/trunk/src/z3c/request/__init__.py	2009-08-18 14:46:51 UTC (rev 102911)
@@ -0,0 +1,35 @@
+##############################################################################
+#
+# Copyright (c) 2009 Fabio Tranchitella <fabio at tranchitella.it>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+"""
+$Id$
+"""
+
+from z3c.request.interfaces import IRequest, IWebObRequest
+
+from zope.interface import classImplements
+
+try:
+    import webob
+except ImportError:
+    pass
+else:
+    classImplements(webob.Request, IWebObRequest)
+
+try:
+    from zope.publisher import base
+except ImportError:
+    pass
+else:
+    classImplements(base.BaseRequest, IRequest)


Property changes on: z3c.request/trunk/src/z3c/request/__init__.py
___________________________________________________________________
Added: svn:keywords
   + Id

Added: z3c.request/trunk/src/z3c/request/interfaces.py
===================================================================
--- z3c.request/trunk/src/z3c/request/interfaces.py	                        (rev 0)
+++ z3c.request/trunk/src/z3c/request/interfaces.py	2009-08-18 14:46:51 UTC (rev 102911)
@@ -0,0 +1,27 @@
+##############################################################################
+#
+# Copyright (c) 2009 Fabio Tranchitella <fabio at tranchitella.it>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+"""
+$Id$
+"""
+
+from zope.interface import Interface
+
+
+class IRequest(Interface):
+    """Generic interface for request objects"""
+
+
+class IWebObRequest(IRequest):
+    """Generic for WebOb.Request objects"""


Property changes on: z3c.request/trunk/src/z3c/request/interfaces.py
___________________________________________________________________
Added: svn:keywords
   + Id

Added: z3c.request/trunk/src/z3c/request/tests.py
===================================================================
--- z3c.request/trunk/src/z3c/request/tests.py	                        (rev 0)
+++ z3c.request/trunk/src/z3c/request/tests.py	2009-08-18 14:46:51 UTC (rev 102911)
@@ -0,0 +1,33 @@
+##############################################################################
+#
+# Copyright (c) 2009 Fabio Tranchitella <fabio at tranchitella.it>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+"""
+$Id$
+"""
+
+import unittest
+
+from zope.testing import doctest
+
+
+docfiles = [
+    'README.txt',
+]
+
+
+def test_suite():
+    tests = []
+    for d in docfiles:
+        tests.append(doctest.DocFileSuite(d, optionflags=doctest.ELLIPSIS))
+    return unittest.TestSuite(tests)


Property changes on: z3c.request/trunk/src/z3c/request/tests.py
___________________________________________________________________
Added: svn:keywords
   + Id



More information about the Checkins mailing list