Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In otrs/objects.py, assumptions made by "autocast" are error-prone (for values with a leading zero) #48

Open
vincentborghi opened this issue Apr 19, 2021 · 1 comment

Comments

@vincentborghi
Copy link

In my use case, I have a dynamic field "SR Number" which stores some external ticket number. The fact is that those ticket numbers are made of digits only and may begin with "0" (zero), like e.g. "01234567".
When I search for tickets whose dynamic field "SR Number" is e.g. "01234567", this fails, because autocast changes the string value "01234567" to the "1234567" int, while I need it just stays as it is (the string "01234567").

I was obliged to modify the autocast function (in otrs/objects.py) by adding the 2 following lines just before the "try" statement:
if s.startswith("0"):
return s

@ewsterrenburg
Copy link
Owner

Agreed that the current version is "too greedy", yet couldn't come to a simple fix yet that's doing the right thing in both Python 2 & Python 3 (your workaround doesn't work when the ticket numbers involved are actually integers).

Will think about it and look at this as well when scrapping out Python 2 compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants