diff options
53 files changed, 237 insertions, 434 deletions
@@ -11,7 +11,7 @@ if [ "$BASE" = "." ] ; then BASE=`pwd` fi -THIRD="$BASE/wsgikit/3rd-party" +THIRD="$BASE/paste/3rd-party" function get_file { ZIP_TYPE="$1" diff --git a/docs/BlogTutorial.txt b/docs/BlogTutorial.txt index 0336a3d..735652f 100644 --- a/docs/BlogTutorial.txt +++ b/docs/BlogTutorial.txt @@ -12,13 +12,12 @@ Introduction ============ This tutorial will go through the process of creating a blog using -WSGIKit_, SQLObject_, and `Zope Page Templates`_. This blog will rely -heavily on static publishing -- that is, when at all possible flat -HTML pages will be written to disk. For some parts (e.g., posting a -new item) this will of course be infeasible, but for most of the site -this should work fine. +`Python Paste <http://pythonpaste.org>`_, SQLObject_, and `Zope Page +Templates`_. This blog will rely heavily on static publishing -- that +is, when at all possible flat HTML pages will be written to disk. For +some parts (e.g., posting a new item) this will of course be +infeasible, but for most of the site this should work fine. -.. _WSGIKit: http://wsgikit.org .. _SQLObject: http://sqlobject.org .. _Zope Page Templates: http://www.zope.org/DevHome/Wikis/DevSite/Projects/ZPT/FrontPage @@ -47,7 +46,7 @@ Setting Up The App .. run: - from wsgikit.tests.doctest_webapp import * + from paste.tests.doctest_webapp import * BASE = '/var/www/wkblog' import sys clear_dir(BASE) @@ -57,7 +56,7 @@ Setting Up The App :: - $ export PYTHONPATH=/path/to/WSGIKit:$PYTHONPATH + $ export PYTHONPATH=/path/to/Paste:$PYTHONPATH $ BASE=/var/www/wkblog $ app-setup create --template=webkit_zpt $BASE $ cd $BASE diff --git a/docs/DeveloperGuidelines.txt b/docs/DeveloperGuidelines.txt index 8ff8122..f8388d4 100644 --- a/docs/DeveloperGuidelines.txt +++ b/docs/DeveloperGuidelines.txt @@ -1,10 +1,10 @@ -+++++++++++++++++++++++ -WSGIKit Developer Guide -+++++++++++++++++++++++ +++++++++++++++++++++++++++++ +Python Paste Developer Guide +++++++++++++++++++++++++++++ -Hi. Welcome to WSGIKit. I hope you enjoy your stay here. +Hi. Welcome to Paste. I hope you enjoy your stay here. -I hope to bring together multiple efforts here, for WSGIKit to support +I hope to bring together multiple efforts here, for Paste to support multiple frameworks and directions, while presenting a fairly integrated frontend to users. How to do that? That's an open question, and this code is in some ways an exploration. @@ -25,7 +25,7 @@ There's some basic principles: * Entry into frameworks should be easy, but exit should also be easy. Heterogeneous frameworks and applications are the ambition. But we - have to get some messiness into WSGIKit before we can try to resolve + have to get some messiness into Paste before we can try to resolve that messiness. * When all is said and done, users should be able to ignore much of @@ -53,7 +53,7 @@ is going to bite your head off for committing something. but please feel free to use those too. ``unittest`` is kind of annoying, and py.test is both more powerful and easier to write for. Tests should go in a ``tests/`` subdirectory. - ``wsgikit.tests.fixture`` contains some convenience functions for + ``paste.tests.fixture`` contains some convenience functions for testing WSGI applications and middleware. .. _py.test: http://codespeak.net/py/current/doc/test.html diff --git a/docs/StyleGuide.txt b/docs/StyleGuide.txt index 523fa61..5f5cf60 100644 --- a/docs/StyleGuide.txt +++ b/docs/StyleGuide.txt @@ -1,5 +1,5 @@ +++++++++++++++++++ -WSGIKit Style Guide +Paste Style Guide +++++++++++++++++++ Generally you should follow the recommendations in `PEP 8`_, the diff --git a/docs/TodoTutorial.txt b/docs/TodoTutorial.txt index dc525d9..3f1ce07 100644 --- a/docs/TodoTutorial.txt +++ b/docs/TodoTutorial.txt @@ -11,7 +11,7 @@ To-Do: A Tutorial .. comment (about this document) This document is meant to be processed with - wsgikit/tests/doctest_webapp.py, which assembles the file and + paste/tests/doctest_webapp.py, which assembles the file and provides a degree of testing. The pages inlined aren't current tested, and so must be inspected by eye after the document is assembled. @@ -20,12 +20,11 @@ Introduction ============ This is a tutorial for building a simple to-do list application using -WSGIKit_, SQLObject_, and `Zope Page Templates`_. You can view the +`Python Paste <http://pythonpaste.org>`_, SQLObject_, and `Zope Page Templates`_. You can view the completed application in the repository at ``examples/todo_sql`` or view the repository online at -http://svn.w4py.org/WSGIKit/trunk/examples/todo_sql/ +http://svn.w4py.org/Paste/trunk/examples/todo_sql/ -.. _WSGIKit: http://wsgikit.org .. _SQLObject: http://sqlobject.org .. _Zope Page Templates: http://www.zope.org/DevHome/Wikis/DevSite/Projects/ZPT/FrontPage @@ -43,7 +42,7 @@ Setting up the files .. comment (setup doctests) - >>> from wsgikit.tests.doctest_webapp import * + >>> from paste.tests.doctest_webapp import * Let's start out quickly. We'll be installing the application in ``/var/www/todo_sql``: @@ -52,7 +51,7 @@ Let's start out quickly. We'll be installing the application in >>> BASE = '/var/www/todo_sql' >>> import sys - >>> sys.path.append('/path/to/WSGIKit') + >>> sys.path.append('/path/to/Paste') >>> clear_dir(BASE) >>> run("app-setup create --template=webkit_zpt %s" % BASE) >>> os.chdir(BASE) @@ -72,7 +71,7 @@ Let's start out quickly. We'll be installing the application in :: - $ export PYTHONPATH=/path/to/WSGIKit:$PYTHONPATH + $ export PYTHONPATH=/path/to/Paste:$PYTHONPATH $ BASE=/var/www/todo_sql $ app-setup create --template=webkit_zpt $BASE $ cd $BASE @@ -147,7 +146,7 @@ nature of the files. ``web/index.py``: This is a simple example servlet. Anything named ``index`` is - also used as the default page (like ``index.html``). WSGIKit + also used as the default page (like ``index.html``). Paste mostly ignores extensions when finding pages, so ``/index`` can refer to ``index.py``, ``index.html``, or any other page named ``index`` regardless of extension. @@ -155,7 +154,7 @@ nature of the files. ``web/static/``: This contains files that don't have any dynamic content, like images and Javascript. Based on deployment, these files could be - served up by Apache or another web server without WSGIKit being + served up by Apache or another web server without Paste being involved at all (with some CPU savings), so we keep them separated. @@ -169,7 +168,7 @@ Running the application It's just the barest example application, but we can still run it and get some basic output. Change into the directory and run:: - $ path/to/wsgikit/scripts/wsgi-server + $ path/to/paste/scripts/wsgi-server This will run a server on http://localhost:8080 @@ -196,7 +195,7 @@ localhost:8080. Looking at servlets ------------------- -The idea of a servlet in WSGIKit is taken from Java, but the +The idea of a servlet in Paste is taken from Java, but the similarity isn't that great. Let's look at the ``index.py`` servlet we showed you: @@ -574,8 +573,8 @@ And this is what we get: >>> create_file('web/__init__.py', 'v1', r""" ... import os - ... from wsgikit import wsgilib - ... from wsgikit.util.thirdparty import add_package + ... from paste import wsgilib + ... from paste.util.thirdparty import add_package ... add_package('sqlobject') ... import sqlobject ... @@ -587,7 +586,7 @@ And this is what we get: ... environ['todo_sql.base_url'] = environ['SCRIPT_NAME'] ... if not sql_set: ... sql_set = True - ... db_uri = environ['wsgikit.config']['database'] + ... db_uri = environ['paste.config']['database'] ... sqlobject.sqlhub.processConnection = sqlobject.connectionForURI( ... db_uri) ... """) diff --git a/docs/WSGIKit.txt b/docs/WSGIKit.txt index 38687d3..e822215 100644 --- a/docs/WSGIKit.txt +++ b/docs/WSGIKit.txt @@ -1,5 +1,5 @@ -WSGIKit -=========== +Python Paste +============ This is a WSGI_ version of WebKit. In addition to supporting WSGI, it also is a simplification and refactoring of Webware. @@ -9,7 +9,7 @@ also is a simplification and refactoring of Webware. License ------- -WSGIKit is distributed under the `Python Software Foundation`__ +Paste is distributed under the `Python Software Foundation`__ license. This is a BSD/MIT-style license. .. __: http://www.python.org/psf/license.html @@ -21,16 +21,16 @@ First, grab WSGIUtils, at http://www.owlfish.com/software/wsgiutils/, or download it directly from http://www.owlfish.com/software/wsgiutils/downloads/WSGI%20Utils-0.5.tar.gz -You can use other servers with WSGIKit, but WSGIUtils is pretty easy +You can use other servers with Paste, but WSGIUtils is pretty easy and built on SimpleHTTPServer. Run ``python setup.py install`` to install it. -Right now it's best NOT to install WSGIKit with ``setup.py``, but just +Right now it's best NOT to install Paste with ``setup.py``, but just to run it out of the checkout. An easy way to do that:: ./scripts/app-setup create webkit_zpt /path/to/put/files cd /path/to/put/files - /path/to/wsgikit/scripts/server -v + /path/to/paste/scripts/server -v And it will be running a server on http://localhost:8080/ @@ -54,7 +54,7 @@ Some parts that aren't being brought over: all of them. The environment (``request.environ()``) may look different than in Webware -- it matches the WSGI expectations. It's certainly possible -- and hopefully clearer -- to do introspection - in WSGIKit, but it might not be backward compatible (but still file + in Paste, but it might not be backward compatible (but still file bugs if you find problems). Discussion @@ -76,7 +76,7 @@ like:: database_name = 'app_data' And so on. There's a default configuration file in -``wsgikit/default_config.conf`` which will also serve as +``paste/default_config.conf`` which will also serve as documentation. Your configuration overrides those values. The extension is arbitrary at this point. @@ -137,8 +137,8 @@ like:: #!/usr/bin/env python # maybe import sys and modify sys.path - from wsgikit import cgiserver - from wsgikit.webkit import wsgiwebkit + from paste import cgiserver + from paste.webkit import wsgiwebkit app = wsgiwebkit.webkit('/path/to/app') cgiserver.run_with_cgi(app) @@ -156,8 +156,8 @@ this server use:: #!/usr/bin/env python # maybe import sys and modify sys.path - from wsgikit import twisted_wsgi - from wsgikit.webkit import wsgiwebkit + from paste import twisted_wsgi + from paste.webkit import wsgiwebkit app = wsgiwebkit.webkit('/path/to/app') twisted_wsgi.serve_application(app, 8080) @@ -179,7 +179,7 @@ To set up this server use:: #!/usr/bin/env python from wsgiutils import wsgiServer - from wsgikit.webkit import wsgiwebkit + from paste.webkit import wsgiwebkit app_root='/path/to/app' app = wsgiwebkit.webkit(app_root) server = wsgiServer.WSGIServer(('127.0.0.1', 8080), {'/': app}) @@ -194,8 +194,8 @@ is a simple way:: #!/usr/bin/env python # maybe import sys and modify sys.path - from wsgikit import wsgilib - from wsgikit.webkit import wsgiwebkit + from paste import wsgilib + from paste.webkit import wsgiwebkit app = wsgiwebkit.webkit('/path/to/app') def run(url): print wsgilib.interactive(application, url) diff --git a/docs/servers.txt b/docs/servers.txt index bc9970e..9540f02 100644 --- a/docs/servers.txt +++ b/docs/servers.txt @@ -1,6 +1,6 @@ -+++++++++++++++ -WSGIKit Servers -+++++++++++++++ +++++++++++++++++++++ +Python Paste Servers +++++++++++++++++++++ :author: A.M. Kuchling <amk@amk.ca> :revision: $Rev$ @@ -32,16 +32,16 @@ Configuration Configuration information is read from a number of sources, in the following order. - 1. A set of default values, contained in the code of the - wsgikit.server module. - 2. From wsgi-server's command line arguments. - 3. From the ``default_config.conf`` file in the installed ``wsgikit`` directory. - 4. From the `server.conf` file in the current working directory. - (You can set a `no_server_conf` config setting to skip - reading this file.) - 5. If the `config_file` setting is present at this point, - it should contain the path of a configuration file. - This file is parsed and processed last. + 1. A set of default values, contained in the code of the + paste.server module. + 2. From wsgi-server's command line arguments. + 3. From the ``default_config.conf`` file in the installed ``paste`` directory. + 4. From the `server.conf` file in the current working directory. + (You can set a `no_server_conf` config setting to skip + reading this file.) + 5. If the `config_file` setting is present at this point, + it should contain the path of a configuration file. + This file is parsed and processed last. After going through these steps, configuration is complete. @@ -49,7 +49,7 @@ After going through these steps, configuration is complete. Servers -------- -WSGIKit can run a web application in a number of different modes: CGI, +Paste can run a web application in a number of different modes: CGI, standalone HTTP, SCGI, and a console mode which simulates CGI. Some of these modes require additional software; the ``build-pkg`` script will download the necessary packages for you. diff --git a/docs/web/index.txt b/docs/web/index.txt index fabef83..1695d03 100644 --- a/docs/web/index.txt +++ b/docs/web/index.txt @@ -1,25 +1,20 @@ -WSGIKit -+++++++ +Python Paste +++++++++++++ -.. raw:: html +Python Paste is a web application framework framework. - <img - src="http://www.imagescape.com/software/docs/wsgikit-pycon2005/whiskey-cup.jpg" - align="right" - title="WSGIKit: pronounced like whisky-kit. Cures what's ailin' ya'"> - -WSGIKit is a reimplementation of `Webware for Python`_, using WSGI_ to -create a framework-neutral foundation. +Paste includes a reimplementation of `Webware for Python`_, using +WSGI_ to create a framework-neutral foundation. .. _Webware for python: http://www.webwareforpython.org .. _WSGI: http://www.python.org/peps/pep-0333.html -To check out WSGIKit:: +To check out Paste:: - $ svn co http://svn.w4py.org/WSGIKit/trunk WSGIKit + $ svn co http://svn.w4py.org/Paste/trunk Paste Note that it includes a script ``build-pkg`` which fetches a bunch of -packages that make WSGIKit more useful. A big tarball of all the +packages that make Paste more useful. A big tarball of all the requirements stuffed together will probably be forthcoming. Get Involved @@ -45,25 +40,26 @@ IRC: Resources ========= -* `To-do tutorial`_, an introduction to WSGIKit installation and application +* `To-do tutorial`_, an introduction to Paste installation and application design -* `What is WSGIKit? +* `What is Paste? <http://blog.ianbicking.org/what-is-wsgikit.html>`_: a description - of WSGIKit's scope. + of Paste's scope. (Note that Paste was known as "WSGIKit" when this + was written.) -* `What can WSGIKit do for you? +* `What can Paste do for you? <http://blog.ianbicking.org/what-can-wsgikit-do-for-you.html>`_: a - description of what WSGIKit offers to Python web framework authors. + description of what Paste offers to Python web framework authors. * Ian Bicking presented at `PyCon 2005`_ on `WSGI Middleware and WSGIKit`_: *Using WSGI Middleware to build a foundation for Python web programming* -* The Webware API portion of WSGIKit should be discussed on +* The Webware API portion of Paste should be discussed on webware-discuss@lists.sf.net -* The WSGI aspect of WSGIKit should be discussed on web-sig@python.org +* The WSGI aspect of Paste should be discussed on web-sig@python.org .. _To-do tutorial: ./docs/TodoTutorial.html .. _PyCon 2005: http://pycon.org/dc2005 diff --git a/examples/login_example.py b/examples/login_example.py index ee6e55b..d4b7ea3 100644 --- a/examples/login_example.py +++ b/examples/login_example.py @@ -1,5 +1,5 @@ -from wsgikit.twisted_wsgi import serve_application -from wsgikit import echo, login +from paste.twisted_wsgi import serve_application +from paste import echo, login def twisted_serve(app): serve_application( diff --git a/examples/todo/QUICKSTART b/examples/todo/QUICKSTART index 1de319e..ec36082 100644 --- a/examples/todo/QUICKSTART +++ b/examples/todo/QUICKSTART @@ -1,33 +1,33 @@ -WSGIKit Example Application: todo +Paste Example Application: todo ================================= This is a simple application intended to demonstrate the basic usage of -a WSGIKit site as well as some WSGI features such as a middleware hooks +a Paste site as well as some WSGI features such as a middleware hooks that performs URL rewriting. ROADMAP lists some of the features we intend to implement in the future. -Installing WSGIKit +Installing Paste ------------------ -`docs/WSGIKit.txt`__ describes a basic user-level installation of -WSGIKit and supported WSGI servers. +`docs/Paste.txt`__ describes a basic user-level installation of +Paste and supported WSGI servers. -.. __: http://svn.w4py.org/WSGIKit/trunk/docs/WSGIKit.txt +.. __: http://svn.w4py.org/Paste/trunk/docs/Paste.txt Your First Run -------------- The commands:: - cd WSGIKit/trunk - wsgikit/server.py --server=wsgiutils --webkit-dir=example/todo \ + cd Paste/trunk + scripts/wsgi-server --server=wsgiutils --webkit-dir=example/todo \ --port 8080 -D --data-dir='/var/www/data1' -If you do not have $PYTHONPATH set up as described WSGIKit.txt then you +If you do not have $PYTHONPATH set up as described Paste.txt then you can add a like such as this:: - env PYTHONPATH=`pwd` wsgikit/server.py ... + env PYTHONPATH=`pwd` paste/server.py ... Replace 'env' with 'setenv' if you're using csh or tcsh. diff --git a/examples/todo/SitePage.py b/examples/todo/SitePage.py index 178e471..5d7ceed 100644 --- a/examples/todo/SitePage.py +++ b/examples/todo/SitePage.py @@ -1,9 +1,7 @@ - import os -from wsgikit.webkit.wkservlet import Page +from paste.webkit.wkservlet import Page import api - class SitePage(Page): manager = None @@ -11,7 +9,7 @@ class SitePage(Page): def awake(self, trans): super(SitePage, self).awake(trans) if not getattr(self, 'manager', None): - datadir = trans.request().environ().get('wsgikit.config',{}).get('datadir','.') + datadir = trans.request().environ().get('paste.config',{}).get('datadir','.') self.manager = api.Manager.load(root=datadir) self.baseURL = trans.request().environ()['todo.base_url'] self.username = self.session().value('username', None) @@ -44,7 +42,7 @@ class SitePage(Page): "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n""") def title(self): - return "WSGIKit ToDo list test" + return "Paste ToDo list test" def htBodyArgs(self): return "" @@ -55,7 +53,7 @@ class SitePage(Page): self.writePostContent() def writePreContent(self): - self.write("""<h1><img src="%s/check.png" align="absmiddle" />WSGIKit ToDo + self.write("""<h1><img src="%s/check.png" align="absmiddle" />Paste ToDo List</h1><hr />""" % self.baseURL) def writeContent(self): diff --git a/examples/todo/__init__.py b/examples/todo/__init__.py index fbf9c0a..1065277 100644 --- a/examples/todo/__init__.py +++ b/examples/todo/__init__.py @@ -1,5 +1,5 @@ import os -from wsgikit import wsgilib +from paste import wsgilib def urlparser_hook(environ): if not environ.has_key('todo.base_url'): @@ -7,7 +7,7 @@ def urlparser_hook(environ): def not_found_hook(environ, start_response): - p = environ['wsgikit.urlparser.not_found_parser'] + p = environ['paste.urlparser.not_found_parser'] username, rest = wsgilib.path_info_split(environ.get('PATH_INFO', '')) if username is None: return p.not_found(environ, start_response) diff --git a/examples/todo/favicon.ico b/examples/todo/favicon.ico deleted file mode 100644 index 3d97672..0000000 --- a/examples/todo/favicon.ico +++ /dev/null @@ -1,191 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" -"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -<html> -<head> - <title>Webware for Python -</title> -<link href="css/main.css" rel="stylesheet" type="text/css" /> -</head> -<body> - -<table cellspacing="0" cellpadding="0" style="width: 100%; border-spacing: 0px;"> -<tr> - -<td style="width: 158px; height: 80px;"> -<a href="/"><img src="graphics/python_top.png" width="158" height="80" alt="Webware for Python" /></a> -</td> - -<td style="width: 243px; height: 80px;"> -<a href="/"><img src="graphics/webware.png" width="243" height="80" alt="Webware" /></a> -</td> - -<td style="width: 100%; height: 80px; text-align: center; background-image: url('graphics/head_middle.png');"> - - -<p class="topbar"> -Download -<a href="http://prdownloads.sourceforge.net/webware/Webware-0.8.1.tar.gz?download"><b>Webware 0.8.1</b></a> -</p> - - -</td> - -<td style="height: 80px; text-align: right; width: 6px;"> -<img src="graphics/head_right.png" width="6" height="80" alt="Webware" /> -</td> -</tr> - -<tr> -<td style="vertical-align: top; width: 158px; height: 400px; background-image: url('graphics/menu.png'); background-repeat: no-repeat;"> - - -<p style="padding-top: 41px; margin-top: 0px;" class="menu"> -<strong>Documentation</strong><br /> -<a class="menu" href="Webware/Docs/Overview.html">Overview</a><br /> -<a class="menu" href="Webware/Docs/index.html">Online Docs</a><br /> -<!--<a class="menu" href="#">Development</a><br />--> -<a class="menu" href="http://wiki.w4py.org/">Wiki</a><br /> -<a class="menu" href="Papers/">Papers</a><br /> -</p> - -<p class="menu"> -<strong>Download</strong><br /> -<a class="menu" href="http://prdownloads.sourceforge.net/webware/Webware-0.8.1.tar.gz?download">Webware-0.8.1</a><br /> -<a class="menu" href="OlderVersions">Older versions</a><br /> -</p> - -<p class="menu"> -<strong>Mailing lists</strong><br /> -<a class="menu" href="http://lists.sourceforge.net/mailman/listinfo/webware-announce">webware-announce</a><br /> -<a class="menu" href="http://lists.sourceforge.net/mailman/listinfo/webware-discuss">webware-discuss</a><br /> -<a class="menu" href="http://lists.sourceforge.net/mailman/listinfo/webware-devel">webware-devel</a><br /> -</p> - -<p class="menu"> -<strong>Development</strong><br /> -<a class="menu" href="Wiki/subversionrepositoryaccess">Source Code</a><br /> -<a class="menu" href="http://www.sourceforge.net/projects/webware">Sourceforge Page</a><br /> -<a class="menu" href="http://sourceforge.net/tracker/?group_id=4866&atid=104866">Bug tracker</a><br /> -</p> - -<p class="menu"> -<strong>Support</strong><br /> -<a class="menu" href="Consultants">Consultants</a></p> - - -</td> - -<td rowspan="2" colspan="3" id="content" style="vertical-align: top; width: 100%%; height: 100%%;"> - -<h1>Webware for Python -</h1> - -<div class="document"> -<p><strong>Webware for Python</strong> is a suite of software components for developing object-oriented, web-based applications. The suite uses well known design patterns and includes popular features such as a fast application server, Python Server Pages (PSP), and a CGI wrapper.</p> -<hr /> -<div class="section" id="news"> -<h1><a name="news">News</a></h1> -<div class="section" id="zptkit-0-1"> -<h2><a name="zptkit-0-1">2005-03-18 - ZPTKit 0.1</a></h2> -<p>ZPTKit version 0.1 released. ZPTKit helps make <a class="reference" href="http://www.zope.org/DevHome/Wikis/DevSite/Projects/ZPT/FrontPage">Zope Page Templates</a> -easy to use with Webware. For more on ZPTKit see -<a class="reference" href="http://imagescape.com/software/ZPTKit/">http://imagescape.com/software/ZPTKit/</a>, <a class="reference" href="http://imagescape.com/software/ZPTKit/ZPTKit-0.1.tar.gz">download</a> or <a class="reference" href="http://svn.webwareforpython.org/ZPTKit/trunk">view the -source</a>.</p> -</div> -<div class="section" id="component-0-1"> -<h2><a name="component-0-1">2005-03-16 - Component 0.1</a></h2> -<p><a class="reference" href="http://wiki.webwareforpython.org/component.html">Component</a> version 0.1 released. Component provides a subclass of -<tt class="literal"><span class="pre">WebKit.Page</span></tt> that makes it easier to reuse code from multiple -sources that extend the capability of servlets.</p> -</div> -<div class="section" id="webware-switches-to-subversion"> -<h2><a name="webware-switches-to-subversion">2005-03-14 - Webware switches to Subversion</a></h2> -<p>Webware has switched its source-code repository from using Sourceforge's -CVS service to using a <a class="reference" href="http://subversion.tigris.org/">Subversion</a> hosted on the webwareforpython.org -(aka w4py.org) server. Here are some <a class="reference" href="Wiki/subversionrepositoryaccess">instructions on how to access the repository</a>. -Newcomers to subversion may be interested in <a class="reference" href="http://svnbook.red-bean.com/en/1.0/index.html">the Subversion book</a>.</p> -</div> -<div class="section" id="wsgi-webware-renamed-to-wsgikit"> -<h2><a name="wsgi-webware-renamed-to-wsgikit">2004-11-17 - WSGI Webware renamed to WSGIKit</a></h2> -<p>You can now find the WSGI-enabled Webware implementation at -<tt class="literal"><span class="pre">svn://colorstudy.com/trunk/WSGIKit</span></tt> or <a class="reference" href="http://svn.colorstudy.com/trunk/WSGIKit">view online</a>. -It is now distutil-installable and includes documentation.</p> -</div> -<div class="section" id="webware-wsgikit"> -<h2><a name="webware-wsgikit">2004-10-05 - Webware WSGIKit</a></h2> -<p>An effort is in the works to port Webware to the new -<a class="reference" href="http://www.python.org/peps/pep-0333.html">Web Server Gateway Interface (WSGI)</a>. The WSGI is an effort by -<a class="reference" href="http://www.python.org/sigs/web-sig/">the Python Web-SIG</a> to create a standard -interface for Python web applications, frameworks, and servers, and -should allow Webware to be run in different environments, and alongside -other Python web frameworks. Work can be found in a Subversion repository -at <tt class="literal"><span class="pre">http://svn.w4py.org/WSGIKit/trunk</span></tt> and <a class="reference" href="http://svn.w4py.org/WSGIKit/trunk">viewed online</a>.</p> -</div> -<div class="section" id="website-re-organization-in-progress"> -<h2><a name="website-re-organization-in-progress">2004-06-19 - Website re-organization in progress</a></h2> -<p>Thanks to Eric Radman for the new site design, and Jacob Hanson for the logo. -We're in the process of moving content over from the <a class="reference" href="http://webware.sf.net/oldsite">old site</a>, -re-organizing, and updating it where necessary. Please bear with us.</p> -</div> -<div class="section" id="new-server-and-domain"> -<h2><a name="new-server-and-domain">2004-04-05 - New server and domain</a></h2> -<p>The Webware project has been generously provided with a virtual server and -hosting package, and has registered webwareforpython.org. We will be moving the -Wiki to this server and are in the process of redesigning the entire website in -order to provide more useful and better-organized information -- stay tuned!</p> -</div> -<div class="section" id="webware-0-8-1-released"> -<h2><a name="webware-0-8-1-released">2003-08-01 - Webware 0.8.1 Released</a></h2> -<p>Webware 0.8.1 was released today. It contains an important security fix, -and all users should upgrade. See the <a class="reference" href="http://www.webwareforpython.org/Webware-0.8.1/Docs/RelNotes-0.8.1.html">0.8.1 release notes</a> for details.</p> -</div> -<div class="section" id="webware-0-8-0-released"> -<h2><a name="webware-0-8-0-released">2003-02-09 - Webware 0.8.0 Released</a></h2> -<ul class="simple"> -<li>All adapters have been moved to Webware/WebKit/Adapters</li> -<li>LRWPAdapter added, for use with the <a class="reference" href="http://xitami.com">Xitami web server</a></li> -<li><tt class="literal"><span class="pre">setCookie</span></tt> method in <tt class="literal"><span class="pre">HTTPResponse</span></tt>. New method supports -setting the expire time, path (which defaults to "/") and security flag. -The expire time can be set with constants "ONCLOSE", "NOW", or "NEVER"; or -you can give an integer timestamp, tuple of integers (as used in the time -module), or string identifier (like "+1w" for 1 week in the future).</li> -<li>Added an <em>experimental</em> <tt class="literal"><span class="pre">HTTPAdapter.py</span></tt> which serves directly as an -HTTP server.</li> -<li>Added an optional AutoReload setting to enable reloading the server -whenever source files, including servlets and PSP files are changed.</li> -<li>Fix so PSP works with python 2.3a1.</li> -<li>Includes an Apache 2 mod_webkit adapter, and pre-compiled DLL for windows.</li> -<li>Fixed a problem where escapes in PSP source were not being processed correctly.</li> -<li>Restored 0.7 behavior of Page.writeDocType() to output 4.01 Transitional. -See the <a class="reference" href="http://webware.sourceforge.net/WebKit/Docs/RelNotes-0.8.html">0.8 release notes</a> for more info.</li> -<li>Upgraded documentation</li> -<li>Improvements to profilling.</li> -<li>Numerous bug fixes.</li> -</ul> -</div> -</div> -</div> -<hr /><p>This page <a href="http://wiki.w4py.org/webwarenews.html?_action_=edit">can be updated</a> in the <a href="http://wiki.w4py.org">Webware Wiki.</a></p> - -</td> -</tr> - -<tr> -<td style="vertical-align: bottom;"> -<p style="text-align: center;"> -<a href="http://www.python.org/"> -<img src="graphics/PythonPowered.png" width="88" height="31" alt="python powered" /></a> -</p> - -<p style="text-align: center;"> -Hosted by <a href="http://www.tummy.com/">tummy.com</a> -</p> - -</td></tr> - -</table> - -</body> -</html> diff --git a/examples/todo/lists.py b/examples/todo/lists.py index 581e7db..558e018 100644 --- a/examples/todo/lists.py +++ b/examples/todo/lists.py @@ -1,6 +1,6 @@ from urllib import pathname2url from urllib2 import unquote -from wsgikit.httpexceptions import HTTPNotFound +from paste.httpexceptions import HTTPNotFound from SitePage import SitePage diff --git a/examples/todo_sql/__init__.py b/examples/todo_sql/__init__.py index 39d0c09..3415d9d 100644 --- a/examples/todo_sql/__init__.py +++ b/examples/todo_sql/__init__.py @@ -1,4 +1,4 @@ -from wsgikit.util.thirdparty import add_package +from paste.util.thirdparty import add_package add_package('ZopePageTemplates') add_package('Component') diff --git a/examples/todo_sql/web/__init__.py b/examples/todo_sql/web/__init__.py index 835887d..ed4edc7 100644 --- a/examples/todo_sql/web/__init__.py +++ b/examples/todo_sql/web/__init__.py @@ -1,6 +1,6 @@ import os -from wsgikit import wsgilib -from wsgikit.util.thirdparty import add_package +from paste import wsgilib +from paste.util.thirdparty import add_package add_package('sqlobject') import sqlobject @@ -12,6 +12,6 @@ def urlparser_hook(environ): environ['todo_sql.base_url'] = environ['SCRIPT_NAME'] if not sql_set: sql_set = True - db_uri = environ['wsgikit.config']['database'] + db_uri = environ['paste.config']['database'] sqlobject.sqlhub.processConnection = sqlobject.connectionForURI( db_uri) diff --git a/scripts/app-setup b/scripts/app-setup index 4996537..16eaac5 100755 --- a/scripts/app-setup +++ b/scripts/app-setup @@ -8,11 +8,11 @@ except NameError: # Python 2.2 here = sys.argv[0] -relative_wsgikit = os.path.join( - os.path.dirname(os.path.dirname(os.path.abspath(here))), 'wsgikit') +relative_paste = os.path.join( + os.path.dirname(os.path.dirname(os.path.abspath(here))), 'paste') -if os.path.exists(relative_wsgikit): - sys.path.insert(0, os.path.dirname(relative_wsgikit)) +if os.path.exists(relative_paste): + sys.path.insert(0, os.path.dirname(relative_paste)) -from wsgikit import app_setup +from paste import app_setup sys.exit(app_setup.run(sys.argv)) diff --git a/scripts/wsgi-server b/scripts/wsgi-server index 29736eb..7ec637d 100755 --- a/scripts/wsgi-server +++ b/scripts/wsgi-server @@ -8,12 +8,12 @@ except NameError: # Python 2.2 here = sys.argv[0] -relative_wsgikit = os.path.join( - os.path.dirname(os.path.dirname(os.path.abspath(here))), 'wsgikit') +relative_paste = os.path.join( + os.path.dirname(os.path.dirname(os.path.abspath(here))), 'paste') -if os.path.exists(relative_wsgikit): - sys.path.insert(0, os.path.dirname(relative_wsgikit)) +if os.path.exists(relative_paste): + sys.path.insert(0, os.path.dirname(relative_paste)) -from wsgikit import server +from paste import server sys.exit(server.run_commandline(sys.argv[1:])) @@ -1,6 +1,6 @@ import sys print "This setup.py is broken right now, it won't install a useable" -print "WSGIKit right now. Instead, just add this directory to your" +print "Paste right now. Instead, just add this directory to your" print "$PYTHONPATH variable. We apologize for any inconvenience." print "(Also note that you may want to run build-pkg to fetch some" print "modules this depends on, or at least that the tutorial depends" @@ -18,7 +18,7 @@ if sys.version < '2.2.3': DistributionMetadata.classifiers = None DistributionMetadata.download_url = None -setup(name="WSGIKit", +setup(name="Python Paste", version="0.1", description="Tools for use with a Web Server Gateway Interface stack", long_description="""\ @@ -46,12 +46,12 @@ functionality. author_email="ianb@colorstudy.com", url="http://webwareforpython.org", license="PSF", - packages=["wsgikit", "wsgikit.util", "wsgikit.webkit", - "wsgikit.exceptions", - "wsgikit.webkit.FakeWebware", - "wsgikit.webkit.FakeWebware.WebKit", - "wsgikit.webkit.FakeWebware.WebUtils", - "wsgikit.webkit.FakeWebware.MiscUtils"], + packages=["paste", "paste.util", "paste.webkit", + "paste.exceptions", + "paste.webkit.FakeWebware", + "paste.webkit.FakeWebware.WebKit", + "paste.webkit.FakeWebware.WebUtils", + "paste.webkit.FakeWebware.MiscUtils"], scripts=['scripts/server'], download_url="") diff --git a/wsgikit/3rd-party/README.txt b/wsgikit/3rd-party/README.txt index 6eb57b0..0526e70 100644 --- a/wsgikit/3rd-party/README.txt +++ b/wsgikit/3rd-party/README.txt @@ -1,4 +1,4 @@ -This directory contains packages useful to WSGIKit users, who may not +This directory contains packages useful to Paste users, who may not feel like installing those packages. The module util.thirdparty has functions for pulling these modules into the path, but also respecting any packages the user installed on their own. diff --git a/wsgikit/app_setup.py b/wsgikit/app_setup.py index 74e1dd6..3d84463 100644 --- a/wsgikit/app_setup.py +++ b/wsgikit/app_setup.py @@ -6,11 +6,11 @@ import os import sys from cStringIO import StringIO import re -from wsgikit.util.thirdparty import load_new_module +from paste.util.thirdparty import load_new_module string = load_new_module('string', (2, 4)) -from wsgikit import pyconfig -from wsgikit import urlparser +from paste import pyconfig +from paste import urlparser class InvalidCommand(Exception): pass @@ -18,7 +18,7 @@ class InvalidCommand(Exception): def find_template_info(args): """ Given command-line arguments, this finds the app template - (wsgikit.app_templates.<template_name>.command). It looks for a + (paste.app_templates.<template_name>.command). It looks for a -t or --template option (but ignores all other options), and if none then looks in server.conf for a template_name option. @@ -78,7 +78,7 @@ def find_template_config(args): def load_template(template_name): base = os.path.join(os.path.dirname(__file__), 'app_templates') - full_name = 'wsgikit.app_templates.%s.command' % template_name + full_name = 'paste.app_templates.%s.command' % template_name errors = StringIO() mod = urlparser.load_module_from_name( None, os.path.join(base, template_name, 'command'), diff --git a/wsgikit/app_templates/webkit_zpt/command.py b/wsgikit/app_templates/webkit_zpt/command.py index 47d4a15..dff1b60 100644 --- a/wsgikit/app_templates/webkit_zpt/command.py +++ b/wsgikit/app_templates/webkit_zpt/command.py @@ -1,6 +1,6 @@ import os -from wsgikit import app_setup -from wsgikit import pyconfig +from paste import app_setup +from paste import pyconfig the_runner = app_setup.CommandRunner() the_runner.register(app_setup.CommandCreate) diff --git a/wsgikit/app_templates/webkit_zpt/template/__init__.py b/wsgikit/app_templates/webkit_zpt/template/__init__.py index cdef0f5..0454673 100644 --- a/wsgikit/app_templates/webkit_zpt/template/__init__.py +++ b/wsgikit/app_templates/webkit_zpt/template/__init__.py @@ -1,4 +1,4 @@ -from wsgikit.util.thirdparty import add_package +from paste.util.thirdparty import add_package add_package('ZopePageTemplates') add_package('Component') diff --git a/wsgikit/app_templates/webkit_zpt/template/web/__init__.py b/wsgikit/app_templates/webkit_zpt/template/web/__init__.py index edc05ba..1454f37 100644 --- a/wsgikit/app_templates/webkit_zpt/template/web/__init__.py +++ b/wsgikit/app_templates/webkit_zpt/template/web/__init__.py @@ -1,5 +1,5 @@ import os -from wsgikit import wsgilib +from paste import wsgilib def urlparser_hook(environ): if not environ.has_key('${app_name}.base_url'): diff --git a/wsgikit/cgiserver.py b/wsgikit/cgiserver.py index 33ac0de..83d257c 100644 --- a/wsgikit/cgiserver.py +++ b/wsgikit/cgiserver.py @@ -9,7 +9,7 @@ The CGI script is the configuration and glue for this server. Typically you will write a CGI script like:: #!/usr/bin/env python - from wsgikit.cgiserver import run_with_cgi + from paste.cgiserver import run_with_cgi # Assuming app is your WSGI application object... from myapplication import app run_with_cgi(app) diff --git a/wsgikit/configmiddleware.py b/wsgikit/configmiddleware.py index 3d67102..20226f6 100644 --- a/wsgikit/configmiddleware.py +++ b/wsgikit/configmiddleware.py @@ -1,7 +1,7 @@ def config_middleware(app, config): def replacement_app(environ, start_response): - environ['wsgikit.config'] = config.copy() + environ['paste.config'] = config.copy() return app(environ, start_response) return replacement_app diff --git a/wsgikit/error_middleware.py b/wsgikit/error_middleware.py index 11ffe94..e2f6958 100644 --- a/wsgikit/error_middleware.py +++ b/wsgikit/error_middleware.py @@ -5,7 +5,7 @@ try: from cStringIO import StringIO except ImportError: from StringIO import StringIO -from wsgikit.exceptions import formatter, collector, reporter +from paste.exceptions import formatter, collector, reporter class ErrorMiddleware(object): @@ -64,7 +64,7 @@ class ErrorMiddleware(object): def exception_handler(self, exc_info, environ): reported = False exc_data = collector.collect_exception(*exc_info) - conf = environ.get('wsgikit.config', {}) + conf = environ.get('paste.config', {}) extra_data = '' if conf.get('error_email'): rep = reporter.EmailReporter( diff --git a/wsgikit/exceptions/tests/test_formatter.py b/wsgikit/exceptions/tests/test_formatter.py index 0968dd4..6a9b255 100644 --- a/wsgikit/exceptions/tests/test_formatter.py +++ b/wsgikit/exceptions/tests/test_formatter.py @@ -1,5 +1,5 @@ -from wsgikit.exceptions import formatter -from wsgikit.exceptions import collector +from paste.exceptions import formatter +from paste.exceptions import collector import sys import os diff --git a/wsgikit/exceptions/tests/test_reporter.py b/wsgikit/exceptions/tests/test_reporter.py index 265cded..da6c470 100644 --- a/wsgikit/exceptions/tests/test_reporter.py +++ b/wsgikit/exceptions/tests/test_reporter.py @@ -1,7 +1,7 @@ import sys import os -from wsgikit.exceptions.reporter import * -from wsgikit.exceptions import collector +from paste.exceptions.reporter import * +from paste.exceptions import collector def setup_file(fn, content=None): fn = os.path.join(os.path.dirname(__file__), 'reporter_output', fn) diff --git a/wsgikit/login.py b/wsgikit/login.py index e1400bd..7e6fcac 100644 --- a/wsgikit/login.py +++ b/wsgikit/login.py @@ -69,14 +69,14 @@ def middleware( should probably be overridable. Environment variables used: - wsgikit.login.signer: + paste.login.signer: signer, created from UsernameSigner class - wsgikit.login._dologin: + paste.login._dologin: user name to be logged in, either from HTTP auth or from form submission (XXX form not implement) - wsgikit.login._doredirect: + paste.login._doredirect: login page to which to redirect - wsgikit.login._loginredirect: + paste.login._loginredirect: set to True iff _doredirect set and login_page is relative, else undefined. Used where? """ @@ -97,7 +97,7 @@ def middleware( cookies = wsgilib.get_cookies(environ) cookie = cookies.get(cookie_name) username = None - environ['wsgikit.login.signer'] = signer + environ['paste.login.signer'] = signer if cookie and cookie.value: username = signer.check_signature( cookie.value, environ['wsgi.errors']) @@ -109,17 +109,17 @@ def middleware( and authenticatee): username = authenticator().check_basic_auth(authenticatee) if http_and_cookie: - environ['wsgikit.login._dologin'] = username + environ['paste.login._dologin'] = username if username: environ['REMOTE_USER'] = username def login_start_response(status, headers): - if environ.get('wsgikit.login._dologin'): + if environ.get('paste.login._dologin'): cookie = SimpleCookie(cookie_name, signer.make_signature(username), '/') headers.append(('Set-Cookie', str(cookie))) - del environ['wsgikit.login._dologin'] + del environ['paste.login._dologin'] status_int = int(status.split(None, 1)[0].strip()) if status_int == 401 and http_login: if (http_overwrite_realm @@ -128,21 +128,21 @@ def middleware( elif status_int == 401: status = '200 OK' if login_page.startswith('/'): - assert environ.has_key('wsgikit.recursive.include'), ( + assert environ.has_key('paste.recursive.include'), ( "You must use the recursive middleware to " "use a non-relative page for the login_page") - environ['wsgikit.login._doredirect'] = login_page + environ['paste.login._doredirect'] = login_page return garbage_writer return start_response(status, headers) app_iter = application(environ, login_start_response) - if environ.get('wsgikit.login._doredirect'): - page_name = environ['wsgikit.login._doredirect'] - del environ['wsgikit.login._doredirect'] + if environ.get('paste.login._doredirect'): + page_name = environ['paste.login._doredirect'] + del environ['paste.login._doredirect'] eat_app_iter(app_iter) if login_page.startswith('/'): - app_iter = environ['wsgikit.recursive.forward']( + app_iter = environ['paste.recursive.forward']( login_page[1:]) else: # Don't use recursive, since login page is @@ -150,7 +150,7 @@ def middleware( new_environ = environ.copy() new_environ['SCRIPT_NAME'] = orig_script_name new_environ['PATH_INFO'] = '/' + login_page - new_environ['wsgikit.login._loginredirect'] = True + new_environ['paste.login._loginredirect'] = True app_iter = login_application(new_environ, start_response) return app_iter @@ -190,7 +190,7 @@ class UsernameSigner(object): Adds a username so that the login middleware will later set the user to be logged in (with a cookie). """ - environ['wsgikit.login._dologin'] = username + environ['paste.login._dologin'] = username class SimpleCookie(object): def __init__ (self, cookie_name, signed_val, path): diff --git a/wsgikit/recursive.py b/wsgikit/recursive.py index 21236d3..bfe8206 100644 --- a/wsgikit/recursive.py +++ b/wsgikit/recursive.py @@ -5,7 +5,7 @@ application acts differently with different URLs. The forwarded URLs must be relative to this container. The forwarder is available through -``environ['wsgikit.recursive.forward'](path, extra_environ=None)``, +``environ['paste.recursive.forward'](path, extra_environ=None)``, the second argument is a dictionary of values to be added to the request, overwriting any keys. The forward will call start_response; thus you must *not* call it after you have sent any output to the @@ -14,7 +14,7 @@ stack. You may need to use exceptions to guarantee that this iterator will be passed back through the application. The includer is available through -``environ['wsgikit.recursive.include'](path, extra_environ=None)``. +``environ['paste.recursive.include'](path, extra_environ=None)``. It is like forwarder, except it completes the request and returns a response object. The response object has three public attributes: status, headers, and body. The status is a string, headers is a list @@ -29,9 +29,9 @@ class RecursiveMiddleware(object): self.application = application def __call__(self, environ, start_response): - environ['wsgikit.recursive.forward'] = Forwarder( + environ['paste.recursive.forward'] = Forwarder( self.application, environ, start_response) - environ['wsgikit.recursive.include'] = Includer( + environ['paste.recursive.include'] = Includer( self.application, environ, start_response) return self.application(environ, start_response) @@ -47,7 +47,7 @@ class Recursive(object): environ = self.original_environ.copy() if new_environ: environ.update(new_environ) - environ['wsgikit.recursive.previous_environ'] = self.previous_environ + environ['paste.recursive.previous_environ'] = self.previous_environ base_path = self.original_environ.get('SCRIPT_NAME') if path.startswith('/'): assert path.startswith(base_path), "You can only forward requests to resources under the path %r (not %r)" % (base_path, path) diff --git a/wsgikit/reloader.py b/wsgikit/reloader.py index 4c8518e..4753f90 100644 --- a/wsgikit/reloader.py +++ b/wsgikit/reloader.py @@ -22,7 +22,7 @@ import sys import time import threading import atexit -from wsgikit.util.classinstance import classinstancemethod +from paste.util.classinstance import classinstancemethod def install(poll_interval=1, raise_keyboard_interrupt=True): mon = Monitor(poll_interval=poll_interval, diff --git a/wsgikit/server.py b/wsgikit/server.py index e2545fd..878a301 100755 --- a/wsgikit/server.py +++ b/wsgikit/server.py @@ -1,6 +1,6 @@ #!/usr/bin/env python """ -A generic WSGIKit server, useable for multiple backends +A generic Paste server, useable for multiple backends """ help_message = """\ @@ -29,8 +29,8 @@ OPTIONS import sys import os -from wsgikit import reloader -from wsgikit import wsgilib +from paste import reloader +from paste import wsgilib # This way you can run this out of a checkout, and we'll fix up # the path... @@ -39,22 +39,22 @@ try: except NameError: here = os.path.normpath(os.path.abspath(sys.argv[0])) try: - import wsgikit + import paste except ImportError: sys.path.append(os.path.dirname(os.path.dirname(here))) - import wsgikit -wsgikit_path = os.path.normpath( - os.path.dirname(os.path.abspath(wsgikit.__file__))) + import paste +paste_path = os.path.normpath( + os.path.dirname(os.path.abspath(paste.__file__))) -if os.path.dirname(here) != wsgikit_path: +if os.path.dirname(here) != paste_path: sys.stderr.write( - 'Warning: server.py is running out of %s, but wsgikit is loaded ' - 'out of %s\n' % (here, wsgikit_path)) + 'Warning: server.py is running out of %s, but paste is loaded ' + 'out of %s\n' % (here, paste_path)) -from wsgikit.pyconfig import Config -from wsgikit.configmiddleware import config_middleware -from wsgikit.webkit import wsgiwebkit -from wsgikit.util import thirdparty +from paste.pyconfig import Config +from paste.configmiddleware import config_middleware +from paste.webkit import wsgiwebkit +from paste.util import thirdparty servers = {} @@ -159,7 +159,7 @@ def help(): return help_message % {'program': program} def twisted_serve(conf, app): - from wsgikit.twisted_wsgi import serve_application + from paste.twisted_wsgi import serve_application serve_application( app, port=int(conf.get('port', 8080))) @@ -167,7 +167,7 @@ servers['twisted'] = twisted_serve def scgi_serve(conf, app): thirdparty.add_package('scgi') - from wsgikit.scgiserver import serve_application + from paste.scgiserver import serve_application prefix = conf.get('scgi_prefix', '/') serve_application(app, prefix, port=int(conf.get('port', 4000))) @@ -206,7 +206,7 @@ def cgi_serve(conf, app): print "#!%s" % sys.executable print template print "if __name__ == '__main__':" - print " from wsgikit.cgiserver import run_with_cgi" + print " from paste.cgiserver import run_with_cgi" print " run_with_cgi(app)" servers['cgi'] = cgi_serve diff --git a/wsgikit/server_script_template.py b/wsgikit/server_script_template.py index 7775fc5..504e371 100644 --- a/wsgikit/server_script_template.py +++ b/wsgikit/server_script_template.py @@ -1,8 +1,8 @@ import os -from wsgikit import server -from wsgikit.pyconfig import Config -from wsgikit.configmiddleware import config_middleware -from wsgikit.webkit import wsgiwebkit +from paste import server +from paste.pyconfig import Config +from paste.configmiddleware import config_middleware +from paste.webkit import wsgiwebkit conf = Config() conf.load_dict(server.default_ops, default=True) diff --git a/wsgikit/session.py b/wsgikit/session.py index 82ea9e3..72ba8d3 100644 --- a/wsgikit/session.py +++ b/wsgikit/session.py @@ -1,7 +1,7 @@ """ Creates a session object; then in your application, use:: - environ['wsgikit.session.factory']() + environ['paste.session.factory']() This will return a dictionary. The contents of this dictionary will be saved to disk when the request is completed. The session will be @@ -35,7 +35,7 @@ class SessionMiddleware(object): def __call__(self, environ, start_response): session_factory = SessionFactory(environ, **self.factory_kw) - environ['wsgikit.session.factory'] = session_factory + environ['paste.session.factory'] = session_factory def session_start_response(status, headers): if not session_factory.created: diff --git a/wsgikit/tests/doctest_webapp.py b/wsgikit/tests/doctest_webapp.py index 533238a..b0b786c 100755 --- a/wsgikit/tests/doctest_webapp.py +++ b/wsgikit/tests/doctest_webapp.py @@ -12,15 +12,15 @@ import re import cgi import rfc822 from cStringIO import StringIO -from wsgikit import server -from wsgikit import wsgilib -from wsgikit.util.thirdparty import add_package +from paste import server +from paste import wsgilib +from paste.util.thirdparty import add_package add_package('PySourceColor') import PySourceColor here = os.path.abspath(__file__) -wsgikit_parent = os.path.dirname( +paste_parent = os.path.dirname( os.path.dirname(os.path.dirname(here))) def run(command): @@ -43,13 +43,13 @@ def _make_env(): env = os.environ.copy() env['PATH'] = (env.get('PATH', '') + ':' - + os.path.join(wsgikit_parent, 'scripts') + + os.path.join(paste_parent, 'scripts') + ':' - + os.path.join(wsgikit_parent, 'wsgikit', '3rd-party', + + os.path.join(paste_parent, 'paste', '3rd-party', 'sqlobject-files', 'scripts')) env['PYTHONPATH'] = (env.get('PYTHONPATH', '') + ':' - + wsgikit_parent) + + paste_parent) return env def clear_dir(dir): @@ -390,8 +390,8 @@ if __name__ == '__main__': if sys.argv[1:] and sys.argv[1] == 'doctest': doctest.testmod() sys.exit() - if not wsgikit_parent in sys.path: - sys.path.append(wsgikit_parent) + if not paste_parent in sys.path: + sys.path.append(paste_parent) for fn in sys.argv[1:]: fn = os.path.abspath(fn) # @@: OK, ick; but this module gets loaded twice diff --git a/wsgikit/tests/fixture.py b/wsgikit/tests/fixture.py index 3b7b4e9..b69c88c 100644 --- a/wsgikit/tests/fixture.py +++ b/wsgikit/tests/fixture.py @@ -6,10 +6,10 @@ except ImportError: import types import re from py.test.collect import Module, PyCollector -from wsgikit.util import thirdparty +from paste.util import thirdparty doctest = thirdparty.load_new_module('doctest', (2, 4)) -from wsgikit import wsgilib -from wsgikit import lint +from paste import wsgilib +from paste import lint class NoDefault: pass diff --git a/wsgikit/tests/test_authentication.py b/wsgikit/tests/test_authentication.py index 656ce49..f26e5a4 100644 --- a/wsgikit/tests/test_authentication.py +++ b/wsgikit/tests/test_authentication.py @@ -1,5 +1,5 @@ -from wsgikit import wsgilib -from wsgikit import login +from paste import wsgilib +from paste import login from fixture import * from_cmdline = 0 diff --git a/wsgikit/tests/test_error_middleware.py b/wsgikit/tests/test_error_middleware.py index 27e4831..f7731ae 100644 --- a/wsgikit/tests/test_error_middleware.py +++ b/wsgikit/tests/test_error_middleware.py @@ -1,10 +1,10 @@ from fixture import * -from wsgikit.error_middleware import ErrorMiddleware -from wsgikit import lint +from paste.error_middleware import ErrorMiddleware +from paste import lint def do_request(app, expect_status=500): res = fake_request(ErrorMiddleware(lint.middleware(app)), - **{'wsgikit.config': {'debug': True}}) + **{'paste.config': {'debug': True}}) assert res.status_int == expect_status return res diff --git a/wsgikit/tests/test_urlparser.py b/wsgikit/tests/test_urlparser.py index 8e2ef98..b41ecfa 100644 --- a/wsgikit/tests/test_urlparser.py +++ b/wsgikit/tests/test_urlparser.py @@ -1,4 +1,4 @@ -from wsgikit.urlparser import * +from paste.urlparser import * from fixture import fake_request diff --git a/wsgikit/tests/urlparser_data/hook/__init__.py b/wsgikit/tests/urlparser_data/hook/__init__.py index 15f2014..9b1055c 100644 --- a/wsgikit/tests/urlparser_data/hook/__init__.py +++ b/wsgikit/tests/urlparser_data/hook/__init__.py @@ -1,4 +1,4 @@ -from wsgikit import wsgilib +from paste import wsgilib def urlparser_hook(environ): first, rest = wsgilib.path_info_split(environ.get('PATH_INFO', '')) diff --git a/wsgikit/tests/urlparser_data/not_found/recur/__init__.py b/wsgikit/tests/urlparser_data/not_found/recur/__init__.py index bf5bf13..48205a5 100644 --- a/wsgikit/tests/urlparser_data/not_found/recur/__init__.py +++ b/wsgikit/tests/urlparser_data/not_found/recur/__init__.py @@ -1,5 +1,5 @@ def not_found_hook(environ, start_response): - urlparser = environ['wsgikit.urlparser.not_found_parser'] + urlparser = environ['paste.urlparser.not_found_parser'] path = environ.get('PATH_INFO', '') if not path: return urlparser.not_found(environ, start_response) diff --git a/wsgikit/tests/urlparser_data/not_found/user/__init__.py b/wsgikit/tests/urlparser_data/not_found/user/__init__.py index a7fd464..c47f88e 100644 --- a/wsgikit/tests/urlparser_data/not_found/user/__init__.py +++ b/wsgikit/tests/urlparser_data/not_found/user/__init__.py @@ -1,7 +1,7 @@ -from wsgikit import wsgilib +from paste import wsgilib def not_found_hook(environ, start_response): - urlparser = environ['wsgikit.urlparser.not_found_parser'] + urlparser = environ['paste.urlparser.not_found_parser'] first, rest = wsgilib.path_info_split(environ.get('PATH_INFO', '')) if not first: # No username diff --git a/wsgikit/twisted_wsgi.py b/wsgikit/twisted_wsgi.py index ae0e6f7..022180e 100644 --- a/wsgikit/twisted_wsgi.py +++ b/wsgikit/twisted_wsgi.py @@ -233,7 +233,7 @@ def serve_application(application, port=8080, async=False): if __name__ == "__main__": import sys import optparse - from wsgikit.webkit.wsgiwebkit import webkit + from paste.webkit.wsgiwebkit import webkit parser = optparse.OptionParser() parser.add_option('-p', '--port', dest='port', default=8080, type='int', diff --git a/wsgikit/urlparser.py b/wsgikit/urlparser.py index 8b07b5f..3ce1394 100644 --- a/wsgikit/urlparser.py +++ b/wsgikit/urlparser.py @@ -76,12 +76,12 @@ class URLParser(object): self.base_python_name = base_python_name def __call__(self, environ, start_response): - environ['wsgikit.urlparser.base_python_name'] = self.base_python_name + environ['paste.urlparser.base_python_name'] = self.base_python_name if self.add_options: - if environ.has_key('wsgikit.urlparser.options'): - environ['wsgikit.urlparser.options'].update(self.add_options) + if environ.has_key('paste.urlparser.options'): + environ['paste.urlparser.options'].update(self.add_options) else: - environ['wsgikit.urlparser.options'] = self.add_options.copy() + environ['paste.urlparser.options'] = self.add_options.copy() if self.init_module is NoDefault: self.init_module = self.find_init_module(environ) path_info = environ.get('PATH_INFO', '') @@ -114,9 +114,9 @@ class URLParser(object): if not application: if (self.init_module and getattr(self.init_module, 'not_found_hook', None) - and environ.get('wsgikit.urlparser.not_found_parser') is not self): + and environ.get('paste.urlparser.not_found_parser') is not self): not_found_hook = self.init_module.not_found_hook - environ['wsgikit.urlparser.not_found_parser'] = self + environ['paste.urlparser.not_found_parser'] = self environ['PATH_INFO'] = orig_path_info environ['SCRIPT_NAME'] = orig_script_name return not_found_hook(environ, start_response) @@ -153,7 +153,7 @@ class URLParser(object): return [body] def option(self, environ, name): - return environ.get('wsgikit.urlparser.options', {}).get( + return environ.get('paste.urlparser.options', {}).get( name, self.default_options.get(name)) def add_slash(self, environ, start_response): @@ -256,7 +256,7 @@ class URLParser(object): hex(abs(id(self)))) def make_directory(environ, filename): - base_python_name = environ['wsgikit.urlparser.base_python_name'] + base_python_name = environ['paste.urlparser.base_python_name'] if base_python_name: base_python_name += "." + os.path.basename(filename) else: @@ -271,7 +271,7 @@ def make_unknown(environ, filename): URLParser.register_constructor('*', make_unknown) def load_module(environ, filename): - base_python_name = environ['wsgikit.urlparser.base_python_name'] + base_python_name = environ['paste.urlparser.base_python_name'] module_name = os.path.splitext(os.path.basename(filename))[0] if base_python_name: module_name = base_python_name + '.' + module_name diff --git a/wsgikit/webkit/FakeWebware/WebKit/HTTPServlet.py b/wsgikit/webkit/FakeWebware/WebKit/HTTPServlet.py index 712dc58..104d2ec 100644 --- a/wsgikit/webkit/FakeWebware/WebKit/HTTPServlet.py +++ b/wsgikit/webkit/FakeWebware/WebKit/HTTPServlet.py @@ -1 +1 @@ -from wsgikit.webkit.wkservlet import HTTPServlet +from paste.webkit.wkservlet import HTTPServlet diff --git a/wsgikit/webkit/FakeWebware/WebKit/Page.py b/wsgikit/webkit/FakeWebware/WebKit/Page.py index afc581f..2bb01ed 100644 --- a/wsgikit/webkit/FakeWebware/WebKit/Page.py +++ b/wsgikit/webkit/FakeWebware/WebKit/Page.py @@ -1 +1 @@ -from wsgikit.webkit.wkservlet import Page +from paste.webkit.wkservlet import Page diff --git a/wsgikit/webkit/examples/EchoServlet.py b/wsgikit/webkit/examples/EchoServlet.py index 2a85c0d..6dc30c6 100644 --- a/wsgikit/webkit/examples/EchoServlet.py +++ b/wsgikit/webkit/examples/EchoServlet.py @@ -1,5 +1,5 @@ r"""\ -WSGI application +Paste/WebKit application Does things as requested. Takes variables: @@ -19,8 +19,8 @@ message=string """ # Special WSGI version of WebKit: -from wsgikit.webkit.wkservlet import Page -from wsgikit import httpexceptions +from paste.webkit.wkservlet import Page +from paste import httpexceptions class EchoServlet(Page): diff --git a/wsgikit/webkit/test_wkfixture.py b/wsgikit/webkit/test_wkfixture.py index a109a33..790a099 100644 --- a/wsgikit/webkit/test_wkfixture.py +++ b/wsgikit/webkit/test_wkfixture.py @@ -1,13 +1,15 @@ """ -Test fixture for WSGKit/WebKit testing. +Test fixture for Paste/WebKit testing. + +Maybe look at paste.tests.fixture as an alternative to this """ from cStringIO import StringIO -from wsgikit import recursive -from wsgikit import session -from wsgikit import httpexceptions -from wsgikit import lint -from wsgikit import wsgilib +from paste import recursive +from paste import session +from paste import httpexceptions +from paste import lint +from paste import wsgilib _default_environ = { 'SCRIPT_NAME': '', diff --git a/wsgikit/webkit/wkrequest.py b/wsgikit/webkit/wkrequest.py index 4ba4c16..6b1785e 100644 --- a/wsgikit/webkit/wkrequest.py +++ b/wsgikit/webkit/wkrequest.py @@ -228,7 +228,7 @@ class HTTPRequest(object): raise NotImplementedError def serverSideContextPath(self, path=None): - base = self._environ['wsgikit.config']['webkit_dir'] + base = self._environ['paste.config']['webkit_dir'] if path: return os.path.join(base, path) else: diff --git a/wsgikit/webkit/wktransaction.py b/wsgikit/webkit/wktransaction.py index 300cdca..af73531 100644 --- a/wsgikit/webkit/wktransaction.py +++ b/wsgikit/webkit/wktransaction.py @@ -37,7 +37,7 @@ class Transaction(object): def session(self): if not self._session: - self._session = Session(self.request().environ()['wsgikit.session.factory']()) + self._session = Session(self.request().environ()['paste.session.factory']()) return self._session def setSession(self, session): @@ -85,12 +85,12 @@ class Transaction(object): self.sleep() def forward(self, url): - assert self._environ.has_key('wsgikit.recursive.forward'), \ + assert self._environ.has_key('paste.recursive.forward'), \ "Forwarding is not supported (use the recursive middleware)" if url.startswith('/'): # Webware considers absolute paths to still be based off # of the Webware root; but recursive does not. url = url[1:] - app_iter = self._environ['wsgikit.recursive.forward'](url) + app_iter = self._environ['paste.recursive.forward'](url) raise self._servlet.ReturnIterException(app_iter) diff --git a/wsgikit/webkit/wsgiwebkit.py b/wsgikit/webkit/wsgiwebkit.py index 4a155fc..7989702 100644 --- a/wsgikit/webkit/wsgiwebkit.py +++ b/wsgikit/webkit/wsgiwebkit.py @@ -8,12 +8,12 @@ Use ``some_server(webkit('/path/to/servlets/'))`` import sys import os -from wsgikit import urlparser -from wsgikit import session -from wsgikit import recursive -from wsgikit import httpexceptions -from wsgikit import lint -from wsgikit import error_middleware +from paste import urlparser +from paste import session +from paste import recursive +from paste import httpexceptions +from paste import lint +from paste import error_middleware def webkit(directory, install_fake_webware=True, use_lint=False): if install_fake_webware: diff --git a/wsgikit/wsgilib.py b/wsgikit/wsgilib.py index 4d2d05a..4e37095 100644 --- a/wsgikit/wsgilib.py +++ b/wsgikit/wsgilib.py @@ -10,13 +10,13 @@ def get_cookies(environ): called again for the same request. """ header = environ.get('HTTP_COOKIE', '') - if environ.has_key('wsgikit.cookies'): - cookies, check_header = environ['wsgikit.cookies'] + if environ.has_key('paste.cookies'): + cookies, check_header = environ['paste.cookies'] if check_header == header: return cookies cookies = SimpleCookie() cookies.load(header) - environ['wsgikit.cookies'] = (cookies, header) + environ['paste.cookies'] = (cookies, header) return cookies class add_close: @@ -158,7 +158,7 @@ def error_response(environ, error_code, message, start_response(status, headers) return [body] """ - if debug_message and environ.get('wsgikit.config', {}).get('debug'): + if debug_message and environ.get('paste.config', {}).get('debug'): message += '\n\n<!-- %s -->' % debug_message body = error_body_response(error_code, message) headers = [('content-type', 'text/html'), |