def initialize(self, values): """ We check here form values to see if they are valid. Note that we check them throught FROM variables, that already has been initialized by __init__ method of base class, before invoking this. """ if values is not None: length = int(self.lenName.value) if len(self.baseName.value) + length > 15: raise Service.ValidationException(_('The length of basename plus length must not be greater than 15')) if self.baseName.value.isdigit(): raise Service.ValidationException(_('The machine name can\'t be only numbers'))
def initialize(self, values: 'Module.ValuesType') -> None: if values: self.baseName.value = validators.validateHostname( self.baseName.value, 15, asPattern=True) if int(self.memory.value) < 128: raise Service.ValidationException( _('The minimum allowed memory is 128 Mb'))
def initialize(self, values): """ We check here form values to see if they are valid. Note that we check them throught FROM variables, that already has been initialized by __init__ method of base class, before invoking this. """ if values: tools.checkValidBasename(self.baseName.value, self.lenName.num()) if int(self.memory.value) < 256: raise Service.ValidationException( _('The minimum allowed memory is 256 Mb'))
def initialize(self, values): ''' We check here form values to see if they are valid. Note that we check them throught FROM variables, that already has been initialized by __init__ method of base class, before invoking this. ''' if values is not None: length = int(self.lenName.value) if len(self.baseName.value) + length > 15: raise Service.ValidationException( _('The length of basename plus length must not be greater than 15' )) if self.baseName.value.isdigit(): raise Service.ValidationException( _('The machine name can\'t be only numbers')) if int(self.memory.value) < 256 or int( self.memoryGuaranteed.value) < 256: raise Service.ValidationException( _('The minimum allowed memory is 256 Mb')) if int(self.memoryGuaranteed.value) > int(self.memory.value): self.memoryGuaranteed.value = self.memory.value
def initialize(self, values): ''' We check here form values to see if they are valid. Note that we check them throught FROM variables, that already has been initialized by __init__ method of base class, before invoking this. ''' # We don't need to check anything, bat because this is a sample, we do # As in provider, we receive values only at new Service creation, # so we only need to validate params if values is not None if values is not None: if self.colour.value == 'nonsense': raise Service.ValidationException( 'The selected colour is invalid!!!')