Permalink
Browse files

Re-added ancient/missing js_function __str__ behavior discovered in t…

…he bowels of moksha.
  • Loading branch information...
ralphbean committed Mar 19, 2012
1 parent edc5750 commit 1d45fe4242d9db17cce8773676f2b77675e8e1d5
Showing with 10 additions and 0 deletions.
  1. +7 −0 tests/test_js.py
  2. +3 −0 tw2/core/js.py
@@ -33,3 +33,10 @@ def test_js_symbol(self):
def test_js_callback(self):
eq_(str(js_callback("update_div")), 'update_div')
eq_(str(js_callback(js_function('foo')(1,2,3))), 'function(){foo(1, 2, 3)}')
def test_jsonified_js_function(self):
obj = {
'f': js_function("$.awesome")
}
json = self.encode(obj)
eq_(json, '{"f": $.awesome}')
@@ -202,6 +202,9 @@ def __init__(self, name):
def __call__(self, *args):
return _js_call(self.__name, [], args, called=True)
def __str__(self):
return self.__name
class _js_call(object):

0 comments on commit 1d45fe4

Please sign in to comment.