From iwan at reahl.org Sun Apr 6 10:23:36 2014 From: iwan at reahl.org (Iwan Vosloo) Date: Sun, 06 Apr 2014 10:23:36 +0200 Subject: [Web-SIG] [ANN] Reahl 2.0.1 - "Python only" web framework Message-ID: <53410F08.3070304@reahl.org> Hello all, We have released version 2.0.1 of the Reahl web framework. This version runs on Linux, Windows and Mac and includes installation instructions for these platforms. It fixes a number of bugs that newcomers would have encountered in the previous version. * Features: http://www.reahl.org * Installation: http://www.reahl.org/docs/current/tutorial/gettingstarted.d.html Reahl is a web application framework for Python programmers. With Reahl, programming is done purely in Python, using concepts familiar from GUI programming - like reusable Widgets and Events. There's no need for a programmer to know several different languages (HTML, JavaScript, template languages, etc) or to keep up with the tricks of these trades. The abstractions presented by Reahl relieve the programmer from the burden of dealing with the annoying problems of the web: security, accessibility, progressive enhancement (or graceful degradation) and browser quirks. Although a Reahl program benefits from having JavaScript available, it functions in the absence of JavaScript too. Search engines can crawl a Reahl program, and its pages can be bookmarked by browsers. Regards - Iwan From jim at zope.com Wed Apr 16 13:32:20 2014 From: jim at zope.com (Jim Fulton) Date: Wed, 16 Apr 2014 07:32:20 -0400 Subject: [Web-SIG] ANNOUNCE: zc.wsgirunner, a simpler container for paste.deploy-defined WSGI applications. Message-ID: We recently ported Bobo to Python 3. We typically deployed Bobo apps using paste.script, but it hasn't been ported to Python 3 yet. To facilitate using WSGI apps under Python 3, I created zc.wsgirunner, which which is a replacement for paste.script for running WSGI applications that are assembled using past.deploy. https://pypi.python.org/pypi/zc.wsgirunner It works much the same way as paste.script/paste.deploy, but: - Works with Python 2 and 3. - Provides a process configuration mechanism. - Provides logging configuration. - Calls sys.setcheckinterval(1000), which is fairly important for performance older versions of Python (<3.2) on multi-processor machines. Jim -- Jim Fulton http://www.linkedin.com/in/jimfulton From iwan at reahl.org Mon Apr 21 12:15:31 2014 From: iwan at reahl.org (Iwan Vosloo) Date: Mon, 21 Apr 2014 12:15:31 +0200 Subject: [Web-SIG] [ANN] Reahl 2.1.0 released Message-ID: <5354EFC3.4080503@reahl.org> Hello all, We have made two new releases of Reahl: Reahl 2.1.0 is prompted by user feedback. In this release a number of classes (and related methods) have been renamed, to names that are more familiar to new users. A View can now also be defined with the page it will render. This change allowed a reorganisation of the tutorial and simple examples that makes the learning curve smoother. Old names have been retained for backwards compatibility (for now). Reahl 2.0.2 was also released, fixing a few minor bugs. This will be the last release in the 2.0 series. * Features: http://www.reahl.org * Installation: http://www.reahl.org/docs/current/tutorial/gettingstarted.d.html Reahl is a web application framework for Python programmers. With Reahl, programming is done purely in Python, using concepts familiar from GUI programming - like reusable Widgets and Events. There's no need for a programmer to know several different languages (HTML, JavaScript, template languages, etc) or to keep up with the tricks of these trades. The abstractions presented by Reahl relieve the programmer from the burden of dealing with the annoying problems of the web: security, accessibility, progressive enhancement (or graceful degradation) and browser quirks. Although a Reahl program benefits from having JavaScript available, it functions in the absence of JavaScript too. Search engines can crawl a Reahl program, and its pages can be bookmarked by browsers. Regards - Iwan From tkadm30 at yandex.com Wed Apr 9 17:19:58 2014 From: tkadm30 at yandex.com (Etienne Robillard) Date: Wed, 09 Apr 2014 15:19:58 -0000 Subject: [Web-SIG] no_authkit_users_in_environ Message-ID: <20140409191956.JtDSVv29@smtp1h.mail.yandex.net> Hello, I'm trying to make cookie auth working with authkit but cannot find a healthy solution. So far here's the code which i'm trying to use for getting a users object into the environ: #!/usr/bin/env python from notmm.controllers.wsgi import WSGIController from notmm.controllers.auth import LoginController from notmm.utils.http import httpserver from notmm.utils.configparse import loadconf sample_app = WSGIController() settings = sample_app.settings global_conf = loadconf('auth.conf') auth_conf = global_conf['authkit'] auth_app = LoginController(sample_app, auth_conf, settings=settings) if __name__ == '__main__': httpserver.daemonize(auth_app, ('localhost', 8000)) And here's the login view to handle authentication: def authenticate_user(request, username, password, tokens='', user_data=time.ctime, authfunc='paste.auth_tkt.set_user'): """Authenticate the user into the site and update the last_modified timestamp if authentication and authorization granted user access.""" try: user_setter_func = request.environ[authfunc] if valid_password(request.environ, username, password): user_setter_func(username, tokens=tokens, user_data=user_data()) #trigger function here to update the last_modified timestamp log.debug('User %s has been authenticated and authorized access!!' % username) raise NotAuthenticatedError except (KeyError, Exception): raise NotAuthenticatedError return None controller: class AuthCookieController(SessionController): """ Authentication controller to delegate authorization to generic user-defined backends. """ request_class = HTTPRequest response_class = HTTPResponse def __init__(self, wsgi_app, auth_conf=None, **kwargs): super(AuthCookieController, self).__init__(**kwargs) #put a pointer on the previous wsgi app in the stack self.wsgi_app = wsgi_app self.auth_conf_wrapper = auth_middleware(wsgi_app, app_conf=auth_conf, cookie_secret='secret string', #handle_httpexception=False, valid=self.authenticate, #enforce=self.auth_conf['enforce'] ) def application(self, environ, start_response, exc_info=None): # apply the response middleware wrapper to # the WSGI stack and return a callable obj return self.auth_conf_wrapper(environ, start_response) def authenticate(self, username, password): """ Authenticate with the provided ``username`` and ``password``. Developers are expected to override this method in custom authentication subclasses. """ if username == password: return username else: return None LoginController = AuthCookieController the traceback: > /home/steiner/src/notmm/trunk/examples/auth/views/login.py(33)authenticate_user() -> if valid_password(request.environ, username, password): (Pdb) bt /home/steiner/src/notmm/trunk/examples/auth/redirect.py(15)() -> httpserver.daemonize(auth_app, ('localhost', 8000)) /home/steiner/src/notmm/trunk/lib/notmm/utils/http/httpserver.py(157)daemonize() -> server.serve() /home/steiner/src/notmm/trunk/lib/notmm/utils/http/httpserver.py(115)serve() -> self.server.serve_forever() /usr/local/lib/python2.7/SocketServer.py(238)serve_forever() -> self._handle_request_noblock() /usr/local/lib/python2.7/SocketServer.py(295)_handle_request_noblock() -> self.process_request(request, client_address) /usr/local/lib/python2.7/SocketServer.py(321)process_request() -> self.finish_request(request, client_address) /usr/local/lib/python2.7/SocketServer.py(334)finish_request() -> self.RequestHandlerClass(request, client_address, self) /usr/local/lib/python2.7/SocketServer.py(649)__init__() -> self.handle() /usr/local/lib/python2.7/wsgiref/simple_server.py(124)handle() -> handler.run(self.server.get_app()) /usr/local/lib/python2.7/wsgiref/handlers.py(85)run() -> self.result = application(self.environ, self.start_response) /home/steiner/src/notmm/trunk/extras/libauthkit/authkit/authenticate/base.py(314)__call__() -> return self.app(environ, start_response) /home/steiner/src/notmm/trunk/extras/libauthkit/authkit/authenticate/cookie.py(480)__call__() -> return self.app(environ, cookie_setting_start_response) /home/steiner/src/notmm/trunk/extras/libauthkit/authkit/authenticate/multi.py(87)__call__() -> app_iter = app(environ, start_response) /home/steiner/src/notmm/trunk/extras/libauthkit/authkit/authenticate/multi.py(55)app() -> return self.default(environ, find) /home/steiner/src/notmm/trunk/extras/libauthkit/authkit/authenticate/base.py(304)__call__() -> return self.app(environ, start_response) /home/steiner/src/notmm/trunk/examples/auth/views/login.py(96)login() -> authenticate_user(request, username, password) > /home/steiner/src/notmm/trunk/examples/auth/views/login.py(33)authenticate_user() -> if valid_password(request.environ, username, password): /home/steiner/src/notmm/trunk/extras/libauthkit/authkit/authenticate/base.py(97)valid_password() -> raise no_authkit_users_in_environ And heres the config i use: [authkit] authkit.setup.enable = true authkit.setup.method = redirect,cookie authkit.setup.handle_exceptions = false #authkit.authenticate.callback = authkit.authenticate.cookie2:middleware #authkit.digest.authenticate.user.data = visitor:open_sesame #authkit.digest.realm = 'Test realm' # authentication options authkit.redirect.url = /session_login/ #authkit.user.type = mainapp.accounts.model:UserManager as you can see authkit middleware doesnt set up a proper users object, which make authentication fail. Is there thus an alternative method to set up the middleware to handle form authentication in authkit? Regards, Etienne