示例#1
0
文件: models.py 项目: pnhowe/MCP
    def clean(self, *args, **kwargs):
        super().clean(*args, **kwargs)
        self.key = '{0}_{1}'.format(self.project.name, self.name)

        errors = {}

        if not name_regex.match(self.name):
            errors['name'] = 'Invalid'

        for name in self.network_map.keys():
            if not name_regex.match(name):
                errors['network_map'] = 'Invalid network name "{0}"'.format(
                    name)

        if errors:
            raise ValidationError(errors)
示例#2
0
    def clean(self, *args, **kwargs):
        super().clean(*args, **kwargs)
        errors = {}

        if not name_regex.match(self.name):
            errors['name'] = 'Invalid'

        if errors:
            raise ValidationError(errors)
示例#3
0
文件: models.py 项目: pnhowe/MCP
  def clean( self, *args, **kwargs ):
    super().clean( *args, **kwargs )
    errors = {}

    if not name_regex.match( self.name ):  # should we also ping contractor?
      errors[ 'name' ] = 'Invalid'

    if errors:
      raise ValidationError( errors )
示例#4
0
    def clean(self, *args, **kwargs):
        super().clean(*args, **kwargs)
        self.key = '{0}_{1}'.format(self.project.name, self.name)

        errors = {}

        if not name_regex.match(self.name):
            errors['name'] = 'Invalid'

        if errors:
            raise ValidationError(errors)
示例#5
0
文件: models.py 项目: pnhowe/MCP
    def clean(self, *args, **kwargs):
        super().clean(*args, **kwargs)

        if not self.local_path:
            self.local_path = None

        errors = {}

        if self.name != '_builtin_' and not name_regex.match(self.name):
            errors['name'] = 'Invalid'

        if errors:
            raise ValidationError(errors)