add JsOutput class to simplify the use of orun on django

master
unknown 2013-05-11 02:24:06 -03:00
parent 1650c0da18
commit 71f2accfcc
1 changed files with 19 additions and 1 deletions

View File

@ -129,6 +129,24 @@ class JsObjectNode(JsNode):
super(JsObjectNode, self).__call__(*args, **kwargs) super(JsObjectNode, self).__call__(*args, **kwargs)
write(str(self)) write(str(self))
class JsOutput(object):
def __init__(self, manager=True):
self.body = []
if manager:
js_manager = self
def __lshift__(self, other):
self.write(other)
def write(self, code):
self.body.append(code)
def __str__(self):
s = ';\n'.join(self.body)
return s
out = output = JsOutput
class JsObject(object): class JsObject(object):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self._loading = True self._loading = True