def __init__(self, parser, parent, name, base_classes): HandlerBase.__init__(self, parser, parent) self.classobj = new.classobj(name.encode('ascii'), base_classes, {}) self.locals = self.classobj.__dict__ self.globals = self.parent.locals self.codestr = ""
def __init__(self, parser, parent, name, atts): HandlerBase.__init__(self, parser, parent) self.locals = parent.locals self.globals = parent.globals self.module = parent.module test = atts['test'] self.element = IfNodeList(test)
def __init__(self, parser, parent, globals, name, atts): HandlerBase.__init__(self, parser, parent, globals) self.adder = globals['adder'] self.predicate = join(split(name, "^"), "") self.literal = 0 self.anonymous_object = 0 if atts.has_key("resource"): self.object = atts["resource"] self.object = absolutize(self.parser.GetBase(), self.object) for att in atts.keys(): if att == "resource": pass else: new_att = join(split(att, "^"), "") self.adder(self.object, new_att, atts[att], literal_object=1) elif atts.has_key(RESOURCE_ATTRIBUTE): self.object = atts[RESOURCE_ATTRIBUTE] self.object = absolutize(self.parser.GetBase(), self.object) for att in atts.keys(): if att == RESOURCE_ATTRIBUTE: pass else: new_att = join(split(att, "^"), "") self.adder(self.object, new_att,atts[att], literal_object=1) else: self.object = "" self.literal = 1
def __init__(self, parser, parent, globals, atts): HandlerBase.__init__(self, parser, parent, globals) self.adder = globals['adder'] self.subject = None self.anonymous = 0 if atts.has_key("about"): self.subject = atts["about"] elif atts.has_key("ID"): self.subject = "#" + atts["ID"] elif atts.has_key(ABOUT_ATTRIBUTE): self.subject = atts[ABOUT_ATTRIBUTE] elif atts.has_key(ID_ATTRIBUTE): self.subject = "#" + atts[ID_ATTRIBUTE] else: self.subject = ANON + generate_uri() self.anonymous = 1 self.subject = absolutize(self.parser.GetBase(), self.subject) for att in atts.keys(): if att == "about" or att == "ID" or \ att == ABOUT_ATTRIBUTE or att == ID_ATTRIBUTE: pass else: new_att = join(split(att, "^"), "") self.adder(self.subject, new_att, atts[att], anonymous_subject=self.anonymous, literal_object=1)
def end(self, name): HandlerBase.end(self, name) self.codestr = "self.apply(" if self.modules: self.codestr = self.codestr + "modules=(%s,), " % self.modules self.codestr = self.codestr + ")" code = __builtin__.compile(self.codestr, self.codestr, 'exec') self.element.code = code
def __init__(self, parser, parent, name, atts): HandlerBase.__init__(self, parser, parent) self.locals = self.parent.locals self.globals = self.parent.globals self.module = parent.module item = atts['item'] list = atts['list'] code = __builtin__.compile(list, list, "eval") self.element = ForNodeList(item, code)
def __init__(self, parser, parent, name, base_classes): HandlerBase.__init__(self, parser, parent) self.locals = {} self.locals['_RF_sub_modules'] = [] self.globals = self.parent.locals self.codestr = "" self.name = name self.module = parent.module self.base_classes = base_classes
def __init__(self, parser, parent, name, atts): HandlerBase.__init__(self, parser, parent) self.locals = parent.locals self.globals = parent.globals self.module = parent.module e_atts = {} for key in atts.keys(): e_atts[key] = parse_attribute(atts[key]) self.element = ElementNode(name, e_atts)
def __init__(self, parser, name): HandlerBase.__init__(self, parser, None) self.name = name from redfoot.rednode import RedNode uri = 'tmp' self.rednode = RedNode(uri) self.rednode.local.location = "TODOtmplocation" self.rednode.local.uri = uri self.globals = {'adder': self.rednode.local.add_statement}
def end(self, name): HandlerBase.end(self, name) self._exec(adjust_indent(self.codestr)+"\n") classobj = new.classobj(self.name.encode('ascii'), self.base_classes, self.locals ) classobj.sub_modules = sub_modules module = self.module classobj.__module__ = module.__name__ module.__dict__[classobj.__name__] = classobj module.__dict__['_RF_APP'] = classobj module.__dict__['_RF_get_app'] = lambda uri, app_class=classobj: app_class(uri)
def __init__(self, parser, parent, globals, atts): HandlerBase.__init__(self, parser, parent, globals) self.literal = 0 if atts.has_key("resource"): self.value = atts["resource"] self.value = absolutize(self.parser.GetBase(), self.value) elif atts.has_key(RESOURCE_ATTRIBUTE): self.value = atts[RESOURCE_ATTRIBUTE] self.value = absolutize(self.parser.GetBase(), self.value) else: self.value = "" self.literal = 1
def __init__(self, parser, parent, atts={}): HandlerBase.__init__(self, parser, parent) self.locals = self.parent.locals self.globals = self.parent.globals self.codestr = "" encode = atts.get("encode", None) if encode: encode = __builtin__.eval(encode, self.globals, self.locals) else: encode = encode_character_data # TODO: add supoprt for EvalNode without Encoding? self.element = EncodedEvalNode(None, encode)
def __init__(self, parser, parent, atts): HandlerBase.__init__(self, parser, parent) if not atts.has_key('instance'): msg = "sub-module is missing required instance attribute" raise SyntaxError, msg instance_name = atts['instance'] if not atts.has_key('class'): msg = "sub-module is missing required class attribute" raise SyntaxError, msg class_name = atts['class'] from_str = atts.get('from', None) if from_str: self.module = self.parent.module self.globals = self.module.__dict__ self.locals = self.globals self._exec("from %s import %s" % (from_str, class_name)) parent.locals['_RF_sub_modules'].append((instance_name, class_name))
def __init__(self, parser, name): HandlerBase.__init__(self, parser, None) self.name = name
def __init__(self, parser, parent, globals): HandlerBase.__init__(self, parser, parent, globals)
def end(self, name): self.adder(self.parent.subject, self.predicate, self.object, literal_object=self.literal, anonymous_object=self.anonymous_object) HandlerBase.end(self, name)
def end(self, name): self.parent.add_li(self.value, self.literal) HandlerBase.end(self, name)
def end(self, name): HandlerBase.end(self, name) exec self.codestr+"\n" in self.globals, self.locals
def __init__(self, parser, parent, name): HandlerBase.__init__(self, parser, parent) self.module = new.module(name) self.globals = self.module.__dict__ self.locals = self.globals self.codestr = ""
def __init__(self, parser): HandlerBase.__init__(self, parser, None)
def end(self, name): HandlerBase.end(self, name) self._exec(adjust_indent(self.codestr)+"\n")
def end(self, name): HandlerBase.end(self, name) self.codestr = adjust_indent(self.codestr) code = __builtin__.compile(self.codestr, self.codestr, self.kind()) self.element.code = code
def __init__(self, parser, parent, modules): HandlerBase.__init__(self, parser, parent) self.locals = self.parent.locals self.globals = self.parent.globals self.modules = modules self.element = EvalNode()