当前位置: 首页>>代码示例>>Python>>正文


Python CompositeNode.set方法代码示例

本文整理汇总了Python中mpx.lib.node.CompositeNode.set方法的典型用法代码示例。如果您正苦于以下问题:Python CompositeNode.set方法的具体用法?Python CompositeNode.set怎么用?Python CompositeNode.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mpx.lib.node.CompositeNode的用法示例。


在下文中一共展示了CompositeNode.set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CNEDispatch

# 需要导入模块: from mpx.lib.node import CompositeNode [as 别名]
# 或者: from mpx.lib.node.CompositeNode import set [as 别名]
class CNEDispatch(CompositeNode):
    def __init__(self, *args, **kw):
        self.wsresponse = None
        self.soapnodes = None
        self.endnode = None
        self.startnode = None
        self.xmlnodes = None
        self.parseXML = False
        self.parseSOAP = True        
        self.serviceproxy = None
        self.currenttime = None
        self.password = None
        self.account = None
        self.namespace = None
        self.wsdlURL = None
        self.timeformat = '%Y-%m-%dT%H:%M:%S'
        super(CNEDispatch, self).__init__(*args, **kw)
    def configure(self, config):
        self.wsdlURL = config.get('WSDL', self.wsdlURL)
        self.account = config.get('account', self.account)
        self.password = config.get('password', self.password)
        self.namespace = config.get('namespace', self.namespace)
        self.timeformat = config.get('timeformat', self.timeformat)
        super(CNEDispatch, self).configure(config)
    def configuration(self):
        config = super(CNEDispatch, self).configuration()
        config['WSDL'] = self.wsdlURL
        config['account'] = self.account
        config['password'] = self.password
        config['namespace'] = self.namespace
        config['timeformat'] = self.timeformat
        return config
    def setup(self):
        dispatch = service.WSDLService(self.wsdlURL)
        namespace = dispatch.wsdlDocumentProxy.wsdl.targetNamespace
        if self.namespace is None:
            self.namespace = namespace
        dispatch.setNamespace(self.namespace)
        dispatch.disableNSPrefixing()
        dispatch.soapResultUnwrappingOff()
        dispatch.soapObjectSimplifyingOff()
        dispatch.debuggingOff()
        self.serviceproxy = dispatch
    def start(self):
        if not self.has_child('WS Response'):
            self.wsresponse = CompositeNode()
            self.wsresponse.configure({'parent': self, 
                                       'name': 'WS Response'})
            self.xmlnodes = xmldata.XMLDataNode()
            self.xmlnodes.configure({'name': 'XML Nodes', 
                                     'parent': self.wsresponse})
            self.soapnodes = soapdata.SOAPDataNode()
            self.soapnodes.configure({'name': 'SOAP Nodes', 
                                      'parent': self.wsresponse})
            

        else:
            self.wsresponse = self.get_child('WS Response')
            self.xmlnodes = self.wsresponse.get_child('XML Nodes')
            self.soapnodes = self.wsresponse.get_child('SOAP Nodes')
        if not self.has_child('Start time'):
            nodepath = path.join(as_node_url(self.soapnodes), 
                                 'GetAlertsResult/disp/emralert')
            self.startnode = AttributeNode()
            self.startnode.configure({'name': 'Start time', 
                                      'nodeurl': nodepath, 
                                      'attribute': 'start', 
                                      'parent': self})
            self.endnode = AttributeNode()
            self.endnode.configure({'name': 'End time', 
                                    'nodeurl': nodepath, 
                                    'attribute': 'end', 
                                    'parent': self})
        self.setup()
        super(CNEDispatch, self).start()
    def deprecated_start(self):
        if not self.has_child('WS Response'):
            self.wsresponse = xmldata.XMLDataNode()
            self.wsresponse.configure(
                {'name': 'WS Response', 'parent': self})
        else:
            self.wsresponse = self.get_child('WS Response')
        dispatch = service.SOAPService(self.serviceurl, self.namespace)
        dispatch.disableNSPrefixing()
        dispatch.setSoapAction(self.soapaction)
        dispatch.debuggingOff()
        dispatch.makeMethod('GetAlerts')
        dispatch.GetAlerts.appendArgument('UserName', 'string')
        dispatch.GetAlerts.appendArgument('Password', 'string')
        dispatch.GetAlerts.appendArgument('CurrentTime', 'string')
        self.serviceproxy = dispatch
        super(CNEDispatch, self).start()
    def deprecated_set(self, timestamp):
        if isinstance(timestamp, (int, float, long)):
            timetuple = time.localtime(timestamp)
            timestamp = time.strftime(self.timeformat, timetuple)
        elif timestamp in (None, 'None'):
            timestamp = time.strftime(self.timeformat)
        self.currenttime = timestamp
        self.serviceproxy.GetAlerts(self.account, 
#.........这里部分代码省略.........
开发者ID:mcruse,项目名称:monotone,代码行数:103,代码来源:dispatch.py

示例2: CNEPricing

# 需要导入模块: from mpx.lib.node import CompositeNode [as 别名]
# 或者: from mpx.lib.node.CompositeNode import set [as 别名]
class CNEPricing(CompositeNode):
    def __init__(self, *args, **kw):
        self.effectivedate = None
        self.wsresponse = None
        self.soapnodes = None
        self.xmlnodes = None
        self.parseXML = False
        self.parseSOAP = True
        self.serviceproxy = None
        self.priceCurve = None
        self.password = None
        self.account = None
        self.namespace = None
        self.wsdlURL = None
        self.dateformat = '%m/%d/%Y'
        super(CNEPricing, self).__init__(*args, **kw)
    def configure(self, config):
        self.priceCurve = config.get('priceCurve', self.priceCurve)
        self.wsdlURL = config.get('WSDL', self.wsdlURL)
        self.account = config.get('account', self.account)
        self.password = config.get('password', self.password)
        self.namespace = config.get('namespace', self.namespace)
        self.dateformat = config.get('dateformat', self.dateformat)
        super(CNEPricing, self).configure(config)
    def configuration(self):
        config = super(CNEPricing, self).configuration()
        config['WSDL'] = self.wsdlURL
        config['priceCurve'] = self.priceCurve
        config['account'] = self.account
        config['password'] = self.password
        config['namespace'] = self.namespace
        config['dateformat'] = self.dateformat
        return config
    def setup(self):
        pricing = service.WSDLService(self.wsdlURL)
        namespace = pricing.wsdlDocumentProxy.wsdl.targetNamespace
        if self.namespace is None:
            self.namespace = namespace
        pricing.setNamespace(self.namespace)
        pricing.disableNSPrefixing()
        pricing.soapResultUnwrappingOff()
        pricing.soapObjectSimplifyingOff()
        pricing.debuggingOff()
        self.serviceproxy = pricing
    def deprecated_setup(self):
        pricing = service.WSDLService(self.wsdlURL)
        pricing.debuggingOff()
        pricing.disableNSPrefixing()
        pricing.GetPrice.namespace = self.namespace
        pricing.GetPrice.clearArguments()
        pricing.GetPrice.appendArgument('strCurve', 'string')
        pricing.GetPrice.appendArgument('strEffectiveDate', 'string')
        pricing.GetPrice.appendArgument('CustAccount', 'string')
        pricing.GetPrice.appendArgument('Pwd', 'string')
        self.serviceproxy = pricing
    def start(self):
        if not self.has_child('WS Response'):
            self.wsresponse = CompositeNode()
            self.wsresponse.configure({'parent': self, 
                                       'name': 'WS Response'})
            self.xmlnodes = xmldata.XMLDataNode()
            self.xmlnodes.configure({'name': 'XML Nodes', 
                                     'parent': self.wsresponse})
            self.soapnodes = soapdata.SOAPDataNode()
            self.soapnodes.configure({'name': 'SOAP Nodes', 
                                      'parent': self.wsresponse})
            

        else:
            self.wsresponse = self.get_child('WS Response')
            self.xmlnodes = self.wsresponse.get_child('XML Nodes')
            self.soapnodes = self.wsresponse.get_child('SOAP Nodes')
        self.setup()
        super(CNEPricing, self).start()
    def deprecated_set(self, timestamp):
        if isinstance(timestamp, (int, float, long)):
            timetuple = time.localtime(timestamp)
            timestamp = time.strftime(self.dateformat, timetuple)
        elif timestamp in (None, 'None'):
            timestamp = time.strftime(self.dateformat)
        self.effectivedate = timestamp
        self.serviceproxy.GetPrice(
            self.priceCurve, self.effectivedate, self.account, self.password)
        self.wsresponse.set(self.serviceproxy.GetPrice.getResponse())
    def set(self, timestamp = None):
        if isinstance(timestamp, (int, float, long)):
            timetuple = time.localtime(timestamp)
            timestamp = time.strftime(self.dateformat, timetuple)
        elif timestamp in (None, 'None'):
            timestamp = time.strftime(self.dateformat)
        self.effectivedate = timestamp
        self.serviceproxy.GetPrice(
            strCurve=self.priceCurve, strEffectiveDate=self.effectivedate, 
            CustAccount=self.account, Pwd=self.password)
        response = self.serviceproxy.GetPrice.getResponse()
        if self.parseXML:
            self.xmlnodes.setValue(response.GetPriceResult)
        if self.parseSOAP:
            self.soapnodes.setValue(response)
    def get(self):
#.........这里部分代码省略.........
开发者ID:mcruse,项目名称:monotone,代码行数:103,代码来源:pricing.py


注:本文中的mpx.lib.node.CompositeNode.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。