Rename label

This commit is contained in:
shekhar-cis 2022-07-04 13:25:19 +05:30
parent 3ff897395f
commit 8a6c40b4dc
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7

View File

@ -10,31 +10,31 @@ class AddressGenerator:
@staticmethod @staticmethod
def start_address_generation( def start_address_generation(
entered_label, streamNumberForAddress=1, eighteenByteRipe=False, label, streamNumberForAddress=1, eighteenByteRipe=False,
nonceTrialsPerByte=1000, payloadLengthExtraBytes=1000 nonceTrialsPerByte=1000, payloadLengthExtraBytes=1000
): ):
""""Return True if the label is unique""" """"Return True if the label is unique"""
labels = [BMConfigParser().get(obj, 'label') labels = [BMConfigParser().get(obj, 'label')
for obj in BMConfigParser().addresses()] for obj in BMConfigParser().addresses()]
if entered_label and entered_label not in labels: if label and label not in labels:
queues.addressGeneratorQueue.put(( queues.addressGeneratorQueue.put((
'createRandomAddress', 4, streamNumberForAddress, entered_label, 1, 'createRandomAddress', 4, streamNumberForAddress, label, 1,
"", eighteenByteRipe, nonceTrialsPerByte, "", eighteenByteRipe, nonceTrialsPerByte,
payloadLengthExtraBytes)) payloadLengthExtraBytes))
return True return True
return False return False
@staticmethod @staticmethod
def address_validation(instance, entered_label): def address_validation(instance, label):
"""Checking address validation while creating""" """Checking address validation while creating"""
labels = [BMConfigParser().get(obj, 'label') labels = [BMConfigParser().get(obj, 'label')
for obj in BMConfigParser().addresses()] for obj in BMConfigParser().addresses()]
if entered_label in labels: if label in labels:
instance.error = True instance.error = True
instance.helper_text = 'it is already exist you'\ instance.helper_text = 'it is already exist you'\
' can try this Ex. ( {0}_1, {0}_2 )'.format( ' can try this Ex. ( {0}_1, {0}_2 )'.format(
entered_label) label)
elif entered_label: elif label:
instance.error = False instance.error = False
else: else:
instance.error = False instance.error = False