http://groups.google.com/group/toscawidgets-discuss
cheers.
-chris
---------- Forwarded message ----------
From: Andrew Basson <andrew.bas...@gmail.com>
Date: Mar 20, 8:45 pm
Subject: FlotWidget - tw.jquery 0.9.4 and tg2b7 - empty
To: TurboGears Trunk
Hi,
Ok, I hacked and got a chart...
2009/3/21 Andrew Basson <andrew.bas...@gmail.com>:
> Hi,
>>http://paste.turbogears.org/paste/39329
> With further investigation and editing the output of the rendered
> template as a static page and trying to get that to work...
> It seems that tw.core.js is escaping the id of the widget and this is
> breaking tw.jquery.FlotWidget
> Here is a snippet from tw.core.js that shows the escaping behaviour of
> the id selector as per the paste above.
Ok, so I hacked __get_js_repr on _js_call and put in a replace as per
below.
class _js_call(object):
__slots__ = ('__name', '__call_list', '__args', '__called')
def __init__(self, name, call_list, args=None, called=False):
self.__name = name
self.__args = args
call_list.append(self)
self.__call_list = call_list
self.__called = called
def __getattr__(self, name):
return self.__class__(name, self.__call_list)
def __call__(self, *args):
self.__args = args
self.__called = True
return self
def __get_js_repr(self):
if self.__called:
args = self.__args
return '%s(%s)' % (self.__name, ', '.join(imap(encode,
args)).replace('\\',''))
else:
return self.__name
Don't know what else will break, but for now I'm happy to fall into
bed knowing I can finally produce a chart.
Cheers, Andrew.
2009/3/24 srlindemann <srlin...@gmail.com>:
>
> This is the same problem I have encountered this week and recently
> sent to the list. I don't think that Andrew's solution is the correct
> one, in the general case. I looked at the simplejson source, and the
I agree that my solution is a little drastic and way off the charts.
No pun intended :)
Thanks for the feedback.
Andrew.