mirror of
https://github.com/retspen/webvirtcloud.git
synced 2026-05-30 00:49:37 +00:00
format python code with black
This commit is contained in:
@@ -3,9 +3,9 @@ import re
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
have_symbol = re.compile('[^a-zA-Z0-9._-]+')
|
||||
wrong_ip = re.compile('^0.|^255.')
|
||||
wrong_name = re.compile('[^a-zA-Z0-9._-]+')
|
||||
have_symbol = re.compile("[^a-zA-Z0-9._-]+")
|
||||
wrong_ip = re.compile("^0.|^255.")
|
||||
wrong_name = re.compile("[^a-zA-Z0-9._-]+")
|
||||
|
||||
|
||||
def validate_hostname(value):
|
||||
@@ -13,12 +13,14 @@ def validate_hostname(value):
|
||||
wip = wrong_ip.match(value)
|
||||
|
||||
if sym:
|
||||
raise ValidationError(_('Hostname must contain only numbers, or the domain name separated by "."'))
|
||||
raise ValidationError(
|
||||
_('Hostname must contain only numbers, or the domain name separated by "."')
|
||||
)
|
||||
elif wip:
|
||||
raise ValidationError(_('Wrong IP address'))
|
||||
raise ValidationError(_("Wrong IP address"))
|
||||
|
||||
|
||||
def validate_name(value):
|
||||
have_symbol = wrong_name.match('[^a-zA-Z0-9._-]+')
|
||||
have_symbol = wrong_name.match("[^a-zA-Z0-9._-]+")
|
||||
if have_symbol:
|
||||
raise ValidationError(_('The hostname must not contain any special characters'))
|
||||
raise ValidationError(_("The hostname must not contain any special characters"))
|
||||
|
||||
Reference in New Issue
Block a user