On 10/21/12, Roberto Longobardi <secc...@gmail.com> wrote:
> Hi,

:)
thanks for your reply

> the following works well for javascript conditional include.
>
> Let's say you wish to include test1.js and/or test2.js based on a test1 and
> test2 boolean values:
>
> 1) Inside your request handler:
>             data = {}
>             data['test1'] = True
>             data['*test2*'] = *False*
>
>             return 'testolemis.html', data, None
>

... this is exactly what I'm trying to avoid because it's a generic
template that will be <xi:include />'ed inside the body of may other
templates and reused many times , hence

1. I want all this to happen transparently for request
    handlers (... or filters ...) without handler global data
    being involved .
2. I'd prefer to make this happen as ootb as possible ;)

[...]
>
> I guess a similar solution may be found for CSS.
>

yes , I read your suggestion and something similar to that for CSS
should work as well .

Nonetheless for the moment I've been using this quick hack ,

{{{
#!genshi

<?python

from trac.web import chrome as _chrome

if (cond):
    _chrome.add_script('xxx.js')
    _chrome.add_stylesheet('xxx.css')
    ...
else:
    _chrome.add_script('xxy.js')
    _chrome.add_stylesheet('xxy.css')
    ...

?>

}}}

... but I'd like to know if the import , etc ... can be omitted
somehow . I really try to avoid using <?python ?> PI so much as
possible .

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to trac-users@googlegroups.com.
To unsubscribe from this group, send email to 
trac-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.

Reply via email to