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
Bug: Mail contrib: Negative indexing is not supported error #1311
Comments
This is because it is trying to index in a queryset, which does not support negative indexing. This should be handled as part of the input verification. Pinging @grungies1138 in case he wants to peek at it. |
Most likely raised because someone typed @mail 0. The table that shows the list of messages is a 1-based index, but the in-memory list is 0-based. the -1 is to allow for selection of the list item based on it's position in the list. If the user is using a 0-based attempt to pull the message, then they will not get the right message, regardless of the number they enter. Best I can do/recommend is to catch then entrance of a 0 in the input and display a message. Unless someone else has a better idea. |
Indeed to catch the input of a 0 on @mail is what I thought about - just lack the knowledge about the system to implement it. |
This might work as a technique to get it in range: once the input string is converted to a number, to make sure the value is positive and an integer: |
Maybe something like:
That way you're using the same error message. |
@grungies1138 Are you interested in resolving this? |
I fixed the contrib with more elaborate index error checking. So this should not happen any more. Closing. |
Brief summary of issue:
After having implemented the mail.py contrib module, I started to fiddle around with it and saw that after inputting @mail 1 (to check mail with id 1) it would be executed as it should be.
However, when you try a negative number, like @mail 0, it would give the Assertion Error: Negative indexing is not supported, which is generated from the django package.
Steps to reproduce the issue:
Error output
Extra information, such as Evennia revision/repo/branch, operating system and ideas for how to solve:
Happened on rev ae2c2be, but doesn't matter which revision as long as the mail.py contrib module is implemented in the system.
The text was updated successfully, but these errors were encountered: