Hi David! Sorry, I just found your message in pylons discuss, when just searched the list for "posts" about RUM. There exists a mailing list for rum, on which I can more easily find questions: http://groups.google.com/group/rum-discuss
I try to reproduce the problem. Thank you very much for the nice words about RUM. Actually, it's rails scaffolding and django admin work still somewhat smoother, but using SA, RUM has a lot of potential: http://python-rum.org/wiki/AdvancedDataMapping And of course it has supported inheritance beginning with version 0.1 :-). Please don't hesitate to ask question about RUM and its customization on the RUM mailing list. Michael On 11 Jun., 20:45, david <[email protected]> wrote: > Hi, > > I am trying to incorporate "rum" into my pylons project. This was the > first time I have tried to incorporate another wsgi app into an > existing pylons app. > > Therumdocs state that a way to do this is to create a controller as > a *function*, like so: > > def AdminController(environ, start_response): > > authorize('admin') # calls redirect_to('login') if not logged in > ... > return my_rum_app(environ, start_response) > > routes are something like: > > map.connect('admin', '/admin', controller='admin') > map.connect('/admin/{url:.*}', controller='admin') > > So all /admin.* urls go to this function, AdminController. And it > works fine. > > However, when I want to to some authentication, and call redirect_to > ("login") before the final call to my_rum_app if not logged in, I > don't get a redirect, but rather an uncaught exception: > > "HTTPFound: 302 Found content- > type: text/html; charset=UTF-8 Content-Length: 0 location: /login/ " > > I figured out a way to avoid this problem, but am wondering if there > is a better way. Here is what I did: > > Instead of controller function, I made a standard controller class, > with a single action "index". It turns out that for the routes above, > *all* requests go to index() (not sure why!). > > class AdminController(BaseController): > def index(self): > authorize('admin') > ... > return my_rum_app(request.environ, self.start_response) > > This works just fine and redirects work correctly, but am wondering > how to fix up the first solution with controller as a function so that > the redirect exceptions are processed by pylons. Partially, the reason > I would like to know is to increase my understanding of how this whole > thing works! > > Thanks, > David > > PS: "rum", by the way, looks like a dynamite package! Haven't played > with it enough to know everything, but looks like it could easily > function as the admin CRUD interface everybody thinks is so great > about rails... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
