Hi Jason,

Yes, modifying CSSLink to accept attrs was the first thing that came
to my mind, but I'm not sure if there would be a negative effect....
After all, almost all widgets supports attrs... and if it was omitted
for these resources/links, maybe there is for an important reason.

Well, at least you've confirmed my suspects...   :D


Ciao (a la Michelle)
Roger



On 3/9/06, Jason Chu <[EMAIL PROTECTED]> wrote:
> On Thu, Mar 09, 2006 at 12:34:30AM -0300, Roger Demetrescu wrote:
> >
> > Hello all !
> >
> > CSS widget is rendered this way:
> >
> > >>> css = CSSLink(mod=static, name="sample.css")
> > >>> css.render()
> > '<LINK HREF="/tg_widgets/turbogears.widgets/sample.css"
> > TYPE="text/css" REL="stylesheet">'
> >
> >
> >
> > Well, I'd like to be able to render something like:
> >
> > '<LINK HREF="/tg_widgets/turbogears.widgets/sample.css"
> > TYPE="text/css" REL="stylesheet" MEDIA="printer">'
> >
> > ...but "media" actually isn't a valid argument.
> >
> > >>> css = CSSLink(mod=static, name="sample.css", media="printer")
>
> Usually the proper method to do this is overriding attrs variable at
> render/display time:
>
> >>> a = CSSLink(mod=static, name="sample.css")
> >>> a.render(attrs=dict(media='printer'))
>
> Problem is that CSSLink does have to be changed.  Line 621:
>
>     template = '<link rel="stylesheet" type="text/css" href="$link"/>'
>
> needs to become
>
>     template = '<link rel="stylesheet" type="text/css" href="$link"
> py:attrs="attrs"/>'
>
> I bet if you asked nicely, someone with commit privs would do it for you.
>
> Jason
>
> --
> If you understand, things are just as they are.  If you do not understand,
> things are just as they are.
>
>
>

--~--~---------~--~----~------------~-------~--~----~
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