diff pylons_app/config/middleware.py @ 41:71ffa932799d

Added app basic auth. Changed few deprecations for new pylons. added sqlite logging for user actions.
author Marcin Kuzminski <marcin@python-blog.com>
date Wed, 07 Apr 2010 00:51:55 +0200
parents 2963f2894a7a
children 2e1247e62c5b
line wrap: on
line diff
--- a/pylons_app/config/middleware.py	Tue Apr 06 22:21:23 2010 +0200
+++ b/pylons_app/config/middleware.py	Wed Apr 07 00:51:55 2010 +0200
@@ -8,9 +8,9 @@
 from pylons.middleware import ErrorHandler, StatusCodeRedirect
 from pylons.wsgiapp import PylonsApp
 from routes.middleware import RoutesMiddleware
-
+from paste.auth.basic import AuthBasicHandler
 from pylons_app.config.environment import load_environment
-
+from pylons_app.lib.auth import authfunc 
 
 def make_app(global_conf, full_stack=True, **app_conf):
     """Create a Pylons WSGI application and return it
@@ -43,7 +43,8 @@
     app = RoutesMiddleware(app, config['routes.map'])
     app = SessionMiddleware(app, config)
     app = CacheMiddleware(app, config)
-
+    app = AuthBasicHandler(app, config['repos_name'] + ' mercurial repository', authfunc)
+    
     if asbool(full_stack):
         # Handle Python exceptions
         app = ErrorHandler(app, global_conf, **config['pylons.errorware'])
@@ -55,7 +56,7 @@
             app = StatusCodeRedirect(app, [400, 401, 403, 500])
         else:
             app = StatusCodeRedirect(app, [400, 401, 403, 500])
-
+    
     # Establish the Registry for this application
     app = RegistryManager(app)