Issue with validators.py
Issue #48
resolved
obj_id having multiple variables types of unicode or int. I have done some testing and if you replace the following function at line 31 with this it should work:
def check_duplicate(self, value, obj_id):
comparer = {self.attribute_to_compare: value}
result = self.object_class.get_filter_by(**comparer).first()
if type(obj_id) is int:
obj_id = str(obj_id)
if result is None:
return true
elif obj_id.isdigit() and result.id == int(obj_id):
return True
else:
return False
Comments (4)
-
-
reporter - edited description
-
reporter - edited description
-
repo owner - changed status to resolved
Thanks, merged your fix!
- Log in to comment
For this issue, it caused an Error 500 whenever we clicked "submit" on the edit Case page.
Our workaround was (starting from line 31 in foreman/forms/validators.py):