def connect(**kwargs): """ Connects to the OpenSRF network, parses the IDL, and loads the CSEditor. """ osrf.system.System.connect(**kwargs) IDLParser.parse() oilsLoadCSEditor()
def remote_connect(**kwargs): """ Connects to the opensrf network, parses the IDL file, and loads the CSEditor. This version of connect does not talk to opensrf.settings, which means it also does not connect to the opensrf cache. """ osrf.system.System.net_connect(**kwargs) IDLParser.parse() oilsLoadCSEditor()
def remote_connect(**kwargs): """ Connects to the OpenSRF network, parses the IDL, and loads the CSEditor. This version of connect does not talk to opensrf.settings, which means it also does not connect to the OpenSRF cache. """ osrf.system.System.net_connect(**kwargs) IDLParser.parse() oilsLoadCSEditor()
def oilsLoadCSEditor(): """ Creates a class method for each action on each type of fieldmapper object """ global __editor_loaded if __editor_loaded: return __editor_loaded = True obj = IDLParser.get_parser().idl_object for fmap in obj.itervalues(): for action in ACTIONS: fmname = fmap.fieldmapper.replace('::', '_') obj_type = fmap.fieldmapper.replace('::', '.') name = "%s_%s" % (action, fmname) method = 'def %s(self, arg, **options):\n' % name method += '\treturn self.runMethod("%s", "%s"' % (action, obj_type) method += ', arg, dict(options))\n' method += 'setattr(CSEditor, "%s", %s)' % (name, name) exec(method)
def oilsLoadCSEditor(): global __editor_loaded if __editor_loaded: return __editor_loaded = True obj = IDLParser.get_parser().IDLObject for k, fm in obj.iteritems(): for action in ACTIONS: fmname = fm.fieldmapper.replace('::', '_') type = fm.fieldmapper.replace('::', '.') name = "%s_%s" % (action, fmname) s = 'def %s(self, arg, **options):\n' % name s += '\treturn self.runMethod("%s", "%s", arg, dict(options))\n' % (action, type) s += 'setattr(CSEditor, "%s", %s)' % (name, name) exec(s)
def connect(**kwargs): """Connects to the opensrf network, parses the IDL file, and loads the CSEditor""" osrf.system.System.connect(**kwargs) IDLParser.parse() oilsLoadCSEditor()