mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-11 05:17:55 +03:00
Merge remote-tracking branch 'origin/v3.6'
This commit is contained in:
commit
42d22bd6b7
@ -30,6 +30,7 @@
|
||||
"""
|
||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
"""
|
||||
import re
|
||||
import logging
|
||||
import typing
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
'''
|
||||
@itemor: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
'''
|
||||
import re
|
||||
import logging
|
||||
import typing
|
||||
|
||||
@ -174,7 +175,12 @@ class Transports(ModelHandler):
|
||||
def beforeSave(self, fields: typing.Dict[str, typing.Any]) -> None:
|
||||
fields['allowed_oss'] = ','.join(fields['allowed_oss'])
|
||||
# If label has spaces, replace them with underscores
|
||||
fields['label'] = fields['label'].strip().replace(' ', '_')
|
||||
fields['label'] = fields['label'].strip().replace(' ', '-')
|
||||
# And ensure small_name chars are valid [ a-zA-Z0-9:-]+
|
||||
if not re.match(r'^[a-zA-Z0-9:-]+$', fields['label']):
|
||||
raise self.invalidRequestException(
|
||||
_('Label must contain only letters, numbers, ":" and "-"')
|
||||
)
|
||||
|
||||
def afterSave(self, item: Transport) -> None:
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user