mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
fix boolean comp
This commit is contained in:
parent
2652c75bda
commit
af8bddf690
@ -131,7 +131,7 @@ class InvenTreeConfig(AppConfig):
|
|||||||
update = True
|
update = True
|
||||||
|
|
||||||
# Backend currency has changed?
|
# Backend currency has changed?
|
||||||
if not base_currency == backend.base_currency:
|
if base_currency != backend.base_currency:
|
||||||
logger.info(f"Base currency changed from {backend.base_currency} to {base_currency}")
|
logger.info(f"Base currency changed from {backend.base_currency} to {base_currency}")
|
||||||
update = True
|
update = True
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ def increment(n):
|
|||||||
groups = result.groups()
|
groups = result.groups()
|
||||||
|
|
||||||
# If we cannot match the regex, then simply return the provided value
|
# If we cannot match the regex, then simply return the provided value
|
||||||
if not len(groups) == 2:
|
if len(groups) != 2:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
prefix, number = groups
|
prefix, number = groups
|
||||||
@ -536,7 +536,7 @@ def extract_serial_numbers(serials, expected_quantity, next_number: int):
|
|||||||
raise ValidationError([_("No serial numbers found")])
|
raise ValidationError([_("No serial numbers found")])
|
||||||
|
|
||||||
# The number of extracted serial numbers must match the expected quantity
|
# The number of extracted serial numbers must match the expected quantity
|
||||||
if not expected_quantity == len(numbers):
|
if expected_quantity != len(numbers):
|
||||||
raise ValidationError([_("Number of unique serial numbers ({s}) must match quantity ({q})").format(s=len(numbers), q=expected_quantity)])
|
raise ValidationError([_("Number of unique serial numbers ({s}) must match quantity ({q})").format(s=len(numbers), q=expected_quantity)])
|
||||||
|
|
||||||
return numbers
|
return numbers
|
||||||
@ -575,7 +575,7 @@ def validateFilterString(value, model=None):
|
|||||||
|
|
||||||
pair = group.split('=')
|
pair = group.split('=')
|
||||||
|
|
||||||
if not len(pair) == 2:
|
if len(pair) != 2:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
"Invalid group: {g}".format(g=group)
|
"Invalid group: {g}".format(g=group)
|
||||||
)
|
)
|
||||||
|
@ -250,7 +250,7 @@ class InvenTreeMetadata(SimpleMetadata):
|
|||||||
field_info = super().get_field_info(field)
|
field_info = super().get_field_info(field)
|
||||||
|
|
||||||
# If a default value is specified for the serializer field, add it!
|
# If a default value is specified for the serializer field, add it!
|
||||||
if 'default' not in field_info and not field.default == empty:
|
if 'default' not in field_info and field.default != empty:
|
||||||
field_info['default'] = field.get_default()
|
field_info['default'] = field.get_default()
|
||||||
|
|
||||||
# Force non-nullable fields to read as "required"
|
# Force non-nullable fields to read as "required"
|
||||||
|
@ -259,7 +259,7 @@ class InvenTreeAttachment(models.Model):
|
|||||||
new_file = os.path.abspath(new_file)
|
new_file = os.path.abspath(new_file)
|
||||||
|
|
||||||
# Check that there are no directory tricks going on...
|
# Check that there are no directory tricks going on...
|
||||||
if not os.path.dirname(new_file) == attachment_dir:
|
if os.path.dirname(new_file) != attachment_dir:
|
||||||
logger.error(f"Attempted to rename attachment outside valid directory: '{new_file}'")
|
logger.error(f"Attempted to rename attachment outside valid directory: '{new_file}'")
|
||||||
raise ValidationError(_("Invalid attachment directory"))
|
raise ValidationError(_("Invalid attachment directory"))
|
||||||
|
|
||||||
|
@ -658,7 +658,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||||||
|
|
||||||
EXTRA_URL_SCHEMES = CONFIG.get('extra_url_schemes', [])
|
EXTRA_URL_SCHEMES = CONFIG.get('extra_url_schemes', [])
|
||||||
|
|
||||||
if not type(EXTRA_URL_SCHEMES) in [list]: # pragma: no cover
|
if type(EXTRA_URL_SCHEMES) not in [list]: # pragma: no cover
|
||||||
logger.warning("extra_url_schemes not correctly formatted")
|
logger.warning("extra_url_schemes not correctly formatted")
|
||||||
EXTRA_URL_SCHEMES = []
|
EXTRA_URL_SCHEMES = []
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ def check_for_updates():
|
|||||||
|
|
||||||
response = requests.get('https://api.github.com/repos/inventree/inventree/releases/latest')
|
response = requests.get('https://api.github.com/repos/inventree/inventree/releases/latest')
|
||||||
|
|
||||||
if not response.status_code == 200:
|
if response.status_code != 200:
|
||||||
raise ValueError(f'Unexpected status code from GitHub API: {response.status_code}')
|
raise ValueError(f'Unexpected status code from GitHub API: {response.status_code}')
|
||||||
|
|
||||||
data = json.loads(response.text)
|
data = json.loads(response.text)
|
||||||
@ -216,13 +216,13 @@ def check_for_updates():
|
|||||||
|
|
||||||
match = re.match(r"^.*(\d+)\.(\d+)\.(\d+).*$", tag)
|
match = re.match(r"^.*(\d+)\.(\d+)\.(\d+).*$", tag)
|
||||||
|
|
||||||
if not len(match.groups()) == 3:
|
if len(match.groups()) != 3:
|
||||||
logger.warning(f"Version '{tag}' did not match expected pattern")
|
logger.warning(f"Version '{tag}' did not match expected pattern")
|
||||||
return
|
return
|
||||||
|
|
||||||
latest_version = [int(x) for x in match.groups()]
|
latest_version = [int(x) for x in match.groups()]
|
||||||
|
|
||||||
if not len(latest_version) == 3:
|
if len(latest_version) != 3:
|
||||||
raise ValueError(f"Version '{tag}' is not correct format")
|
raise ValueError(f"Version '{tag}' is not correct format")
|
||||||
|
|
||||||
logger.info(f"Latest InvenTree version: '{tag}'")
|
logger.info(f"Latest InvenTree version: '{tag}'")
|
||||||
|
@ -627,7 +627,7 @@ class SetPasswordView(AjaxUpdateView):
|
|||||||
if valid:
|
if valid:
|
||||||
# Passwords must match
|
# Passwords must match
|
||||||
|
|
||||||
if not p1 == p2:
|
if p1 != p2:
|
||||||
error = _('Password fields must match')
|
error = _('Password fields must match')
|
||||||
form.add_error('enter_password', error)
|
form.add_error('enter_password', error)
|
||||||
form.add_error('confirm_password', error)
|
form.add_error('confirm_password', error)
|
||||||
|
Loading…
Reference in New Issue
Block a user