def patch(self): self.getCustomerKey() if type(self.props) is list: currentPropList = [] for rec in self.props: currentFields = [] currentProp = {} for key, value in rec.items(): currentFields.append({"Name" : key, "Value" : value}) currentProp['CustomerKey'] = self.CustomerKey currentProp['Properties'] = {} currentProp['Properties']['Property'] = currentFields currentPropList.append(currentProp) currentProp = currentPropList else: currentFields = [] currentProp = {} for key, value in self.props.items(): currentFields.append({"Name" : key, "Value" : value}) currentProp['CustomerKey'] = self.CustomerKey currentProp['Properties'] = {} currentProp['Properties']['Property'] = currentFields obj = ET_Patch(self.auth_stub, self.obj_type, currentProp) return obj
def patch(self, updateadd=False): self.getCustomerKey() if type(self.props) is list: currentPropList = [] for rec in self.props: currentFields = [] currentProp = {} for key, value in rec.items(): currentFields.append({"Name": key, "Value": value}) currentProp['CustomerKey'] = self.CustomerKey currentProp['Properties'] = {} currentProp['Properties']['Property'] = currentFields currentPropList.append(currentProp) currentProp = currentPropList else: currentFields = [] currentProp = {} for key, value in self.props.items(): currentFields.append({"Name": key, "Value": value}) currentProp['CustomerKey'] = self.CustomerKey currentProp['Properties'] = {} currentProp['Properties']['Property'] = currentFields if updateadd: opt = self.auth_stub.soap_client.factory.create('SaveOption') opt.PropertyName = '*' opt.SaveAction = 'UpdateAdd' opts = self.auth_stub.soap_client.factory.create('Options') opts.SaveOptions.SaveOption = [opt] else: opts = None obj = ET_Patch(self.auth_stub, self.obj_type, currentProp, opts) return obj