Alberto Valverde schrieb:
>
> On Aug 26, 2007, at 3:30 PM, Diez B. Roggisch wrote:
>
>> Alberto Valverde schrieb:
>>> retrieve_resources is never called by TG since the "old" mechanism
>>> (retrieve_javascript/retrieve_css) is used instead in
>>> controllers._process_output (which I plan to deprecate sometime...).
>>> The best way to programatically add javascript is to append them to
>>> self.javascript inside __init__. However, there's no way ATM to add
>>> resources once a widget is initialized (which works in both TG 1.0
>>> and Pylons). If you need to do the later please open a ticket so
>>> someone/I can look at it.
>> Hrmpf. It's a bit misleading then that it reads in the source
>>
>> """
>> @only_if_initialized
>> def retrieve_javascript(self):
>> #XXX: Should be deprecatred and use only retrieve_resources
>> from toscawidgets.resources import JSMixin
>> return filter(lambda r: isinstance(r, JSMixin),
>> self._resources)
>>
>> """
>>
>>
>> without any comment on the retrieve_resources method that it's
>> currently
>> not in use.
>
> Pylons and WSGI apps do use it :) (its only TG 1.0 the one it
> doesn't). However, you're right that I should add a comment in the
> source explaining it.
Ok, I tried the retrieve_javascript-function as well as a simple
javascript-property.
So my widget looks like this:
class TagInputWidget(Widget):
template = """
<input xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
type="text"
name="name"
/>
"""
javascript = [JSSource("""
alert("huhu");
""")]
But this gives me the error
File
"/Users/deets/Projects/privat/TurboGears/Versions/TG11/lib/python2.5/Genshi-0.4.4-py2.5.egg/genshi/input.py",
line 41, in ET
tag_name = QName(element.tag.lstrip('{'))
AttributeError: 'Stream' object has no attribute 'tag'
Any idea what's going on here?
Diez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---