Skip to content

Commit

Permalink
Using regex strings
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbyt3r committed Apr 14, 2024
1 parent 71f3d00 commit f2bb92c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sideboard/lib/sa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def check_constraint_naming_convention(constraint, table):
for operator, text in replacements:
constraint_name = constraint_name.replace(operator, text)

constraint_name = re.sub('[\\W\\s]+', '_', constraint_name)
constraint_name = re.sub(r'[\W\s]+', '_', constraint_name)
if len(constraint_name) > 32:
constraint_name = uuid.uuid5(uuid.NAMESPACE_OID, str(constraint_name)).hex
return constraint_name
Expand Down
2 changes: 1 addition & 1 deletion sideboard/tests/test_sa.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class CrudableMixin(object):
}
)
@text_length_validation('string_model_attr', 2, 100)
@regex_validation('string_model_attr', '^[A-Za-z0-9\\.\\_\\-]+$', 'test thing')
@regex_validation('string_model_attr', r'^[A-Za-z0-9\.\_\-]+$', 'test thing')
@text_length_validation('overridden_desc', 1, 100)
@text_length_validation('nonexistant_field', 1, 100)
class CrudableClass(CrudableMixin, Base):
Expand Down

0 comments on commit f2bb92c

Please sign in to comment.