On Sat, Jun 21, 2008 at 7:22 PM, Shannon -jj Behrens <[EMAIL PROTECTED]> wrote:
>
> On Sat, Jun 21, 2008 at 7:53 AM, Jonathan Vanasco <[EMAIL PROTECTED]> wrote:
>> i had a similar situation -- i wanted to change url_for's output on
>> people who have a 'preview' cookie and those who don't
>>
>> i basically did this
>>
>> def url_for_custom( url ):
>> rval = url_for(url)
>> if logic_test():
>> rval = regex or stringsub or both
>> return rval
>>
>> then quickly did a find/replace on the entire pylons app with url_for -
>>> url_for_custom
>>
>> its ridiculously not messy, simple, and gets the job done.
>
> url_for comes from webhelpers. Can't you just hijack it there and
> reuse the same name?
url_for comes from Routes. It's trivially imported into WebHelpers
but that was a mistake. For WebHelpers 0.6-dev, you should put "from
routes import url_for" in helpers.py if you want h.url_for.
As for the magic transformation of "content" to
"/stylesheets/content.css", h.stylesheet_link_tag("content") does
that. It also calls url_for to get the application prefix, and
generates the <link> tag. But that also is deprecated in WebHelpers
0.6 as too magical. The 0.6 version is:
h.stylesheet_link(h.url_for("/stylesheets/content.css")) #
Imported from webhelpers.html.tags
--
Mike Orr <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---