diff -Nru pastedeploy-1.3.3/debian/changelog pastedeploy-1.5.0/debian/changelog --- pastedeploy-1.3.3/debian/changelog 2011-09-30 16:37:47.000000000 +0000 +++ pastedeploy-1.5.0/debian/changelog 2011-09-30 16:31:53.000000000 +0000 @@ -1,16 +1,31 @@ -pastedeploy (1.3.3-3ubuntu2) lucid; urgency=low +pastedeploy (1.5.0-2ubuntu1~openstack~natty1) natty; urgency=low - * debian/control: Add python-paste to fix a FTBFS in the - testsuite. + * Backported for OpenStack for natty - -- Chuck Short Thu, 28 Jan 2010 08:56:27 -0500 + -- Monty Taylor Fri, 30 Sep 2011 09:31:53 -0700 -pastedeploy (1.3.3-3ubuntu1) lucid; urgency=low +pastedeploy (1.5.0-2ubuntu1~openstack) oneiric; urgency=low - * debian/control, debian/rules, - debian/patches/02_enable-testsuite.dpatch: Enable test suite. + * Removed dh_python2 hardcoding. - -- Chuck Short Wed, 27 Jan 2010 13:30:44 -0500 + -- Monty Taylor Fri, 30 Sep 2011 09:30:47 -0700 + +pastedeploy (1.5.0-2) unstable; urgency=low + + * Remove .pth file (introduced in last upload by accident) + * Add build-indep and build-arch targets in debian/rules + + -- Piotr Ożarowski Thu, 22 Sep 2011 21:13:16 +0200 + +pastedeploy (1.5.0-1) unstable; urgency=low + + * New upstream release + * Convert to dh_python2 + - recommend python-pastescript >= 1.7.3-6~ + * Source format changed to 3.0 (quilt) + * Standards-Version bumped to 3.9.2 (no changes needed) + + -- Piotr Ożarowski Sat, 28 May 2011 17:31:01 +0200 pastedeploy (1.3.3-3) unstable; urgency=low diff -Nru pastedeploy-1.3.3/debian/control pastedeploy-1.5.0/debian/control --- pastedeploy-1.3.3/debian/control 2011-09-30 16:37:47.000000000 +0000 +++ pastedeploy-1.5.0/debian/control 2011-09-30 16:31:33.000000000 +0000 @@ -1,22 +1,22 @@ Source: pastedeploy Section: python Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Piotr Ożarowski +Maintainer: Piotr Ożarowski Uploaders: Debian Python Modules Team -Build-Depends: debhelper (>= 5), dpatch -Build-Depends-Indep: python (>= 2.3.5-11), python-all-dev, python-support (>= 0.6.4), python-setuptools (>= 0.6b3-1~), python-docutils, python-nose, python-paste -Standards-Version: 3.8.3 +Build-Depends: debhelper (>= 5) +Build-Depends-Indep: python-all (>= 2.6), + python-setuptools (>= 0.6b3-1~), + python-docutils, python-support +Standards-Version: 3.9.2 Homepage: http://pythonpaste.org/deploy/ -XS-Python-Version: all Vcs-Svn: svn://svn.debian.org/python-modules/packages/pastedeploy/trunk/ Vcs-Browser: http://svn.debian.org/viewsvn/python-modules/packages/pastedeploy/trunk/ +X-Python-Version: >= 2.4 Package: python-pastedeploy Architecture: all -Depends: ${python:Depends}, python-pkg-resources -Recommends: python-pastescript (>= 1.6.2-3) -XB-Python-Version: ${python:Versions} +Depends: ${python:Depends}, ${misc:Depends}, python-pkg-resources +Recommends: python-pastescript (>= 1.7.3-6~) Enhances: python-paste Description: load, configure, and compose WSGI applications and servers Paste Deployment is a system for finding and configuring WSGI applications and diff -Nru pastedeploy-1.3.3/debian/patches/00list pastedeploy-1.5.0/debian/patches/00list --- pastedeploy-1.3.3/debian/patches/00list 2011-09-30 16:37:47.000000000 +0000 +++ pastedeploy-1.5.0/debian/patches/00list 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -01_change_templates_path -02_enable-testsuite diff -Nru pastedeploy-1.3.3/debian/patches/01_change_templates_path.dpatch pastedeploy-1.5.0/debian/patches/01_change_templates_path.dpatch --- pastedeploy-1.3.3/debian/patches/01_change_templates_path.dpatch 2011-09-30 16:37:47.000000000 +0000 +++ pastedeploy-1.5.0/debian/patches/01_change_templates_path.dpatch 2011-09-30 16:31:33.000000000 +0000 @@ -1,19 +1,14 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 01_change_templates_path.dpatch by Piotr Ożarowski -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: paster's templates are outside site-packages in Debian - -@DPATCH@ -diff -urNad pastedeploy-1.3.1~/paste/deploy/paster_templates.py pastedeploy-1.3.1/paste/deploy/paster_templates.py ---- pastedeploy-1.3.1~/paste/deploy/paster_templates.py 2007-06-26 19:16:23.000000000 +0200 -+++ pastedeploy-1.3.1/paste/deploy/paster_templates.py 2008-05-24 18:54:27.000000000 +0200 -@@ -5,7 +5,7 @@ +# 01_change_templates_path.dpatch by Piotr Ożarowski +# +# paster's templates are outside site-packages in Debian +--- pastedeploy-1.5.0.orig/paste/deploy/paster_templates.py ++++ pastedeploy-1.5.0/paste/deploy/paster_templates.py +@@ -9,7 +9,7 @@ from paste.deploy.compat import print_ class PasteDeploy(Template): - _template_dir = 'paster_templates/paste_deploy' + _template_dir = '/usr/share/paster_templates/paste_deploy' summary = "A web application deployed through paste.deploy" - + egg_plugins = ['PasteDeploy'] diff -Nru pastedeploy-1.3.3/debian/patches/02_enable-testsuite.dpatch pastedeploy-1.5.0/debian/patches/02_enable-testsuite.dpatch --- pastedeploy-1.3.3/debian/patches/02_enable-testsuite.dpatch 2011-09-30 16:37:47.000000000 +0000 +++ pastedeploy-1.5.0/debian/patches/02_enable-testsuite.dpatch 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run - -@DPATCH@ -diff -Naurp PasteDeploy-1.3.3.orig/setup.py PasteDeploy-1.3.3/setup.py ---- PasteDeploy-1.3.3.orig/setup.py 2009-02-11 17:29:24.000000000 -0500 -+++ PasteDeploy-1.3.3/setup.py 2010-01-27 13:15:48.903127132 -0500 -@@ -39,6 +39,8 @@ For the latest changes see the `news fil - packages=find_packages(exclude='tests'), - include_package_data=True, - zip_safe=False, -+ test_suite='nose.collector', -+ tests_require=['nose>=0.11'], - extras_require={ - 'Config': [], - 'Paste': ['Paste'], -diff -Naurp PasteDeploy-1.3.3.orig/tests/conftest.py PasteDeploy-1.3.3/tests/conftest.py ---- PasteDeploy-1.3.3.orig/tests/conftest.py 2009-02-11 17:29:23.000000000 -0500 -+++ PasteDeploy-1.3.3/tests/conftest.py 1969-12-31 19:00:00.000000000 -0500 -@@ -1,14 +0,0 @@ --import os --import sys -- --here = os.path.dirname(__file__) --base = os.path.dirname(here) --sys.path.insert(0, base) -- --# We can only import this after we adjust the paths --import pkg_resources -- --# Make absolutely sure we're testing *this* package, not --# some other installed package --pkg_resources.require('PasteDeploy') -- -diff -Naurp PasteDeploy-1.3.3.orig/tests/__init__.py PasteDeploy-1.3.3/tests/__init__.py ---- PasteDeploy-1.3.3.orig/tests/__init__.py 1969-12-31 19:00:00.000000000 -0500 -+++ PasteDeploy-1.3.3/tests/__init__.py 2010-01-27 13:18:31.543126767 -0500 -@@ -0,0 +1,13 @@ -+import os -+import sys -+ -+here = os.path.dirname(__file__) -+base = os.path.dirname(here) -+sys.path.insert(0, base) -+ -+# We can only import this after we ajdust the paths -+import pkg_resources -+ -+# Make absolutely sure we're testing *this* package, no -+# some other installed package -+pkg_resources.require('PasteDeploy') -diff -Naurp PasteDeploy-1.3.3.orig/tests/test_config_middleware.py PasteDeploy-1.3.3/tests/test_config_middleware.py ---- PasteDeploy-1.3.3.orig/tests/test_config_middleware.py 2009-02-11 17:29:23.000000000 -0500 -+++ PasteDeploy-1.3.3/tests/test_config_middleware.py 2010-01-27 13:16:46.883126463 -0500 -@@ -1,6 +1,6 @@ -+from nose.tools import assert_raises - from paste.deploy.config import ConfigMiddleware - from paste.fixture import TestApp --from py.test import raises - - class Bug(Exception): pass - -@@ -14,5 +14,5 @@ def app_with_exception(environ, start_re - def test_error(): - wrapped = ConfigMiddleware(app_with_exception, {'test': 1}) - test_app = TestApp(wrapped) -- raises(Bug, "test_app.get('/')") -+ assert_raises(Bug, test_app.get, '/') diff -Nru pastedeploy-1.3.3/debian/patches/series pastedeploy-1.5.0/debian/patches/series --- pastedeploy-1.3.3/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ pastedeploy-1.5.0/debian/patches/series 2011-09-30 16:31:33.000000000 +0000 @@ -0,0 +1 @@ +01_change_templates_path.dpatch diff -Nru pastedeploy-1.3.3/debian/README.source pastedeploy-1.5.0/debian/README.source --- pastedeploy-1.3.3/debian/README.source 2011-09-30 16:37:47.000000000 +0000 +++ pastedeploy-1.5.0/debian/README.source 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -This package is using dpatch patch system. - -To get the fully patched source after unpacking the source package, cd to -the root level of the source package and run `./debian/rules patch` diff -Nru pastedeploy-1.3.3/debian/rules pastedeploy-1.5.0/debian/rules --- pastedeploy-1.3.3/debian/rules 2011-09-30 16:37:47.000000000 +0000 +++ pastedeploy-1.5.0/debian/rules 2011-09-30 16:31:33.000000000 +0000 @@ -2,21 +2,23 @@ #export DH_VERBOSE=1 -DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p') PYVERS=$(shell pyversions -vr) DOCS=$(shell cd docs && find ./ -maxdepth 1 -name "*.txt" -not -name "license.txt" -printf "%p " | sed "s/.txt//g") PKGDIR=$(CURDIR)/debian/python-pastedeploy +include /usr/share/python/python.mk -include /usr/share/dpatch/dpatch.make +DH_PYTHON2 = $(shell test -f /usr/bin/dh_python2 && echo "dh_python2 -i" || echo "dh_pysupport") -clean: unpatch +clean: dh_testdir dh_testroot rm -rf dist build find . -name '*\.py[co]' -delete dh_clean build-docs $(PYVERS:%=install-python%) -build: patch build-docs +build: build-indep +build-indep: build-docs +build-arch: build-docs: dh_installdirs @@ -27,22 +29,16 @@ touch $@ install: build $(PYVERS:%=install-python%) -install-python%: patch - python$* setup.py install --prefix=/usr \ - --single-version-externally-managed \ - --root $(PKGDIR) \ - --install-lib=/usr/lib/python$*/site-packages - # run the testuiste - python$* setup.py nosetests +install-python%: + python$* setup.py install --root $(PKGDIR) \ + --single-version-externally-managed $(py_setup_install_args) # pth file is not needed - rm -f $(PKGDIR)/usr/lib/python$*/site-packages/PasteDeploy-${DEB_UPSTREAM_VERSION}-py$*-nspkg.pth - # python-support's namespace feature will handle this - rm -f $(PKGDIR)/usr/lib/python$*/site-packages/paste/__init__.py + find $(PKGDIR) \( -name '*.pth' -or -name 'namespace_packages.txt' \) -delete # move templates outside site-packages if [ -d $(PKGDIR)/usr/share/paster_templates ]; \ - then rm -rf $(PKGDIR)/usr/lib/python$*/site-packages/paste/deploy/paster_templates; \ + then rm -r $(PKGDIR)$(call py_libdir,$*)/paste/deploy/paster_templates;\ else \ - mv $(PKGDIR)/usr/lib/python$*/site-packages/paste/deploy/paster_templates \ + mv $(PKGDIR)$(call py_libdir,$*)/paste/deploy/paster_templates \ $(PKGDIR)/usr/share/;\ fi @@ -52,7 +48,7 @@ dh_installchangelogs -i docs/news.txt dh_installdocs -i dh_link usr/share/doc/python-pastedeploy/docs /usr/share/doc/python-paste/docs/deploy - dh_pysupport -i + ${DH_PYTHON2} dh_compress -i -X.py dh_fixperms -i dh_installdeb -i @@ -64,4 +60,4 @@ binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install build +.PHONY: clean build build-arch build-indep binary binary-arch binary-indep install diff -Nru pastedeploy-1.3.3/debian/source/format pastedeploy-1.5.0/debian/source/format --- pastedeploy-1.3.3/debian/source/format 1970-01-01 00:00:00.000000000 +0000 +++ pastedeploy-1.5.0/debian/source/format 2011-09-30 16:37:47.000000000 +0000 @@ -0,0 +1 @@ +3.0 (quilt) diff -Nru pastedeploy-1.3.3/docs/conf.py pastedeploy-1.5.0/docs/conf.py --- pastedeploy-1.3.3/docs/conf.py 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/docs/conf.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Paste documentation build configuration file, created by -# sphinx-quickstart on Tue Apr 22 22:08:49 2008. -# -# 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. - -import sys - -# If your extensions are in another directory, add it here. -#sys.path.append('some/directory') - -# 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'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix of source filenames. -source_suffix = '.txt' - -# The master toctree document. -master_doc = 'index' - -# General substitutions. -project = 'Paste Deploy' -copyright = '2008, Ian Bicking' - -# The default replacements for |version| and |release|, also used in various -# other places throughout the built documents. -# -# The short X.Y version. -version = '1.3' -# The full version, including alpha/beta/rc tags. -release = '1.3.3' - -# 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 = ['include/contact.txt', 'include/reference_header.txt'] - -# 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 -# ----------------------- - -# 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 = 'default.css' - -# 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 - -# Content template for the index page. -#html_index = '' - -# 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 true, the reST sources are included in the HTML build as _sources/. -#html_copy_source = True - -# Output file base name for HTML help builder. -htmlhelp_basename = 'PasteDeploydoc' - - -# 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 = [] - -# 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 diff -Nru pastedeploy-1.3.3/docs/index.txt pastedeploy-1.5.0/docs/index.txt --- pastedeploy-1.3.3/docs/index.txt 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/docs/index.txt 2011-05-24 01:01:25.000000000 +0000 @@ -64,18 +64,21 @@ Installation ------------ -First install `setuptools -`_. +First make sure you have either +`setuptools `_ or its +modern replacement +`distribute `_ installed. +For Python 3.x you need distribute as setuptools does not work on it. -You can install Paste Deployment by installing `easy_install -`_ and running:: +Then you can install Paste Deployment using `pip +`_ by running:: - $ sudo easy_install.py PasteDeploy + $ sudo pip install PasteDeploy If you want to track development, do:: - $ svn co http://svn.pythonpaste.org/Paste/Deploy/trunk Paste-Deploy - $ cd Paste-Deploy + $ hg clone http://bitbucket.org/ianb/pastedeploy + $ cd pastedeploy $ sudo python setup.py develop This will install the package globally, but will load the files in the @@ -85,7 +88,7 @@ page `_. A complimentary package is `Paste Script `_. To install -that use ``easy_install PasteScript`` (or ``easy_install +that, use ``pip install PasteScript`` (or ``pip install PasteScript==dev``). From the User Perspective @@ -126,6 +129,7 @@ use = egg:Paste#urlmap / = home /blog = blog + /wiki = wiki /cms = config:cms.ini [app:home] @@ -142,6 +146,10 @@ use = egg:BlogApp database = sqlite:/home/me/blog.db + [app:wiki] + use = call:mywiki.main:application + database = sqlite:/home/me/wiki.db + I'll explain each section in detail now:: [composite:main] @@ -155,7 +163,7 @@ composite application named ``urlmap`` from the ``Paste`` package. ``urlmap`` is a particularly common composite application -- it uses a path prefix to map your request to another application. These are -the applications like "home", "blog" and "config:cms.ini". The last +the applications like "home", "blog", "wiki" and "config:cms.ini". The last one just refers to another file ``cms.ini`` in the same directory. Next up:: @@ -173,7 +181,7 @@ in lieu of relative filenames (which depend on the current directory, which can change depending how the server is run). -Lastly:: +Then:: [filter-app:blog] use = egg:Authentication#auth @@ -192,16 +200,29 @@ could imagine it logs people in and checks permissions. That last section is just a reference to an application that you -probably installed with ``easy_install BlogApp``, and one bit of +probably installed with ``pip install BlogApp``, and one bit of configuration you passed to it (``database``). +Lastly:: + + [app:wiki] + use = call:mywiki.main:application + database = sqlite:/home/me/wiki.db + +This section is similar to the previous one, with one important difference. +Instead of an entry point in an egg, it refers directly to the ``application`` +variable in the ``mywiki.main`` module. The reference consist of two parts, +separated by a colon. The left part is the full name of the module and the +right part is the path to the variable, as a Python expression relative to the +containing module. + So, that's most of the features you'll use. Basic Usage ----------- The basic way you'll use Paste Deployment is to load `WSGI -`_ applications. Many +`_ applications. Many Python frameworks now support WSGI, so applications written for these frameworks should be usable. @@ -269,6 +290,10 @@ [app:myotherapp] use = egg:MyApp + # or a callable from a module: + [app:mythirdapp] + use = call:my.project:myapplication + # or even another section: [app:mylastapp] use = myotherapp @@ -425,8 +450,9 @@ `Python Eggs `_ are a distribution and installation format produced by `setuptools -`_ that adds -metadata to a normal Python package (among other things). +`_ and +`distribute `_ that adds metadata to a +normal Python package (among other things). You don't need to understand a whole lot about Eggs to use them. If you have a `distutils @@ -603,7 +629,7 @@ s.serve_forever() return serve -An implementation of ``Server`` is left to the user. +The implementation of ``Server`` is left to the user. ``paste.server_runner`` ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -614,9 +640,6 @@ Outstanding Issues ------------------ -* Should add a ``python:`` scheme for loading objects out of modules - directly. It has to include the protocol somehow...? - * Should there be a "default" protocol for each type of object? Since there's currently only one protocol, it seems like it makes sense (in the future there could be multiple). Except that diff -Nru pastedeploy-1.3.3/docs/modules/config.txt pastedeploy-1.5.0/docs/modules/config.txt --- pastedeploy-1.3.3/docs/modules/config.txt 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/docs/modules/config.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -:mod:`paste.deploy.config` -- Configuration and Environment middleware -====================================================================== - -.. automodule:: paste.deploy.config - -Module Contents ---------------- - -.. autoclass:: DispatchingConfig -.. autoclass:: ConfigMiddleware -.. autoclass:: PrefixMiddleware - -.. comment: FIXME: do something about CONFIG (manual docs?) diff -Nru pastedeploy-1.3.3/docs/modules/converters.txt pastedeploy-1.5.0/docs/modules/converters.txt --- pastedeploy-1.3.3/docs/modules/converters.txt 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/docs/modules/converters.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -:mod:`paste.deploy.converters` -- Conversion helpers for String Configuration -============================================================================= - -.. automodule:: paste.deploy.converters - -Module Contents ---------------- - -.. autofunction:: asbool -.. autofunction:: asint -.. autofunction:: aslist diff -Nru pastedeploy-1.3.3/docs/modules/loadwsgi.txt pastedeploy-1.5.0/docs/modules/loadwsgi.txt --- pastedeploy-1.3.3/docs/modules/loadwsgi.txt 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/docs/modules/loadwsgi.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -:mod:`paste.deploy.loadwsgi` -- Load WSGI applications from config files -======================================================================== - -.. automodule:: paste.deploy.loadwsgi - -Module Contents ---------------- - -.. autofunction:: loadapp -.. autofunction:: loadserver -.. autofunction:: loadfilter -.. autofunction;: appconfig - diff -Nru pastedeploy-1.3.3/docs/news.txt pastedeploy-1.5.0/docs/news.txt --- pastedeploy-1.3.3/docs/news.txt 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/docs/news.txt 2011-05-24 20:39:58.000000000 +0000 @@ -1,6 +1,32 @@ Paste Deployment News ===================== +1.5.0 +----- + +* Project is now maintained by Alex Grönholm + +* Was printing extraneous data when calling setup.py + +* Fixed missing paster template files (fixes "paster create -t paste.deploy") + +* Excluded tests from release distributions + +* Added support for the "call:" protocol for loading apps directly as + functions (contributed by Jason Stitt) + +* Added Python 3.x support + +* Dropped Python 2.4 support + +* Removed the ``paste.deploy.epdesc`` and ``paste.deploy.interfaces`` modules + -- contact the maintainer if you actually needed them + +1.3.4 +----- + +* Fix loadconfig path handling on Jython on Windows. + 1.3.3 ----- diff -Nru pastedeploy-1.3.3/docs/_static/paste.css pastedeploy-1.5.0/docs/_static/paste.css --- pastedeploy-1.3.3/docs/_static/paste.css 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/docs/_static/paste.css 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -a.invisible-link { - color: #fff; - text-decoration: none; -} - -a.invisible-link:visited { - color: #fff; - text-decoration: none; -} - -a.invisible:link { - color: #fff; - text-decoration: none; -} - diff -Nru pastedeploy-1.3.3/docs/_templates/layout.html pastedeploy-1.5.0/docs/_templates/layout.html --- pastedeploy-1.3.3/docs/_templates/layout.html 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/docs/_templates/layout.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -{% extends "!layout.html" %} - -{% block extrahead %} -{{ super() }} - -{% endblock %} - -{% block sidebartoc %} -

