Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions cuegui/cuegui/ServiceDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,18 @@ def save(self):
Create and emit a ServiceData object based
on the contents of the form.
"""
if len(str(self.name.text())) < 3:
service_name = str(self.name.text())
if len(service_name) < 3:
QtWidgets.QMessageBox.critical(self, "Error",
"The service name must be at least 3 characters.")
return

if not str(self.name.text()).isalnum():
# Allow alphanumeric chars and | / - _
# chars like , and . can be used as separators in other parts of the API and behave
# inconsistently
if (not service_name.isalnum()) and \
[char for char in service_name
if not char.isalnum() and char not in "|/-_"]:
QtWidgets.QMessageBox.critical(self, "Error", "The service name must alphanumeric.")
return

Expand All @@ -176,7 +182,7 @@ def save(self):
service = opencue.wrappers.service.Service()
if self.__service:
service.data.id = self.__service.data.id
service.setName(str(self.name.text()))
service.setName(service_name)
service.setThreadable(self.threadable.isChecked())
service.setMinCores(self.min_cores.value())
service.setMaxCores(self.max_cores.value())
Expand Down
Loading