william wrote:
I'm thinking on how is the best to add my own CP Filter to TG ?
I've looked at the Identity code. And they have implemented a CP
Filter.
But, they've "hard coded" it in startup.py (a TG file).
Does this does not sounds nice and flexible.
Is there other methods ?
By adapting the <project>-start.py script ?
By adapting the dev.cfg (or prod.cfg) ?
I would not update TG code.
I'm not *particularly* proud of having hard-coded the IdentityFilter in
startup.py. (In fact, I broke a couple tests when I did so. Sorry, Kevin.)
Unfortunately, this is among the nasty CherryPy-isms I've found while
building the identity code. By the time TurboGears' startup code
executes, it's too late to install a filter via the config file.
I'd actually thought about tweaking <project>-start.py so that newly
generated projects automatically got the filter, but I *really* wanted
everyone to have this available to them.
CherryPy has an undocumented list of input and output filters which you
can set in the global section. I never did get it to work, although I
read the code about a dozen times. But when I was trying to figure it
all out, it was rather early in the morning.
Jeff
--
Jeff Watkins
http://metrocat.org/