Hi,
I know I can add javascript files to an trac page using add_script
from trac.web.chrome inside the post_process_request method of an
IRequestFilter object.
I need now to set a javascript variable to a value read from the
trac.ini in the HTML header. Any javascript file packeted with my code
will be probably packed inside an EGG file, and I don't like to change
these anyway.
I would now add an script tag to the HTML head which includes a short
javascript code sequence, ala:
<script type="text/javascript"> var abc = "1235534"; </script>
but the add_script method doesn't provide this functionality.
Its source code tells me that there is a 'scripts' set in req.chrome
holding all the scripts:
script = {'href': href(path), 'type': mimetype}
req.chrome.setdefault('scripts', []).append(script)
I tried to add a 'content' attribute (in different variations) to this
set but this doesn't work - an empty script take is produced. I don't
have time to go through the Trac, and maybe the Genshi, code further
to find out where and how this scripts set is transformed to HTML.
Probably it really only takes the 'href' and 'type' arguments, because
an valid 'charset' argument is also ignored.
Does anyone now a solution for my problem?
Martin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac
Users" 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/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---