def buildDataSource(self): '''build datasource class objects''' #log.debug("%s Building DataSource: %s %s" % (8*'#',self.datasourceClass,8*'#')) construct = Prototype(self.zenpackroot, self.zenpackbase, self.indent) #for d in self.dsdata: #if d.isMethod == True: # print "removing %s from %s" % (d.id, self.datasourceClass) # self.dsdata.remove(d) construct.addDataSource(self.datasourceClass, self.dsdata) construct.is_datasource = True construct.classdata['class'].update({ 'ZENPACKID': self.zenpackname, 'DATASOURCE' : '%s'% self.d.component, 'sourcetypes' : (self.d.component,), 'sourcetype' : self.d.component, 'component' : '${here/%s}' % self.d.componentData['displayed'], 'cmdFile' : self.d.cmdFile, 'dpoints' : self.d.datapoints, }) construct.getHelper() for m in self.d.datasourceMethods: setattr(construct.helper.classobject, m.__name__, m) for x in self.d.ignoreKeys: construct.helper.classobject.ignoreKeys.append(x) self.packs[self.zenpackname]['constructs'][self.definition]['datasource'] = construct self.packs[self.zenpackname]['builder'].helpers[self.d.component]['datasource'] = construct
def buildDataSource(self): '''build datasource class objects''' #log.debug("%s Building DataSource: %s %s" % (8*'#',self.datasourceClass,8*'#')) construct = Prototype(self.zenpackroot, self.zenpackbase, self.indent) construct.addDataSource(self.datasourceClass, self.dsdata) construct.is_datasource = True construct.classdata['class'].update({ 'ZENPACKID': self.zenpackname, 'DATASOURCE' : '%s'% self.d.component, 'sourcetypes' : (self.d.component,), 'sourcetype' : self.d.component, 'component' : '${here/%s}' % self.d.componentData['displayed'], 'cmdFile' : self.d.cmdFile, 'dpoints' : self.d.datapoints, }) # start a new helper to build the class construct.getHelper() # append any overridden methods for m in self.d.datasourceMethods: setattr(construct.helper.classobject, m.__name__, m) # update any properties that should be ignored by getCommand for x in self.d.ignoreKeys: construct.helper.classobject.ignoreKeys.append(x) # update local packs data self.packs[self.zenpackname]['constructs'][self.definition]['datasource'] = construct self.packs[self.zenpackname]['builder'].helpers[self.d.component]['datasource'] = construct