Python Paste

- - - -{{ super() }} -{% endblock %} diff -Nru pastedeploy-1.3.3/MANIFEST.in pastedeploy-1.5.0/MANIFEST.in --- pastedeploy-1.3.3/MANIFEST.in 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/MANIFEST.in 2011-05-22 04:47:11.000000000 +0000 @@ -1,3 +1,2 @@ -include docs/*.html include docs/*.txt -exclude docs/rebuild +recursive-include paste/deploy/paster_templates * diff -Nru pastedeploy-1.3.3/paste/deploy/compat.py pastedeploy-1.5.0/paste/deploy/compat.py --- pastedeploy-1.3.3/paste/deploy/compat.py 1970-01-01 00:00:00.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/compat.py 2011-05-22 04:47:11.000000000 +0000 @@ -0,0 +1,30 @@ +# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) +# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php +"""Python 2<->3 compatibility module""" +import sys + + +def print_(template, *args, **kwargs): + template = str(template) + if args: + template = template % args + elif kwargs: + template = template % kwargs + sys.stdout.writelines(template) + +if sys.version_info < (3, 0): + basestring = basestring + from ConfigParser import ConfigParser + from urllib import unquote + iteritems = lambda d: d.iteritems() + + def reraise(t, e, tb): + exec('raise t, e, tb', dict(t=t, e=e, tb=tb)) +else: + basestring = str + from configparser import ConfigParser + from urllib.parse import unquote + iteritems = lambda d: d.items() + + def reraise(t, e, tb): + exec('raise e from tb', dict(e=e, tb=tb)) diff -Nru pastedeploy-1.3.3/paste/deploy/config.py pastedeploy-1.5.0/paste/deploy/config.py --- pastedeploy-1.3.3/paste/deploy/config.py 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/config.py 2011-05-22 04:47:11.000000000 +0000 @@ -3,25 +3,27 @@ """Paste Configuration Middleware and Objects""" import threading import re + # Loaded lazily wsgilib = None local = None __all__ = ['DispatchingConfig', 'CONFIG', 'ConfigMiddleware', 'PrefixMiddleware'] + def local_dict(): global config_local, local try: return config_local.wsgi_dict except NameError: - from paste.deploy.util.threadinglocal import local - config_local = local() + config_local = threading.local() config_local.wsgi_dict = result = {} return result except AttributeError: config_local.wsgi_dict = result = {} return result + class DispatchingConfig(object): """ @@ -45,7 +47,7 @@ self.dispatching_id = 0 while 1: self._local_key = 'paste.processconfig_%i' % self.dispatching_id - if not local_dict().has_key(self._local_key): + if not self._local_key in local_dict(): break self.dispatching_id += 1 finally: @@ -94,7 +96,7 @@ def pop_process_config(self, conf=None): self._pop_from(self._process_configs, conf) - + def __getattr__(self, attr): conf = self.current_conf() if conf is None: @@ -123,7 +125,7 @@ def __contains__(self, key): # I thought __getattr__ would catch this, but apparently not - return self.has_key(key) + return key in self def __setitem__(self, key, value): # I thought __getattr__ would catch this, but apparently not @@ -132,6 +134,7 @@ CONFIG = DispatchingConfig() + class ConfigMiddleware(object): """ @@ -156,7 +159,7 @@ from paste import wsgilib popped_config = None if 'paste.config' in environ: - popped_config = environ['paste.config'] + popped_config = environ['paste.config'] conf = environ['paste.config'] = self.config.copy() app_iter = None CONFIG.push_thread_config(conf) @@ -182,6 +185,7 @@ new_app_iter = wsgilib.add_close(app_iter, close_config) return new_app_iter + def make_config_filter(app, global_conf, **local_conf): conf = global_conf.copy() conf.update(local_conf) @@ -189,16 +193,17 @@ make_config_middleware = ConfigMiddleware.__doc__ + class PrefixMiddleware(object): """Translate a given prefix into a SCRIPT_NAME for the filtered application. - - PrefixMiddleware provides a way to manually override the root prefix + + PrefixMiddleware provides a way to manually override the root prefix (SCRIPT_NAME) of your application for certain, rare situations. - When running an application under a prefix (such as '/james') in + When running an application under a prefix (such as '/james') in FastCGI/apache, the SCRIPT_NAME environment variable is automatically - set to to the appropriate value: '/james'. Pylons' URL generating + set to to the appropriate value: '/james'. Pylons' URL generating functions, such as url_for, always take the SCRIPT_NAME value into account. One situation where PrefixMiddleware is required is when an application @@ -214,9 +219,9 @@ To filter your application through a PrefixMiddleware instance, add the following to the '[app:main]' section of your .ini file: - + .. code-block:: ini - + filter-with = proxy-prefix [filter:proxy-prefix] @@ -228,7 +233,7 @@ Also, unless disabled, the ``X-Forwarded-Server`` header will be translated to the ``Host`` header, for cases when that header is - lost in the proxying. Also ``X-Forwarded-Host``, + lost in the proxying. Also ``X-Forwarded-Host``, ``X-Forwarded-Scheme``, and ``X-Forwarded-Proto`` are translated. If ``force_port`` is set, SERVER_PORT and HTTP_HOST will be @@ -250,11 +255,12 @@ self.regprefix = re.compile("^%s(.*)$" % self.prefix) self.force_port = force_port self.scheme = scheme - + def __call__(self, environ, start_response): url = environ['PATH_INFO'] url = re.sub(self.regprefix, r'\1', url) - if not url: url = '/' + if not url: + url = '/' environ['PATH_INFO'] = url environ['SCRIPT_NAME'] = self.prefix if self.translate_forwarded_server: @@ -284,6 +290,7 @@ environ['wsgi.url_scheme'] = self.scheme return self.app(environ, start_response) + def make_prefix_middleware( app, global_conf, prefix='/', translate_forwarded_server=True, diff -Nru pastedeploy-1.3.3/paste/deploy/converters.py pastedeploy-1.5.0/paste/deploy/converters.py --- pastedeploy-1.3.3/paste/deploy/converters.py 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/converters.py 2011-05-22 04:47:11.000000000 +0000 @@ -1,26 +1,29 @@ # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php +from paste.deploy.compat import basestring + + def asbool(obj): - if isinstance(obj, (str, unicode)): + if isinstance(obj, basestring): obj = obj.strip().lower() if obj in ['true', 'yes', 'on', 'y', 't', '1']: return True elif obj in ['false', 'no', 'off', 'n', 'f', '0']: return False else: - raise ValueError( - "String is not true/false: %r" % obj) + raise ValueError("String is not true/false: %r" % obj) return bool(obj) + def asint(obj): try: return int(obj) - except (TypeError, ValueError), e: - raise ValueError( - "Bad integer value: %r" % obj) + except (TypeError, ValueError): + raise ValueError("Bad integer value: %r" % obj) + def aslist(obj, sep=None, strip=True): - if isinstance(obj, (str, unicode)): + if isinstance(obj, basestring): lst = obj.split(sep) if strip: lst = [v.strip() for v in lst] diff -Nru pastedeploy-1.3.3/paste/deploy/epdesc.py pastedeploy-1.5.0/paste/deploy/epdesc.py --- pastedeploy-1.3.3/paste/deploy/epdesc.py 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/epdesc.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -class AppFactoryDescription(object): - description = """ - This gives a factory/function that can create WSGI apps - """ - -class CompositeFactoryDescription(object): - description = """ - This gives a factory/function that can create WSGI apps, and has - access to the application creator so that it can in turn fetch - apps based on name. - """ - -class FilterAppFactoryDescription(object): - description = """ - This gives a factory/function that wraps a WSGI application to - create another WSGI application (typically applying middleware) - """ - -class FilterFactoryDescription(object): - description = """ - This gives a factory/function that return a function that can wrap - a WSGI application and returns another WSGI application. - paste.filter_app_factory is the same thing with less layers. - """ - -class ServerFactoryDescription(object): - description = """ - This gives a factory/function that creates a server, that can be - called with a WSGI application to run indefinitely. - paste.server_runner is the same thing with less layers. - """ - -class ServerRunnerDescription(object): - description = """ - This gives a factory/function that, given a WSGI application and - configuration, will serve the application indefinitely. - """ diff -Nru pastedeploy-1.3.3/paste/deploy/__init__.py pastedeploy-1.5.0/paste/deploy/__init__.py --- pastedeploy-1.3.3/paste/deploy/__init__.py 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/__init__.py 2011-05-22 04:47:11.000000000 +0000 @@ -1,10 +1,3 @@ # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php -from loadwsgi import * -try: - from config import CONFIG -except ImportError: - # @@: Or should we require Paste? Or should we put threadlocal - # into this package too? - pass - +from paste.deploy.loadwsgi import * diff -Nru pastedeploy-1.3.3/paste/deploy/interfaces.py pastedeploy-1.5.0/paste/deploy/interfaces.py --- pastedeploy-1.3.3/paste/deploy/interfaces.py 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/interfaces.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,202 +0,0 @@ -# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) -# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php -############################################################ -## Functions -############################################################ - -def loadapp(uri, name=None, relative_to=None, global_conf=None): - """ - Provided by ``paste.deploy.loadapp``. - - Load the specified URI as a WSGI application (returning IWSGIApp). - The ``name`` can be in the URI (typically as ``#name``). If it is - and ``name`` is given, the keyword argument overrides the URI. - - If the URI contains a relative filename, then ``relative_to`` is - used (if ``relative_to`` is not provided, then it is an error). - - ``global_conf`` is used to load the configuration (additions - override the values). ``global_conf`` is copied before modifying. - """ - -def loadfilter(uri, name=None, relative_to=None, global_conf=None): - """ - Provided by ``paste.deploy.loadfilter``. - - Like ``loadapp()``, except returns in IFilter object. - """ - -def loadserver(uri, name=None, relative_to=None, global_conf=None): - """ - Provided by ``paste.deploy.loadserver``. - - Like ``loadapp()``, except returns in IServer object. - """ - -############################################################ -## Factories -############################################################ - -class IPasteAppFactory(object): - - """ - This is the spec for the ``paste.app_factory`` - protocol/entry_point. - """ - - def __call__(global_conf, **local_conf): - """ - Returns a WSGI application (IWSGIAPP) given the global - configuration and the local configuration passed in as keyword - arguments. - - All keys are strings, but values in local_conf may not be - valid Python identifiers (if you use ``**kw`` you can still - capture these values). - """ - -class IPasteCompositFactory(object): - - """ - This is the spec for the ``paste.composit_factory`` - protocol/entry_point. - - This also produces WSGI applications, like ``paste.app_factory``, - but is given more access to the context in which it is loaded. - """ - - def __call__(loader, global_conf, **local_conf): - """ - Like IPasteAppFactory this returns a WSGI application - (IWSGIApp). The ``loader`` value conforms to the ``ILoader`` - interface, and can be used to load (contextually) more - applications. - """ - -class IPasteFilterFactory(object): - - """ - This is the spec for the ``paste.filter_factory`` - protocol/entry_point. - """ - - def __call__(global_conf, **local_conf): - """ - Returns a IFilter object. - """ - -class IPasteFilterAppFactory(object): - - """ - This is the spec for the ``paste.filter_app_factory`` - protocol/entry_point. - """ - - def __call__(wsgi_app, global_conf, **local_conf): - """ - Returns a WSGI application that wraps ``wsgi_app``. - - Note that paste.deploy creates a wrapper for these - objects that implement the IFilter interface. - """ - -class IPasteServerFactory(object): - - """ - This is the spec for the ``paste.server_factory`` - protocol/entry_point. - """ - - def __call__(global_conf, **local_conf): - """ - Returns a IServer object. - """ - -class IPasteServerRunner(object): - - """ - This is the spec for the ``paste.server_runner`` - protocol/entry_point. - """ - - def __call__(wsgi_app, global_conf, **local_conf): - """ - Serves the given WSGI application. May serve once, many - times, forever; nothing about how the server works is - specified here. - - Note that paste.deploy creates a wrapper for these - objects that implement the IServer interface. - """ - -class ILoader(object): - - """ - This is an object passed into ``IPasteCompositFactory``. It is - currently implemented in ``paste.deploy.loadwsgi`` by - ``ConfigLoader`` and ``EggLoader``. - """ - - def get_app(name_or_uri, global_conf=None): - """ - Return an IWSGIApp object. If the loader supports named - applications, then you can use a simple name; otherwise - you must use a full URI. - - Any global configuration you pass in will be added; you should - generally pass through the global configuration you received. - """ - - def get_filter(name_or_uri, global_conf=None): - """ - Return an IFilter object, like ``get_app``. - """ - - def get_server(name_or_uri, global_conf=None): - """ - Return an IServer object, like ``get_app``. - """ - -############################################################ -## Objects -############################################################ - -class IWSGIApp(object): - - """ - This is an application that conforms to `PEP 333 - `_: Python Web Server - Gateway Interface v1.0 - """ - - def __call__(environ, start_response): - """ - Calls ``start_response(status_code, header_list)`` and returns - an iterator for the body of the response. - """ - -class IFilter(object): - - """ - A filter is a simple case of middleware, where an object - wraps a single WSGI application (IWSGIApp). - """ - - def __call__(wsgi_app): - """ - Returns an IWSGIApp object, typically one that wraps the - ``wsgi_app`` passed in. - """ - -class IServer(object): - - """ - A simple server interface. - """ - - def __call__(wsgi_app): - """ - Serves the given WSGI application. May serve once, many - times, forever; nothing about how the server works is - specified here. - """ diff -Nru pastedeploy-1.3.3/paste/deploy/loadwsgi.py pastedeploy-1.5.0/paste/deploy/loadwsgi.py --- pastedeploy-1.3.3/paste/deploy/loadwsgi.py 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/loadwsgi.py 2011-05-24 01:41:03.000000000 +0000 @@ -1,21 +1,26 @@ # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php +from __future__ import with_statement import os -import re import sys -import urllib -from ConfigParser import ConfigParser +import re + import pkg_resources -from paste.deploy.util.fixtypeerror import fix_call + +from paste.deploy.compat import ConfigParser, unquote, iteritems +from paste.deploy.util import fix_call, lookup_object __all__ = ['loadapp', 'loadserver', 'loadfilter', 'appconfig'] + ############################################################ ## Utility functions ############################################################ + def import_string(s): - return pkg_resources.EntryPoint.parse("x="+s).load(False) + return pkg_resources.EntryPoint.parse("x=" + s).load(False) + def _aslist(obj): """ @@ -29,6 +34,7 @@ else: return [obj] + def _flatten(lst): """ Flatten a nested list. @@ -40,11 +46,16 @@ result.extend(_flatten(item)) return result + class NicerConfigParser(ConfigParser): def __init__(self, filename, *args, **kw): ConfigParser.__init__(self, *args, **kw) self.filename = filename + if hasattr(self, '_interpolation'): + self._interpolation = self.InterpolateWrapper(self._interpolation) + + read_file = getattr(ConfigParser, 'read_file', ConfigParser.readfp) def defaults(self): """Return the defaults, with their values interpolated (with the @@ -53,25 +64,49 @@ Mainly to support defaults using values such as %(here)s """ defaults = ConfigParser.defaults(self).copy() - for key, val in defaults.iteritems(): - defaults[key] = self._interpolate('DEFAULT', key, val, defaults) + for key, val in iteritems(defaults): + defaults[key] = self.get('DEFAULT', key) or val return defaults def _interpolate(self, section, option, rawval, vars): + # Python < 3.2 try: return ConfigParser._interpolate( self, section, option, rawval, vars) - except Exception, e: + except Exception: + e = sys.exc_info()[1] args = list(e.args) - args[0] = 'Error in file %s, [%s] %s=%r: %s' % ( - self.filename, section, option, rawval, e) + args[0] = 'Error in file %s: %s' % (self.filename, e) e.args = tuple(args) + e.message = args[0] raise + class InterpolateWrapper(object): + # Python >= 3.2 + def __init__(self, original): + self._original = original + + def __getattr__(self, name): + return getattr(self._original, name) + + def before_get(self, parser, section, option, value, defaults): + try: + return self._original.before_get(parser, section, option, + value, defaults) + except Exception: + e = sys.exc_info()[1] + args = list(e.args) + args[0] = 'Error in file %s: %s' % (parser.filename, e) + e.args = tuple(args) + e.message = args[0] + raise + + ############################################################ ## Object types ############################################################ + class _ObjectType(object): name = None @@ -80,8 +115,8 @@ def __init__(self): # Normalize these variables: - self.egg_protocols = map(_aslist, _aslist(self.egg_protocols)) - self.config_prefixes = map(_aslist, _aslist(self.config_prefixes)) + self.egg_protocols = [_aslist(p) for p in _aslist(self.egg_protocols)] + self.config_prefixes = [_aslist(p) for p in _aslist(self.config_prefixes)] def __repr__(self): return '<%s protocols=%r prefixes=%r>' % ( @@ -92,6 +127,7 @@ return fix_call(context.object, context.global_conf, **context.local_conf) + class _App(_ObjectType): name = 'application' @@ -113,6 +149,7 @@ APP = _App() + class _Filter(_ObjectType): name = 'filter' egg_protocols = [['paste.filter_factory', 'paste.filter_app_factory']] @@ -134,6 +171,7 @@ FILTER = _Filter() + class _Server(_ObjectType): name = 'server' egg_protocols = [['paste.server_factory', 'paste.server_runner']] @@ -155,6 +193,7 @@ SERVER = _Server() + # Virtual type: (@@: There's clearly something crufty here; # this probably could be more elegant) class _PipeLine(_ObjectType): @@ -170,6 +209,7 @@ PIPELINE = _PipeLine() + class _FilterApp(_ObjectType): name = 'filter_app' @@ -180,6 +220,7 @@ FILTER_APP = _FilterApp() + class _FilterWith(_App): name = 'filtered_with' @@ -196,19 +237,24 @@ FILTER_WITH = _FilterWith() + ############################################################ ## Loaders ############################################################ + def loadapp(uri, name=None, **kw): return loadobj(APP, uri, name=name, **kw) + def loadfilter(uri, name=None, **kw): return loadobj(FILTER, uri, name=name, **kw) + def loadserver(uri, name=None, **kw): return loadobj(SERVER, uri, name=name, **kw) + def appconfig(uri, name=None, relative_to=None, global_conf=None): context = loadcontext(APP, uri, name=name, relative_to=relative_to, @@ -217,6 +263,7 @@ _loaders = {} + def loadobj(object_type, uri, name=None, relative_to=None, global_conf=None): context = loadcontext( @@ -224,6 +271,7 @@ global_conf=global_conf) return context.create() + def loadcontext(object_type, uri, name=None, relative_to=None, global_conf=None): if '#' in uri: @@ -247,22 +295,16 @@ uri, path, name=name, relative_to=relative_to, global_conf=global_conf) + def _loadconfig(object_type, uri, path, name, relative_to, global_conf): + isabs = os.path.isabs(path) # De-Windowsify the paths: path = path.replace('\\', '/') - absolute_path = True - if sys.platform == 'win32': - _absolute_re = re.compile(r'^[a-zA-Z]:') - if not _absolute_re.search(path): - absolute_path = False - else: - if not path.startswith('/'): - absolute_path = False - if not absolute_path: + if not isabs: if not relative_to: raise ValueError( - "Cannot resolve relative uri %r; no context keyword " + "Cannot resolve relative uri %r; no relative_to keyword " "argument given" % uri) relative_to = relative_to.replace('\\', '/') if relative_to.endswith('/'): @@ -271,7 +313,7 @@ path = relative_to + '/' + path if path.startswith('///'): path = path[2:] - path = urllib.unquote(path) + path = unquote(path) loader = ConfigLoader(path) if global_conf: loader.update_defaults(global_conf, overwrite=False) @@ -279,6 +321,7 @@ _loaders['config'] = _loadconfig + def _loadegg(object_type, uri, spec, name, relative_to, global_conf): loader = EggLoader(spec) @@ -286,10 +329,20 @@ _loaders['egg'] = _loadegg + +def _loadfunc(object_type, uri, spec, name, relative_to, + global_conf): + + loader = FuncLoader(spec) + return loader.get_context(object_type, name, global_conf) + +_loaders['call'] = _loadfunc + ############################################################ ## Loaders ############################################################ + class _Loader(object): def get_app(self, name=None, global_conf=None): @@ -317,39 +370,31 @@ SERVER, name=name, global_conf=global_conf) _absolute_re = re.compile(r'^[a-zA-Z]+:') + def absolute_name(self, name): """ Returns true if the name includes a scheme """ if name is None: return False - return self._absolute_re.search(name) + return self._absolute_re.search(name) + class ConfigLoader(_Loader): def __init__(self, filename): self.filename = filename = filename.strip() - self.parser = NicerConfigParser(self.filename) - # Don't lower-case keys: - self.parser.optionxform = str - # Stupid ConfigParser ignores files that aren't found, so - # we have to add an extra check: - if not os.path.exists(filename): - if filename.strip() != filename: - raise OSError( - "File %r not found; trailing whitespace: " - "did you try to use a # on the same line as a filename? " - "(comments must be on their own line)" % filename) - raise OSError( - "File %r not found" % filename) - self.parser.read(filename) - self.parser._defaults.setdefault( - 'here', os.path.dirname(os.path.abspath(filename))) - self.parser._defaults.setdefault( - '__file__', os.path.abspath(filename)) + defaults = { + 'here': os.path.dirname(os.path.abspath(filename)), + '__file__': os.path.abspath(filename) + } + self.parser = NicerConfigParser(filename, defaults=defaults) + self.parser.optionxform = str # Don't lower-case keys + with open(filename) as f: + self.parser.read_file(f) def update_defaults(self, new_defaults, overwrite=True): - for key, value in new_defaults.items(): + for key, value in iteritems(new_defaults): if not overwrite and key in self.parser._defaults: continue self.parser._defaults[key] = value @@ -436,6 +481,20 @@ context.global_conf['__file__'] = global_conf['__file__'] # @@: Should loader be overwritten? context.loader = self + + if context.protocol is None: + # Determine protocol from section type + section_protocol = section.split(':', 1)[0] + if section_protocol in ('application', 'app'): + context.protocol = 'paste.app_factory' + elif section_protocol in ('composit', 'composite'): + context.protocol = 'paste.composit_factory' + else: + # This will work with 'server' and 'filter', otherwise it + # could fail but there is an error message already for + # bad protocols + context.protocol = 'paste.%s_factory' % context_protocol + return context def _context_from_explicit(self, object_type, local_conf, global_conf, @@ -542,8 +601,8 @@ found.append(name_prefix) name = 'main' for section in sections: - if section.startswith(name_prefix+':'): - if section[len(name_prefix)+1:].strip() == name: + if section.startswith(name_prefix + ':'): + if section[len(name_prefix) + 1:].strip() == name: found.append(section) return found @@ -604,6 +663,32 @@ % (name, self.spec, ', '.join(_flatten(protocol_options)))) return possible[0] + +class FuncLoader(_Loader): + """ Loader that supports specifying functions inside modules, without + using eggs at all. Configuration should be in the format: + use = call:my.module.path:function_name + + Dot notation is supported in both the module and function name, e.g.: + use = call:my.module.path:object.method + """ + def __init__(self, spec): + self.spec = spec + if not ':' in spec: + raise LookupError("Configuration not in format module:function") + + def get_context(self, object_type, name=None, global_conf=None): + obj = lookup_object(self.spec) + return LoaderContext( + obj, + object_type, + None, # determine protocol from section type + global_conf or {}, + {}, + self, + ) + + class LoaderContext(object): def __init__(self, obj, object_type, protocol, @@ -632,6 +717,7 @@ conf.context = self return conf + class AttrDict(dict): """ A dictionary that can be assigned to. diff -Nru pastedeploy-1.3.3/paste/deploy/paster_templates/paste_deploy/+package+/sampleapp.py_tmpl pastedeploy-1.5.0/paste/deploy/paster_templates/paste_deploy/+package+/sampleapp.py_tmpl --- pastedeploy-1.3.3/paste/deploy/paster_templates/paste_deploy/+package+/sampleapp.py_tmpl 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/paster_templates/paste_deploy/+package+/sampleapp.py_tmpl 2011-05-24 01:13:19.000000000 +0000 @@ -1,6 +1,8 @@ import cgi + from paste.deploy import CONFIG + def application(environ, start_response): # Note that usually you wouldn't be writing a pure WSGI # application, you might be using some framework or @@ -19,5 +21,4 @@ % (key, cgi.escape(repr(value)))) content.append('') return content - - + \ No newline at end of file diff -Nru pastedeploy-1.3.3/paste/deploy/paster_templates/paste_deploy/+package+/wsgiapp.py_tmpl pastedeploy-1.5.0/paste/deploy/paster_templates/paste_deploy/+package+/wsgiapp.py_tmpl --- pastedeploy-1.3.3/paste/deploy/paster_templates/paste_deploy/+package+/wsgiapp.py_tmpl 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/paster_templates/paste_deploy/+package+/wsgiapp.py_tmpl 2011-05-24 01:13:14.000000000 +0000 @@ -1,6 +1,8 @@ -import sampleapp from paste.deploy.config import ConfigMiddleware +import sampleapp + + def make_app( global_conf, # Optional and required configuration parameters @@ -20,4 +22,3 @@ # configuration dictionary we set up: app = ConfigMiddleware(app, conf) return app - diff -Nru pastedeploy-1.3.3/paste/deploy/paster_templates.py pastedeploy-1.5.0/paste/deploy/paster_templates.py --- pastedeploy-1.3.3/paste/deploy/paster_templates.py 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/paster_templates.py 2011-05-22 04:47:11.000000000 +0000 @@ -1,15 +1,19 @@ # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php import os + from paste.script.templates import Template +from paste.deploy.compat import print_ + + class PasteDeploy(Template): _template_dir = 'paster_templates/paste_deploy' summary = "A web application deployed through paste.deploy" - + egg_plugins = ['PasteDeploy'] - + required_templates = ['PasteScript#basic_package'] def post(self, command, output_dir, vars): @@ -26,8 +30,7 @@ ' main = %(package)s.wsgiapp:make_app\n') % vars, indent=False) if command.verbose: - print '*'*72 - print '* Run "paster serve docs/devel_config.ini" to run the sample application' - print '* on http://localhost:8080' - print '*'*72 - + print_('*' * 72) + print_('* Run "paster serve docs/devel_config.ini" to run the sample application') + print_('* on http://localhost:8080') + print_('*' * 72) diff -Nru pastedeploy-1.3.3/paste/deploy/util/fixtypeerror.py pastedeploy-1.5.0/paste/deploy/util/fixtypeerror.py --- pastedeploy-1.3.3/paste/deploy/util/fixtypeerror.py 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/util/fixtypeerror.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) -# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php -""" -Fixes the vague error message that you get when calling a function -with the wrong arguments. -""" -import inspect -import sys - -def fix_type_error(exc_info, callable, varargs, kwargs): - """ - Given an exception, this will test if the exception was due to a - signature error, and annotate the error with better information if - so. - - Usage:: - - try: - val = callable(*args, **kw) - except TypeError: - exc_info = fix_type_error(None, callable, args, kw) - raise exc_info[0], exc_info[1], exc_info[2] - """ - if exc_info is None: - exc_info = sys.exc_info() - if (exc_info[0] != TypeError - or str(exc_info[1]).find('arguments') == -1 - or getattr(exc_info[1], '_type_error_fixed', False)): - return exc_info - exc_info[1]._type_error_fixed = True - import inspect - argspec = inspect.formatargspec(*inspect.getargspec(callable)) - args = ', '.join(map(_short_repr, varargs)) - if kwargs and args: - args += ', ' - if kwargs: - kwargs = kwargs.items() - kwargs.sort() - args += ', '.join(['%s=...' % n for n, v in kwargs]) - gotspec = '(%s)' % args - msg = '%s; got %s, wanted %s' % (exc_info[1], gotspec, argspec) - exc_info[1].args = (msg,) - return exc_info - -def _short_repr(v): - v = repr(v) - if len(v) > 12: - v = v[:8]+'...'+v[-4:] - return v - -def fix_call(callable, *args, **kw): - """ - Call ``callable(*args, **kw)`` fixing any type errors that come - out. - """ - try: - val = callable(*args, **kw) - except TypeError: - exc_info = fix_type_error(None, callable, args, kw) - raise exc_info[0], exc_info[1], exc_info[2] - return val diff -Nru pastedeploy-1.3.3/paste/deploy/util/__init__.py pastedeploy-1.5.0/paste/deploy/util/__init__.py --- pastedeploy-1.3.3/paste/deploy/util/__init__.py 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/util/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) -# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php -# diff -Nru pastedeploy-1.3.3/paste/deploy/util/threadinglocal.py pastedeploy-1.5.0/paste/deploy/util/threadinglocal.py --- pastedeploy-1.3.3/paste/deploy/util/threadinglocal.py 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/util/threadinglocal.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) -# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php - -try: - import threading -except ImportError: - # No threads, so "thread local" means process-global - class local(object): - pass -else: - try: - local = threading.local - except AttributeError: - # Added in 2.4, but now we'll have to define it ourselves - import thread - class local(object): - - def __init__(self): - self.__dict__['__objs'] = {} - - def __getattr__(self, attr, g=thread.get_ident): - try: - return self.__dict__['__objs'][g()][attr] - except KeyError: - raise AttributeError( - "No variable %s defined for the thread %s" - % (attr, g())) - - def __setattr__(self, attr, value, g=thread.get_ident): - self.__dict__['__objs'].setdefault(g(), {})[attr] = value - - def __delattr__(self, attr, g=thread.get_ident): - try: - del self.__dict__['__objs'][g()][attr] - except KeyError: - raise AttributeError( - "No variable %s defined for thread %s" - % (attr, g())) - diff -Nru pastedeploy-1.3.3/paste/deploy/util.py pastedeploy-1.5.0/paste/deploy/util.py --- pastedeploy-1.3.3/paste/deploy/util.py 1970-01-01 00:00:00.000000000 +0000 +++ pastedeploy-1.5.0/paste/deploy/util.py 2011-05-23 19:51:07.000000000 +0000 @@ -0,0 +1,74 @@ +# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) +# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php +import inspect +import sys + +from paste.deploy.compat import reraise + + +def fix_type_error(exc_info, callable, varargs, kwargs): + """ + Given an exception, this will test if the exception was due to a + signature error, and annotate the error with better information if + so. + + Usage:: + + try: + val = callable(*args, **kw) + except TypeError: + exc_info = fix_type_error(None, callable, args, kw) + raise exc_info[0], exc_info[1], exc_info[2] + """ + if exc_info is None: + exc_info = sys.exc_info() + if (exc_info[0] != TypeError + or str(exc_info[1]).find('arguments') == -1 + or getattr(exc_info[1], '_type_error_fixed', False)): + return exc_info + exc_info[1]._type_error_fixed = True + argspec = inspect.formatargspec(*inspect.getargspec(callable)) + args = ', '.join(map(_short_repr, varargs)) + if kwargs and args: + args += ', ' + if kwargs: + kwargs = kwargs.items() + kwargs.sort() + args += ', '.join(['%s=...' % n for n, v in kwargs]) + gotspec = '(%s)' % args + msg = '%s; got %s, wanted %s' % (exc_info[1], gotspec, argspec) + exc_info[1].args = (msg,) + return exc_info + + +def _short_repr(v): + v = repr(v) + if len(v) > 12: + v = v[:8] + '...' + v[-4:] + return v + + +def fix_call(callable, *args, **kw): + """ + Call ``callable(*args, **kw)`` fixing any type errors that come out. + """ + try: + val = callable(*args, **kw) + except TypeError: + exc_info = fix_type_error(None, callable, args, kw) + reraise(*exc_info) + return val + + +def lookup_object(spec): + """ + Looks up a module or object from a some.module:func_name specification. + To just look up a module, omit the colon and everything after it. + """ + parts, target = spec.split(':') if ':' in spec else (spec, None) + module = __import__(parts) + + for part in parts.split('.')[1:] + ([target] if target else []): + module = getattr(module, part) + + return module diff -Nru pastedeploy-1.3.3/PasteDeploy.egg-info/entry_points.txt pastedeploy-1.5.0/PasteDeploy.egg-info/entry_points.txt --- pastedeploy-1.3.3/PasteDeploy.egg-info/entry_points.txt 2009-02-11 22:29:56.000000000 +0000 +++ pastedeploy-1.5.0/PasteDeploy.egg-info/entry_points.txt 2011-05-24 20:52:38.000000000 +0000 @@ -5,13 +5,4 @@ [paste.paster_create_template] paste_deploy=paste.deploy.paster_templates:PasteDeploy - - [paste.entry_point_description] - paste.app_factory = paste.deploy.epdesc:AppFactoryDescription - paste.composit_factory = paste.deploy.epdesc:CompositeFactoryDescription - paste.composite_factory = paste.deploy.epdesc:CompositeFactoryDescription - paste.filter_app_factory = paste.deploy.epdesc:FilterAppFactoryDescription - paste.filter_factory = paste.deploy.epdesc:FilterFactoryDescription - paste.server_factory = paste.deploy.epdesc:ServerFactoryDescription - paste.server_runner = paste.deploy.epdesc:ServerRunnerDescription \ No newline at end of file diff -Nru pastedeploy-1.3.3/PasteDeploy.egg-info/PKG-INFO pastedeploy-1.5.0/PasteDeploy.egg-info/PKG-INFO --- pastedeploy-1.3.3/PasteDeploy.egg-info/PKG-INFO 2009-02-11 22:29:56.000000000 +0000 +++ pastedeploy-1.5.0/PasteDeploy.egg-info/PKG-INFO 2011-05-24 20:52:38.000000000 +0000 @@ -1,18 +1,19 @@ Metadata-Version: 1.0 Name: PasteDeploy -Version: 1.3.3 +Version: 1.5.0 Summary: Load, configure, and compose WSGI applications and servers Home-page: http://pythonpaste.org/deploy/ -Author: Ian Bicking -Author-email: ianb@colorstudy.com +Author: Alex Gronholm +Author-email: alex.gronholm@nextday.fi License: MIT Description: This tool provides code to load WSGI applications and servers from URIs; these URIs can refer to Python Eggs for INI-style configuration files. `Paste Script `_ provides commands to serve applications based on this configuration file. - The latest version is available in a `Subversion repository - `_. + The latest version is available in a `Mercurial repository + `_ (or a `tarball + `_). For the latest changes see the `news file `_. @@ -23,9 +24,15 @@ Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2.5 +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.1 +Classifier: Programming Language :: Python :: 3.2 Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content -Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Internet :: WWW/HTTP :: WSGI Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware +Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Framework :: Paste diff -Nru pastedeploy-1.3.3/PasteDeploy.egg-info/SOURCES.txt pastedeploy-1.5.0/PasteDeploy.egg-info/SOURCES.txt --- pastedeploy-1.3.3/PasteDeploy.egg-info/SOURCES.txt 2009-02-11 22:29:56.000000000 +0000 +++ pastedeploy-1.5.0/PasteDeploy.egg-info/SOURCES.txt 2011-05-24 20:52:38.000000000 +0000 @@ -1,6 +1,4 @@ MANIFEST.in -regen-docs -setup.cfg setup.py PasteDeploy.egg-info/PKG-INFO PasteDeploy.egg-info/SOURCES.txt @@ -10,46 +8,17 @@ PasteDeploy.egg-info/not-zip-safe PasteDeploy.egg-info/requires.txt PasteDeploy.egg-info/top_level.txt -docs/conf.py docs/index.txt docs/license.txt docs/news.txt -docs/_static/paste.css -docs/_templates/layout.html -docs/modules/config.txt -docs/modules/converters.txt -docs/modules/loadwsgi.txt paste/__init__.py paste/deploy/__init__.py +paste/deploy/compat.py paste/deploy/config.py paste/deploy/converters.py -paste/deploy/epdesc.py -paste/deploy/interfaces.py paste/deploy/loadwsgi.py paste/deploy/paster_templates.py +paste/deploy/util.py paste/deploy/paster_templates/paste_deploy/+package+/sampleapp.py_tmpl paste/deploy/paster_templates/paste_deploy/+package+/wsgiapp.py_tmpl -paste/deploy/paster_templates/paste_deploy/docs/devel_config.ini_tmpl -paste/deploy/util/__init__.py -paste/deploy/util/fixtypeerror.py -paste/deploy/util/threadinglocal.py -tests/conftest.py -tests/fixture.py -tests/test_basic_app.py -tests/test_config.py -tests/test_config_middleware.py -tests/test_filter.py -tests/test_load_package.py -tests/fake_packages/FakeApp.egg/setup.py -tests/fake_packages/FakeApp.egg/FakeApp.egg-info/PKG-INFO -tests/fake_packages/FakeApp.egg/FakeApp.egg-info/entry_points.txt -tests/fake_packages/FakeApp.egg/FakeApp.egg-info/top_level.txt -tests/fake_packages/FakeApp.egg/fakeapp/__init__.py -tests/fake_packages/FakeApp.egg/fakeapp/apps.py -tests/fake_packages/FakeApp.egg/fakeapp/configapps.py -tests/sample_configs/basic_app.ini -tests/sample_configs/executable.ini -tests/sample_configs/test_config.ini -tests/sample_configs/test_config_included.ini -tests/sample_configs/test_filter.ini -tests/sample_configs/test_filter_with.ini \ No newline at end of file +paste/deploy/paster_templates/paste_deploy/docs/devel_config.ini_tmpl \ No newline at end of file diff -Nru pastedeploy-1.3.3/PKG-INFO pastedeploy-1.5.0/PKG-INFO --- pastedeploy-1.3.3/PKG-INFO 2009-02-11 22:30:03.000000000 +0000 +++ pastedeploy-1.5.0/PKG-INFO 2011-05-24 20:52:40.000000000 +0000 @@ -1,18 +1,19 @@ Metadata-Version: 1.0 Name: PasteDeploy -Version: 1.3.3 +Version: 1.5.0 Summary: Load, configure, and compose WSGI applications and servers Home-page: http://pythonpaste.org/deploy/ -Author: Ian Bicking -Author-email: ianb@colorstudy.com +Author: Alex Gronholm +Author-email: alex.gronholm@nextday.fi License: MIT Description: This tool provides code to load WSGI applications and servers from URIs; these URIs can refer to Python Eggs for INI-style configuration files. `Paste Script `_ provides commands to serve applications based on this configuration file. - The latest version is available in a `Subversion repository - `_. + The latest version is available in a `Mercurial repository + `_ (or a `tarball + `_). For the latest changes see the `news file `_. @@ -23,9 +24,15 @@ Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2.5 +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.1 +Classifier: Programming Language :: Python :: 3.2 Classifier: Topic :: Internet :: WWW/HTTP Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content -Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Internet :: WWW/HTTP :: WSGI Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware +Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Framework :: Paste diff -Nru pastedeploy-1.3.3/regen-docs pastedeploy-1.5.0/regen-docs --- pastedeploy-1.3.3/regen-docs 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/regen-docs 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -#!/bin/sh - -mkdir -p docs/_static docs/_build -sphinx-build -E -b html docs/ docs/_build || exit 1 -if [ "$1" = "publish" ] ; then - cd docs/ - echo "Uploading files..." - scp -r _build/* ianb@webwareforpython.org:/home/paste/htdocs/deploy/ -fi diff -Nru pastedeploy-1.3.3/setup.cfg pastedeploy-1.5.0/setup.cfg --- pastedeploy-1.3.3/setup.cfg 2009-02-11 22:30:03.000000000 +0000 +++ pastedeploy-1.5.0/setup.cfg 2011-05-24 20:52:40.000000000 +0000 @@ -1,33 +1,5 @@ -[pudge] -highlighter = pygments -title = Paste Deploy -dest = docs/html -docs = docs/index.txt docs/news.txt -settings = no_about=true - link1=/deploy/ paste.deploy - link2=/script/ paster script - link3=/download/ Download - extra_credits=Hosting courtesy of Tummy.com -modules = paste.deploy -theme = pythonpaste.org -mailing_list_url = http://pythonpaste.org/community/mailing-list.html -organization = Python Paste -organization_url = http://pythonpaste.org/ -trac_url = http://pythonpaste.org/trac/ - -[global] -command_packages = buildutils.pudge_command, buildutils.publish_command - [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 -[publish] -doc-dest = scp://ianb@webwareforpython.org/home/paste/htdocs/deploy -make-dirs = 1 -doc-dir = docs/html - -[aliases] -distribute = register sdist bdist_egg upload pudge publish - diff -Nru pastedeploy-1.3.3/setup.py pastedeploy-1.5.0/setup.py --- pastedeploy-1.3.3/setup.py 2009-02-11 22:29:24.000000000 +0000 +++ pastedeploy-1.5.0/setup.py 2011-05-24 20:40:08.000000000 +0000 @@ -1,10 +1,9 @@ from setuptools import setup, find_packages -version = '1.3.3' setup( name="PasteDeploy", - version=version, + version='1.5.0', description="Load, configure, and compose WSGI applications and servers", long_description="""\ This tool provides code to load WSGI applications and servers from @@ -12,8 +11,9 @@ files. `Paste Script `_ provides commands to serve applications based on this configuration file. -The latest version is available in a `Subversion repository -`_. +The latest version is available in a `Mercurial repository +`_ (or a `tarball +`_). For the latest changes see the `news file `_. @@ -23,22 +23,32 @@ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", + "Programming Language :: Python :: 2.5", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.1", + "Programming Language :: Python :: 3.2", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", - "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Internet :: WWW/HTTP :: WSGI", "Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware", + "Topic :: Software Development :: Libraries :: Python Modules", "Framework :: Paste", ], keywords='web wsgi application server', author="Ian Bicking", author_email="ianb@colorstudy.com", + maintainer="Alex Gronholm", + maintainer_email="alex.gronholm@nextday.fi", url="http://pythonpaste.org/deploy/", license='MIT', namespace_packages=['paste'], - packages=find_packages(exclude='tests'), + packages=find_packages(exclude=['tests']), include_package_data=True, zip_safe=False, + test_suite='nose.collector', + tests_require=['nose>=0.11'], extras_require={ 'Config': [], 'Paste': ['Paste'], @@ -50,14 +60,5 @@ [paste.paster_create_template] paste_deploy=paste.deploy.paster_templates:PasteDeploy - - [paste.entry_point_description] - paste.app_factory = paste.deploy.epdesc:AppFactoryDescription - paste.composit_factory = paste.deploy.epdesc:CompositeFactoryDescription - paste.composite_factory = paste.deploy.epdesc:CompositeFactoryDescription - paste.filter_app_factory = paste.deploy.epdesc:FilterAppFactoryDescription - paste.filter_factory = paste.deploy.epdesc:FilterFactoryDescription - paste.server_factory = paste.deploy.epdesc:ServerFactoryDescription - paste.server_runner = paste.deploy.epdesc:ServerRunnerDescription """, - ) +) diff -Nru pastedeploy-1.3.3/tests/conftest.py pastedeploy-1.5.0/tests/conftest.py --- pastedeploy-1.3.3/tests/conftest.py 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/conftest.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -import os -import sys - -here = os.path.dirname(__file__) -base = os.path.dirname(here) -sys.path.insert(0, base) - -# We can only import this after we adjust the paths -import pkg_resources - -# Make absolutely sure we're testing *this* package, not -# some other installed package -pkg_resources.require('PasteDeploy') - diff -Nru pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/fakeapp/apps.py pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/fakeapp/apps.py --- pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/fakeapp/apps.py 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/fakeapp/apps.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -############################################################ -## Apps -############################################################ - -def simple_app(response, environ, start_response): - start_response('200 OK', [('Content-type', 'text/html')]) - return ['This is ', response] - -def basic_app(environ, start_response): - return simple_app('basic app', environ, start_response) - -def make_basic_app(global_conf, **conf): - return basic_app - -def basic_app2(environ, start_response): - return simple_app('basic app2', environ, start_response) - -def make_basic_app2(global_conf, **conf): - return basic_app2 - -############################################################ -## Composits -############################################################ - -def make_remote_addr(loader, global_conf, **conf): - apps = {} - addrs = {} - for name, value in conf.items(): - if name.startswith('app.'): - apps[name[4:]] = loader.get_app(value, global_conf) - elif name.startswith('addr.'): - addrs[name[5:]] = value - dispatcher = RemoteAddrDispatch() - for name in apps: - dispatcher.map[addrs[name]] = apps[name] - return dispatcher - -class RemoteAddrDispatch(object): - def __init__(self, map=None): - self.map = map or {} - - def __call__(self, environ, start_response): - addr = environ['REMOTE_ADDR'] - app = self.map.get(addr) or self.map['0.0.0.0'] - return app(environ, start_response) - -############################################################ -## Filters -############################################################ - -def make_cap_filter(global_conf, method_to_call='upper'): - def cap_filter(app): - return CapFilter(app, global_conf, method_to_call) - return cap_filter - -class CapFilter(object): - - def __init__(self, app, global_conf, method_to_call='upper'): - self.app = app - self.method_to_call = method_to_call - self.global_conf = global_conf - - def __call__(self, environ, start_response): - app_iter = self.app(environ, start_response) - for item in app_iter: - yield getattr(item, self.method_to_call)() - if hasattr(app_iter, 'close'): - app_iter.close() - diff -Nru pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/fakeapp/configapps.py pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/fakeapp/configapps.py --- pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/fakeapp/configapps.py 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/fakeapp/configapps.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -class SimpleApp(object): - def __init__(self, global_conf, local_conf, name): - self.global_conf = global_conf - self.local_conf = local_conf - self.name = name - - def __call__(self, environ, start_response): - start_response('200 OK', [('Content-type', 'text/html')]) - return ['I am: ', name] - - def make_app(cls, global_conf, **conf): - return cls(global_conf, conf, 'basic') - make_app = classmethod(make_app) - diff -Nru pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/fakeapp/__init__.py pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/fakeapp/__init__.py --- pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/fakeapp/__init__.py 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/fakeapp/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -# diff -Nru pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/FakeApp.egg-info/entry_points.txt pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/FakeApp.egg-info/entry_points.txt --- pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/FakeApp.egg-info/entry_points.txt 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/FakeApp.egg-info/entry_points.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -[paste.app_factory] - - basic_app=fakeapp.apps:make_basic_app - other=fakeapp.apps:make_basic_app2 - configed=fakeapp.configapps:SimpleApp.make_app - - -[paste.composit_factory] - - remote_addr=fakeapp.apps:make_remote_addr - - -[paste.filter_app_factory] - - caps2=fakeapp.apps:CapFilter - - -[paste.filter_factory] - - caps=fakeapp.apps:make_cap_filter - - diff -Nru pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/FakeApp.egg-info/PKG-INFO pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/FakeApp.egg-info/PKG-INFO --- pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/FakeApp.egg-info/PKG-INFO 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/FakeApp.egg-info/PKG-INFO 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -Metadata-Version: 1.0 -Name: FakeApp -Version: 1.0 -Summary: UNKNOWN -Home-page: UNKNOWN -Author: UNKNOWN -Author-email: UNKNOWN -License: UNKNOWN -Description: UNKNOWN -Platform: UNKNOWN diff -Nru pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/FakeApp.egg-info/top_level.txt pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/FakeApp.egg-info/top_level.txt --- pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/FakeApp.egg-info/top_level.txt 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/FakeApp.egg-info/top_level.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -fakeapp diff -Nru pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/setup.py pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/setup.py --- pastedeploy-1.3.3/tests/fake_packages/FakeApp.egg/setup.py 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/fake_packages/FakeApp.egg/setup.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -from setuptools import setup, find_packages - -setup( - name="FakeApp", - version="1.0", - packages=find_packages(), - entry_points={ - 'paste.app_factory': """ - basic_app=fakeapp.apps:make_basic_app - other=fakeapp.apps:make_basic_app2 - configed=fakeapp.configapps:SimpleApp.make_app - """, - 'paste.composit_factory': """ - remote_addr=fakeapp.apps:make_remote_addr - """, - 'paste.filter_factory': """ - caps=fakeapp.apps:make_cap_filter - """, - 'paste.filter_app_factory': """ - caps2=fakeapp.apps:CapFilter - """, - }, - ) diff -Nru pastedeploy-1.3.3/tests/fixture.py pastedeploy-1.5.0/tests/fixture.py --- pastedeploy-1.3.3/tests/fixture.py 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/fixture.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -import os -import sys -import shutil - -test_dir = os.path.dirname(__file__) -egg_info_dir = os.path.join(test_dir, 'fake_packages', 'FakeApp.egg', - 'EGG-INFO') -info_dir = os.path.join(test_dir, 'fake_packages', 'FakeApp.egg', - 'FakeApp.egg-info') -if not os.path.exists(egg_info_dir): - try: - os.symlink(info_dir, egg_info_dir) - except: - shutil.copytree(info_dir, egg_info_dir) - -sys.path.append(os.path.dirname(egg_info_dir)) - -from pkg_resources import * -working_set.add_entry(os.path.dirname(egg_info_dir)) -require('FakeApp') - diff -Nru pastedeploy-1.3.3/tests/sample_configs/basic_app.ini pastedeploy-1.5.0/tests/sample_configs/basic_app.ini --- pastedeploy-1.3.3/tests/sample_configs/basic_app.ini 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/sample_configs/basic_app.ini 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -[application:main] -use = egg:FakeApp#basic_app - -[application:other] -use = egg:FakeApp#other - -[composit:remote_addr] -use = egg:FakeApp#remote_addr -app.1 = main -addr.1 = 127.0.0.1 - -app.2 = other -addr.2 = 0.0.0.0 - diff -Nru pastedeploy-1.3.3/tests/sample_configs/executable.ini pastedeploy-1.5.0/tests/sample_configs/executable.ini --- pastedeploy-1.3.3/tests/sample_configs/executable.ini 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/sample_configs/executable.ini 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -#!/usr/bin/env paster -[exe] -sys.path = /fake/path/ - /another/fake/path ../fake_packages/ - -[server] -use = egg:PasteScript#cgi - -[app] -use = egg:FakeApp#basic_app diff -Nru pastedeploy-1.3.3/tests/sample_configs/test_config_included.ini pastedeploy-1.5.0/tests/sample_configs/test_config_included.ini --- pastedeploy-1.3.3/tests/sample_configs/test_config_included.ini 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/sample_configs/test_config_included.ini 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -[DEFAULT] -def2 = from include -def3 = c - -[app:main] -# Equivalent to the egg reference, but just for kicks... -paste.app_factory = fakeapp.configapps:SimpleApp.make_app -set glob = orig -bob = your uncle -another = BAR diff -Nru pastedeploy-1.3.3/tests/sample_configs/test_config.ini pastedeploy-1.5.0/tests/sample_configs/test_config.ini --- pastedeploy-1.3.3/tests/sample_configs/test_config.ini 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/sample_configs/test_config.ini 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -[DEFAULT] -def1 = a -def2 = b - -[app:test1] -use = egg:FakeApp#configed -setting1 = foo -setting2 = bar - -[app:test2] -use = egg:FakeApp#configed -set def1 = test2 -set another = TEST -local conf = something - -[app:test3] -use = test2 -set def1 = test3 -another = something more - across several - lines - -[app:test_foreign_config] -use = config:test_config_included.ini -set glob = override -another = FOO - -[app:test_get] -use = egg:FakeApp#configed -set def2 = TEST -get def1 = def1 -get foo = def2 - -[app:test_global_conf] -use = egg:FakeApp#configed -test_interp = this:%(inherit)s diff -Nru pastedeploy-1.3.3/tests/sample_configs/test_filter.ini pastedeploy-1.5.0/tests/sample_configs/test_filter.ini --- pastedeploy-1.3.3/tests/sample_configs/test_filter.ini 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/sample_configs/test_filter.ini 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -[app:normal] -use = egg:FakeApp#basic_app - -[pipeline:piped] -pipeline = egg:FakeApp#caps normal - -[filter-app:filt] -use = egg:FakeApp#caps -method_to_call = lower -next = normal - -[pipeline:piped2] -pipeline = egg:FakeApp#caps2 normal - -[filter-app:filt2] -use = egg:FakeApp#caps2 -method_to_call = lower -next = normal - -[app:inv] -use = egg:FakeApp#basic_app -filter-with = egg:FakeApp#caps diff -Nru pastedeploy-1.3.3/tests/sample_configs/test_filter_with.ini pastedeploy-1.5.0/tests/sample_configs/test_filter_with.ini --- pastedeploy-1.3.3/tests/sample_configs/test_filter_with.ini 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/sample_configs/test_filter_with.ini 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -[app:main] -use = egg:FakeApp#basic_app -example = test -filter-with = filter1 - -[filter:filter1] -use = egg:FakeApp#caps -filter-with = filter2 - -[filter:filter2] -use = egg:FakeApp#caps - diff -Nru pastedeploy-1.3.3/tests/test_basic_app.py pastedeploy-1.5.0/tests/test_basic_app.py --- pastedeploy-1.3.3/tests/test_basic_app.py 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/test_basic_app.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -from paste.deploy import loadapp, loadfilter, appconfig -from fixture import * -import fakeapp.apps - -here = os.path.dirname(__file__) - -def test_main(): - app = loadapp('config:sample_configs/basic_app.ini', - relative_to=here) - assert app is fakeapp.apps.basic_app - app = loadapp('config:sample_configs/basic_app.ini#main', - relative_to=here) - assert app is fakeapp.apps.basic_app - app = loadapp('config:sample_configs/basic_app.ini', - relative_to=here, name='main') - assert app is fakeapp.apps.basic_app - app = loadapp('config:sample_configs/basic_app.ini#ignored', - relative_to=here, name='main') - assert app is fakeapp.apps.basic_app - -def test_other(): - app = loadapp('config:sample_configs/basic_app.ini#other', - relative_to=here) - assert app is fakeapp.apps.basic_app2 - - -def test_composit(): - app = loadapp('config:sample_configs/basic_app.ini#remote_addr', - relative_to=here) - assert isinstance(app, fakeapp.apps.RemoteAddrDispatch) - assert app.map['127.0.0.1'] is fakeapp.apps.basic_app - assert app.map['0.0.0.0'] is fakeapp.apps.basic_app2 - - diff -Nru pastedeploy-1.3.3/tests/test_config_middleware.py pastedeploy-1.5.0/tests/test_config_middleware.py --- pastedeploy-1.3.3/tests/test_config_middleware.py 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/test_config_middleware.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -from paste.deploy.config import ConfigMiddleware -from paste.fixture import TestApp -from py.test import raises - -class Bug(Exception): pass - -def app_with_exception(environ, start_response): - def cont(): - yield "something" - raise Bug - start_response('200 OK', [('Content-type', 'text/html')]) - return cont() - -def test_error(): - wrapped = ConfigMiddleware(app_with_exception, {'test': 1}) - test_app = TestApp(wrapped) - raises(Bug, "test_app.get('/')") - diff -Nru pastedeploy-1.3.3/tests/test_config.py pastedeploy-1.5.0/tests/test_config.py --- pastedeploy-1.3.3/tests/test_config.py 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/test_config.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,116 +0,0 @@ -import os -from paste.deploy import loadapp, loadfilter, appconfig -from fixture import * -import fakeapp.configapps as fc -from pprint import pprint - -ini_file = 'config:sample_configs/test_config.ini' -here = os.path.dirname(__file__) -config_path = os.path.join(here, 'sample_configs') -config_filename = os.path.join(config_path, 'test_config.ini') - -def test_config_egg(): - app = loadapp('egg:FakeApp#configed') - assert isinstance(app, fc.SimpleApp) - -def test_config1(): - app = loadapp(ini_file, relative_to=here, name='test1') - assert app.local_conf == { - 'setting1': 'foo', 'setting2': 'bar'} - assert app.global_conf == { - 'def1': 'a', 'def2': 'b', - 'here': config_path, - '__file__': config_filename} - -def test_config2(): - app = loadapp(ini_file, relative_to=here, name='test2') - assert app.local_conf == { - 'local conf': 'something'} - assert app.global_conf == { - 'def1': 'test2', - 'def2': 'b', - 'another': 'TEST', - 'here': config_path, - '__file__': config_filename} - # Run this to make sure the global-conf-modified test2 - # didn't mess up the general global conf - test_config1() - -def test_config3(): - app = loadapp(ini_file, relative_to=here, name='test3') - assert isinstance(app, fc.SimpleApp) - assert app.local_conf == { - 'local conf': 'something', - 'another': 'something more\nacross several\nlines'} - assert app.global_conf == { - 'def1': 'test3', - 'def2': 'b', - 'another': 'TEST', - 'here': config_path, - '__file__': config_filename} - test_config2() - -def test_foreign_config(): - app = loadapp(ini_file, relative_to=here, name='test_foreign_config') - assert isinstance(app, fc.SimpleApp) - assert app.local_conf == { - 'another': 'FOO', - 'bob': 'your uncle'} - pprint(app.global_conf) - assert app.global_conf == { - 'def1': 'a', - 'def2': 'from include', - 'def3': 'c', - 'glob': 'override', - 'here': config_path, - '__file__': os.path.join(config_path, 'test_config.ini')} - -def test_config_get(): - app = loadapp(ini_file, relative_to=here, name='test_get') - assert isinstance(app, fc.SimpleApp) - assert app.local_conf == { - 'def1': 'a', - 'foo': 'TEST'} - assert app.global_conf == { - 'def1': 'a', - 'def2': 'TEST', - 'here': config_path, - '__file__': config_filename} - -def test_appconfig(): - conf = appconfig(ini_file, relative_to=here, name='test_get') - assert conf == { - 'def1': 'a', - 'def2': 'TEST', - 'here': config_path, - '__file__': config_filename, - 'foo': 'TEST'} - assert conf.local_conf == { - 'def1': 'a', - 'foo': 'TEST'} - assert conf.global_conf == { - 'def1': 'a', - 'def2': 'TEST', - 'here': config_path, - '__file__': config_filename,} - -def test_appconfig_filter_with(): - conf = appconfig('config:test_filter_with.ini', relative_to=config_path) - assert conf['example'] == 'test' - -def test_global_conf(): - conf = appconfig(ini_file, relative_to=here, name='test_global_conf', global_conf={'def2': 'TEST DEF 2', 'inherit': 'bazbar'}) - pprint(conf) - assert conf == { - 'def1': 'a', - # Note that this gets overwritten: - 'def2': 'b', - 'here': config_path, - 'inherit': 'bazbar', - '__file__': config_filename, - 'test_interp': 'this:bazbar', - } - assert conf.local_conf == { - 'test_interp': 'this:bazbar', - } - diff -Nru pastedeploy-1.3.3/tests/test_filter.py pastedeploy-1.5.0/tests/test_filter.py --- pastedeploy-1.3.3/tests/test_filter.py 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/test_filter.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -from paste.deploy import loadapp, loadfilter -from fixture import * -import fakeapp.apps - -here = os.path.dirname(__file__) - -def test_filter_app(): - app = loadapp('config:sample_configs/test_filter.ini#filt', - relative_to=here) - assert isinstance(app, fakeapp.apps.CapFilter) - assert app.app is fakeapp.apps.basic_app - assert app.method_to_call == 'lower' - -def test_pipeline(): - app = loadapp('config:sample_configs/test_filter.ini#piped', - relative_to=here) - assert isinstance(app, fakeapp.apps.CapFilter) - assert app.app is fakeapp.apps.basic_app - assert app.method_to_call == 'upper' - -def test_filter_app2(): - app = loadapp('config:sample_configs/test_filter.ini#filt2', - relative_to=here) - assert isinstance(app, fakeapp.apps.CapFilter) - assert app.app is fakeapp.apps.basic_app - assert app.method_to_call == 'lower' - -def test_pipeline2(): - app = loadapp('config:sample_configs/test_filter.ini#piped2', - relative_to=here) - assert isinstance(app, fakeapp.apps.CapFilter) - assert app.app is fakeapp.apps.basic_app - assert app.method_to_call == 'upper' - -def test_filter_app_inverted(): - app = loadapp('config:sample_configs/test_filter.ini#inv', - relative_to=here) - assert isinstance(app, fakeapp.apps.CapFilter) - assert app.app is fakeapp.apps.basic_app - -def test_filter_with_filter_with(): - app = loadapp('config:sample_configs/test_filter_with.ini', - relative_to=here) - assert isinstance(app, fakeapp.apps.CapFilter) - assert isinstance(app.app, fakeapp.apps.CapFilter) - assert app.app.app is fakeapp.apps.basic_app diff -Nru pastedeploy-1.3.3/tests/test_load_package.py pastedeploy-1.5.0/tests/test_load_package.py --- pastedeploy-1.3.3/tests/test_load_package.py 2009-02-11 22:29:23.000000000 +0000 +++ pastedeploy-1.5.0/tests/test_load_package.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -import sys, os -import pkg_resources -import site -from pprint import pprint - -def test_load_package(): - print 'Path:' - pprint(sys.path) - print pkg_resources.require('FakeApp') -