mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-17 04:58:16 -06:00
Formatting cleanup
This commit is contained in:
parent
5aa5b325df
commit
dd22ebe5bc
@ -181,7 +181,11 @@ class Job(models.Model):
|
||||
"""
|
||||
valid_statuses = JobStatusChoices.TERMINAL_STATE_CHOICES
|
||||
if status not in valid_statuses:
|
||||
raise ValueError(_("Invalid status for job termination. Choices are: {choices}").format(choices=', '.join(valid_statuses)))
|
||||
raise ValueError(
|
||||
_("Invalid status for job termination. Choices are: {choices}").format(
|
||||
choices=', '.join(valid_statuses)
|
||||
)
|
||||
)
|
||||
|
||||
# Mark the job as completed
|
||||
self.status = status
|
||||
|
@ -143,7 +143,8 @@ class ConditionSet:
|
||||
logic = list(ruleset.keys())[0]
|
||||
if type(logic) is not str or logic.lower() not in (AND, OR):
|
||||
raise ValueError(_("Invalid logic type: {logic} (must be '{op_and}' or '{op_or}')").format(
|
||||
logic=logic, op_and=AND, op_or=OR))
|
||||
logic=logic, op_and=AND, op_or=OR
|
||||
))
|
||||
self.logic = logic.lower()
|
||||
|
||||
# Compile the set of Conditions
|
||||
|
@ -34,7 +34,9 @@ class WritableNestedSerializer(BaseModelSerializer):
|
||||
raise ValidationError(
|
||||
_("Related object not found using the provided attributes: {params}").format(params=params))
|
||||
except MultipleObjectsReturned:
|
||||
raise ValidationError(_("Multiple objects match the provided attributes: {params}").format(params=params))
|
||||
raise ValidationError(
|
||||
_("Multiple objects match the provided attributes: {params}").format(params=params)
|
||||
)
|
||||
except FieldError as e:
|
||||
raise ValidationError(e)
|
||||
|
||||
@ -44,7 +46,10 @@ class WritableNestedSerializer(BaseModelSerializer):
|
||||
pk = int(data)
|
||||
except (TypeError, ValueError):
|
||||
raise ValidationError(
|
||||
_("Related objects must be referenced by numeric ID or by dictionary of attributes. Received an unrecognized value: {value}").format(value=data)
|
||||
_(
|
||||
"Related objects must be referenced by numeric ID or by dictionary of attributes. Received an "
|
||||
"unrecognized value: {value}"
|
||||
).format(value=data)
|
||||
)
|
||||
|
||||
# Look up object by PK
|
||||
|
@ -238,7 +238,7 @@ def parse_csv(reader):
|
||||
if len(row) != len(headers):
|
||||
raise forms.ValidationError(
|
||||
_("Row {i}: Expected {count_expected} columns but found {count_found}").format(
|
||||
count_expected=len(headers), len_row=len(count_found)
|
||||
count_expected=len(headers), count_found=len(row)
|
||||
)
|
||||
)
|
||||
row = [col.strip() for col in row]
|
||||
|
@ -95,8 +95,8 @@ class ObjectPermissionRequiredMixin(AccessMixin):
|
||||
if not hasattr(self, 'queryset'):
|
||||
raise ImproperlyConfigured(
|
||||
_(
|
||||
'{class_name} has no queryset defined. ObjectPermissionRequiredMixin may only be used on views which '
|
||||
'define a base queryset'
|
||||
'{class_name} has no queryset defined. ObjectPermissionRequiredMixin may only be used on views '
|
||||
'which define a base queryset'
|
||||
).format(class_name=self.__class__.__name__)
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user