changeset 0:9e2187433034

initial code
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 08 May 2011 18:28:26 -0700
parents
children 3117c5556eca
files README.txt redirectall.ini redirectall/__init__.py redirectall/dispatcher.py redirectall/factory.py setup.py
diffstat 6 files changed, 97 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /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
--- /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
--- /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 @@
+#
--- /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)
--- /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)
+    
--- /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
+      """,
+      )
+