Michele,

Thanks for the pointer to that ticket.

PositionalParametersAware has a default method with some simple dispatch
logic.  It doesn't work with turbogears.expose validators - they depend
on arguments being passed to the controller method by name so
turbogears.expose can match them up with the appropriate validator.

CherryPy 2.2 is going to allow positional arguments on all methods.  I'm
not sure what their time frame for a 2.2 release is and how that will
work with Kevin's schedule for TG 1.0, but if we can get 2.2 in 1.0 that
would rock.

Beside this, we still need to fix the turbogears.expose validators to
work with positional arguments.  One way is to require turbogears.expose
to be the first decorator on your controller methods - this way it can
use introspection to discover the names of your method's positional
args.  Does anyone have any objections to mandating that
turbogears.expose be the first decorator?

The other solution is to have another argument to turbogears.expose -
something like positional_validators.  But this is kind of ugly, IMHO.


Sean Cazzell
 




On Sat, 2005-11-05 at 18:18 -0800, Michele Cella wrote:
> Hi Sean,
> 
> Sean Cazzell wrote:
> >
> >
> > Kevin, adding back positional params will be awesome.  I know you can
> > currently use default, but you are going to have to create a separate
> > class for every exposed method or put some sort of dispatch logic into
> > your Root.default.  I do agree that not having to maintain a separate
> > URL mapping file is nice and DRY.
> 
> You don't need a default method for every class, instead you can just
> inherit your controller from this class:
> 
> cherrypy.lib.cptools.PositionalParametersAware
> 
> Take a look at ticket #73:
> 
> http://trac.turbogears.org/turbogears/ticket/73
> 
> I think that's the interim solution Kevin was talking about, It's a
> simple fix so I hope it will make it to 0.9 on the base Controller
> class, not only the Root one.
> 
> >
> > Also turbogears.expose validators do not work with positional
> > parameters.  I've toyed with various fixes to this - my initial thought
> > was to do introspection on the decorated method, but I think that breaks
> > when you have stacked decorators like
> >
> 
> Do they work with the above solution? Unfortunately I can't experiment
> ATM.
> 
> Ciao
> Michele
> 

Reply via email to