Bug: Mail contrib: Negative indexing is not supported error
See original GitHub issueBrief 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
Traceback (most recent call last):
File "c:\mud\evennia\evennia\commands\cmdhandler.py", line 509, in _run_command
ret = yield cmd.func()
File ".\commands\mail.py", line 214, in func
message = self.get_all_mail()[int(self.lhs) - 1]
File "c:\mud\pyenv\Lib\site-packages\django\db\models\query.py", line 277, in __getitem__
"Negative indexing is not supported."
AssertionError: Negative indexing is not supported.
Extra information, such as Evennia revision/repo/branch, operating system and ideas for how to solve:
Happened on rev ae2c2be8, but doesn’t matter which revision as long as the mail.py contrib module is implemented in the system.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
django - AssertionError: Negative indexing is not supported
This will happen mostly when you are trying some indexing related operation on an empty list. Try this instead:
Read more >Negative indexing is not supported. - Google Groups
It's an issue with django-mptt breaking their API in 0.5.0 and 0.5.2 (0.5.1 works). children should NOT be a queryset (it wasn't pre-0.5.0)...
Read more >#13089 (Support Negative Indexing on QuerySets) – Django
In short: querysets are not == lists. The problem with saying the python negative indexing idiom should be supported is that negative indexing...
Read more >Considerations in adopting RHEL 8 Red Hat Enterprise Linux 8
Negative effects of the default logging setup on performance ... The e1000 network driver is not supported in RHEL 8; 11.1.3.4. ... Click...
Read more >4. Release Notes — Buildbot 2.3.1 documentation
Notably, Internet Explorer 11 is not supported in this release. ... Fix encoding issues with Forcescheduler parameters error management code.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub 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.
I fixed the contrib with more elaborate index error checking. So this should not happen any more. Closing.