Alberto Valverde schrieb:
> 
> On Aug 24, 2007, at 4:08 PM, Diez B. Roggisch wrote:
> 
>> Hi,
>>
>> I'm trying to wet my feet with TWs. But I encounter a problem with the
>> following widget:
>>
>> class TagInputWidget(Widget):
>>
>>      template = """
>> <input xmlns="http://www.w3.org/1999/xhtml";
>>        xmlns:py="http://genshi.edgewall.org/";
>>        type="text"
>>        name="name"
>> />
>> """
>>      def retrieve_resources(self):
>>          print "foobar"
>>          res = super(TagInputWidget, self).retrieve_resources()
>>          res.append(JSSource("""
>> alert("huhu");
>> """))
>>          return res
>>
>> The retrieve_resources-method is never called, I don't get to see the
>> foobar in the output.
>>
>> So I was wondering what I'm supposed to do to get my JSSource  
>> rendered.
> 
> 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.

Regarding the post-initilization-JS: For my usecase at hand, I don't 
think I need that.

Regards,

Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to turbogears-trunk@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to