On Sat, 2005-11-12 at 14:24 -0500, Kevin Dangoor wrote:
> Hi Sean,
> 
> Nothing like a proposal that includes a patch :)
> 
> I do agree that the monolithic, growing expose is not ideal, and I do
> want to make it possible (and easy!) to use other decorators, because
> they can be quite useful.
> 
> Just to confirm my hunch (without actually looking at your patch :):
> 
> @turbogears.expose(html="my.template")
> def save(self, name, address):
>     ...do something...
>     return dict(foo="bar")
> 
> This will still work just as before.

Yep!

> So the main bit that your patch does is break out any input related
> behavior and expose parameters into a new decorator. It's not really
> any more verbose, it's just moving them to a new home. Seems like a
> good idea on the surface.

Correct, all the patch does is move the validator and forminput stuff to
a new decorator called unpack.  Unpack will always have to be the first
decorator on your methods (currently, expose has to be first):

@turbogears.expose(html="my.template")
... other decorators can now go here and work! ...
@turbogears.unpack(validators={...}, forminput="...")
def save(self, name, address):
    ...do something...
    return dict(foo="bar")


I am hacking on my Paginator class and adding a decorator to it, but
need these changes to expose to enable my decorator to work (it needs to
be able to get at the method's return dict before it becomes HTML!).


Sean



> Kevin
> 
> On 11/12/05, Sean Cazzell <[EMAIL PROTECTED]> wrote:
> >
> > I have opened a ticket for this and submitted a patch (diff of
> > controllers.py only) that splits expose into expose and unpack.  Perhaps
> > unpack should be called something else (validate)?
> >
> > http://trac.turbogears.org/turbogears/ticket/113
> >
> >
> >
> > Sean
> >
> >
> 
> 
> --
> Kevin Dangoor
> Author of the Zesty News RSS newsreader
> 
> email: [EMAIL PROTECTED]
> company: http://www.BlazingThings.com
> blog: http://www.BlueSkyOnMars.com

Reply via email to