# HG changeset patch # User Jeff Hammel # Date 1304904506 25200 # Node ID 9e218743303405bb6d3ff55b8ef2da531c6c63bd initial code diff -r 000000000000 -r 9e2187433034 README.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.txt Sun May 08 18:28:26 2011 -0700 @@ -0,0 +1,8 @@ +redirectall +---------- + +redirect all traffic as moved permanantly + +-- + +http://k0s.org/hg/redirector \ No newline at end of file diff -r 000000000000 -r 9e2187433034 redirectall.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/redirectall.ini Sun May 08 18:28:26 2011 -0700 @@ -0,0 +1,22 @@ +#!/usr/bin/env paster + +[DEFAULT] +debug = true +email_to = jhammel@mozilla.com +smtp_server = localhost +error_email_from = paste@localhost + +[server:main] +use = egg:Paste#http +host = 0.0.0.0 +port = 8080 + +[composite:main] +use = egg:Paste#urlmap +/ = redirectall + +set debug = false + +[app:redirectall] +paste.app_factory = redirectall.factory:factory +redirectall.base_url = http://brasstacks.mozilla.com/toolbox/ \ No newline at end of file diff -r 000000000000 -r 9e2187433034 redirectall/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/redirectall/__init__.py Sun May 08 18:28:26 2011 -0700 @@ -0,0 +1,1 @@ +# diff -r 000000000000 -r 9e2187433034 redirectall/dispatcher.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/redirectall/dispatcher.py Sun May 08 18:28:26 2011 -0700 @@ -0,0 +1,19 @@ +""" +request dispatcher +""" + +from handlers import Get, Post +from webob import Request, exc + +class Dispatcher(object): + + ### class level variables + + def __init__(self, base_url): + self.base_url = base_url + + ### methods dealing with HTTP + def __call__(self, environ, start_response): + request = Request(environ) + import pdb; pdb.set_trace() + return res(environ, start_response) diff -r 000000000000 -r 9e2187433034 redirectall/factory.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/redirectall/factory.py Sun May 08 18:28:26 2011 -0700 @@ -0,0 +1,12 @@ +from dispatcher import Dispatcher +from paste.httpexceptions import HTTPExceptionHandler + +def factory(global_conf, **app_conf): + """create a webob view and wrap it in middleware""" + keystr = 'redirectall.' + args = dict([(key.split(keystr, 1)[-1], value) + for key, value in app_conf.items() + if key.startswith(keystr) ]) + app = Dispatcher(**args) + return HTTPExceptionHandler(app) + diff -r 000000000000 -r 9e2187433034 setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/setup.py Sun May 08 18:28:26 2011 -0700 @@ -0,0 +1,35 @@ +from setuptools import setup, find_packages +import sys, os + +try: + description = file('README.txt').read() +except IOError: + description = '' + +version = "0.0" + +setup(name='redirectall', + version=version, + description="redirect all traffic as moved permanantly", + long_description=description, + classifiers=[], # Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers + author='Jeff Hammel', + author_email='jhammel@mozilla.com', + url='http://k0s.org/hg/redirector', + license="MPL", + packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), + include_package_data=True, + zip_safe=False, + install_requires=[ + # -*- Extra requirements: -*- + 'WebOb', + 'Paste', + 'PasteScript', + ], + entry_points=""" + # -*- Entry points: -*- + [paste.app_factory] + main = redirectall.factory:factory + """, + ) +