Re: [web2py] Re: Metaprogramming in controller

2011-07-08 Thread Miguel Lopes
:-) On Fri, Jul 8, 2011 at 2:25 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: yes. even better use router (vs routes) On Jul 6, 10:03 am, Miguel Lopes mig.e.lo...@gmail.com wrote: Humm, Nice. Yes, closures are enough, and cleaner too. Is routes OK for production mode?

Re: [web2py] Re: Metaprogramming in controller

2011-07-07 Thread Miguel Lopes
I see closures are not even necessary. The solution is using routes. For the interested routes is ok for production (the embargo was old-news). Here's some info: https://mail.google.com/mail/?shva=1#search/routes+production/12a53a18e7f6b2d5 Miguel On Wed, Jul 6, 2011 at 4:03 PM, Miguel Lopes

[web2py] Re: Metaprogramming in controller

2011-07-07 Thread Massimo Di Pierro
yes. even better use router (vs routes) On Jul 6, 10:03 am, Miguel Lopes mig.e.lo...@gmail.com wrote: Humm, Nice. Yes, closures are enough, and cleaner too. Is routes OK for production mode? Txs, Miguel On Wed, Jul 6, 2011 at 3:54 PM, Massimo Di Pierro massimo.dipie...@gmail.com

[web2py] Re: Metaprogramming in controller

2011-07-06 Thread Massimo Di Pierro
Can you explain the goal? On Jul 6, 3:23 am, Miguel Lopes mig.e.lo...@gmail.com wrote: I'm experimenting with dynamically generating functions, aka 'actions' in controllers. However, I've been unsuccessful. I can use exec and closures successfully in regular Python code, but I can't make it

Re: [web2py] Re: Metaprogramming in controller

2011-07-06 Thread Miguel Lopes
I putting together an interface where users can add pages to a site and have these pages indistinguishable from hard-coded pages/functions. However, I would have the best of both worlds and have very clean urls. Thus, I'm trying to avoid things like:

[web2py] Re: Metaprogramming in controller

2011-07-06 Thread Massimo Di Pierro
Jonathan is right. Here is a simple way around. Create a single controller called dynamical. use request.args(0) to parse the name of one of the dynamical actions and remap def dynamical(): actionname, request.args[:] = request.args(0), request.args[1:] # call actionname and pass

Re: [web2py] Re: Metaprogramming in controller

2011-07-06 Thread Miguel Lopes
Humm, Nice. Yes, closures are enough, and cleaner too. Is routes OK for production mode? Txs, Miguel On Wed, Jul 6, 2011 at 3:54 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Jonathan is right. Here is a simple way around. Create a single controller called dynamical. use