Imported from SVN by Bitbucket

This commit is contained in:
2015-03-31 20:26:20 +00:00
committed by bitbucket
commit ceb7984dec
212 changed files with 49537 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
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
# environment. But as an example...
start_response('200 OK', [('Content-type', 'text/html')])
greeting = CONFIG['greeting']
content = [
'<html><head><title>%s</title></head>\n' % greeting,
'<body><h1>%s!</h1>\n' % greeting,
'<table border=1>\n',
]
items = environ.items()
items.sort()
for key, value in items:
content.append('<tr><td>%s</td><td>%s</td></tr>\n'
% (key, cgi.escape(repr(value))))
content.append('</table></body></html>')
return content

View File

@@ -0,0 +1,24 @@
from paste.deploy.config import ConfigMiddleware
import sampleapp
def make_app(
global_conf,
# Optional and required configuration parameters
# can go here, or just **kw; greeting is required:
greeting,
**kw):
# This is a WSGI application:
app = sampleapp.application
# Here we merge all the keys into one configuration
# dictionary; you don't have to do this, but this
# can be convenient later to add ad hoc configuration:
conf = global_conf.copy()
conf.update(kw)
conf['greeting'] = greeting
# ConfigMiddleware means that paste.deploy.CONFIG will,
# during this request (threadsafe) represent the
# configuration dictionary we set up:
app = ConfigMiddleware(app, conf)
return app

View File

@@ -0,0 +1,22 @@
[filter-app:main]
# This puts the interactive debugger in place:
use = egg:Paste#evalerror
next = devel
[app:devel]
# This application is meant for interactive development
use = egg:${project}
debug = true
# You can add other configuration values:
greeting = Aloha!
[app:test]
# While this version of the configuration is for non-iteractive
# tests (unit tests)
use = devel
[server:main]
use = egg:Paste#http
# Change to 0.0.0.0 to make public:
host = 127.0.0.1
port = 8080