On Tue 2006-10-03 (15:09), Adam Jones wrote:
> Neil Blakey-Milner wrote:
> > Hey there,
> >
> > I'm doing a "technology preview" of what TurboGears may look like in the
> > near future - SQLAlchemy, Genshi, and Routes.  So far, I like it a lot -
> > Routes allows me to do some stuff I couldn't easily otherwise do.
> 
> I hadn't heard anything about Routes being in the future for TG. My
> understanding was that the project is going to stick with CherryPy for
> the forseeable future. Do you have any pointers to what you saw that
> suggested this change? If this is just a bit of wishful thinking I
> agree with you. The rest of CherryPy is outstanding, but I prefer the
> explicit flexability of solutions like Routes. (That said CP can be
> very flexible, it just takes more cleverness than I like using in one
> place)

Well, Kevin has said (he'll correct me if I'm wrong, I'm sure) that he'd
like to make using Routes easier (for "legacy URLs", if I recall).  But
beyond that, nothing you're missing in terms of official direction.  I
chose it because it's an alternative.  I already know SQLObject and Kid
and the CherryPy way, so I'm trying the ways I know less well.

> > One problem I'm experiencing is that the expose decorator is what ties
> > the templating so nicely into things in TG.  But its primary purpose (at
> > least going by the name) is to expose the function to CherryPy - to set
> > the .exposed attribute on the function.
> 
> You can set the template in the return value as well, just return '
> tg_template="yoursite.templates.templatename" ' I don't know how firmly
> this is tied in to @expose, if at all.

It's tied to @expose entirely...

> > So, maybe this is another vote for using @view instead sometime in the
> > future - @expose(expose=False) looks a bit weird.  Until then, I'll just
> > create another decorator to remove the .expose attribute on the methods.
> 
> You might want to look into simply not using @expose and working with
> Routes directly. I don't see how changing @expose to @view is going to
> solve any problems for you.

Okay, maybe I didn't explain myself well enough here.  @expose does at
least two things:

1) Sets .exposed so that CherryPy can find it
2) Does template magic, including content type/accept format, and so
forth.

While named after #1, most of what it does is #2.  I also don't want #1
(it causes the method in question to be handled by CherryPy instead of
using Routes via the default method), but I do want #2.

But, @expose(expose=False) just feels ugly.  Hence, perhaps @view _is_ a
better name, even though I was originally in the @expose camp before I
started trying to use alternate dispatching.

Neil
-- 
Neil Blakey-Milner
[EMAIL PROTECTED]
http://mithrandr.moria.org/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to