diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-10-08 08:38:33 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-10-08 08:38:33 +0000 |
| commit | 44f228fd61e5f45dbdfa465291319dfd5dd66393 (patch) | |
| tree | 011d815e54bd9268b4af22a415175a507de65ec2 /tests | |
| parent | 268ef594ace36e82043b2f9b6eaa18531cd24b2f (diff) | |
Fixed #6748 -- When printing the repr() of querysets, don't load or display
more than 20 objects.
This means that accidentally executing HugeStoryArchive.objects.all() at the
interactive prompt (or in the debug template) won't try to load all 4,233,010
stories into memory and print them out. That would previously cause resource
starvation and other "interesting" crashes.
If you really, really want the previous behaviour (e.g. in a doctest that
prints more than 20 items), display "list(qs)" instead of just "qs".
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9202 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/queries/models.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py index e5d17c0aaf..12822c6f7a 100644 --- a/tests/regressiontests/queries/models.py +++ b/tests/regressiontests/queries/models.py @@ -556,7 +556,7 @@ Bug #2076 # automatically. Item normally requires a join with Note to do the default # ordering, but that isn't needed here. >>> qs = Item.objects.order_by('name') ->>> qs +>>> list(qs) [<Item: four>, <Item: one>, <Item: three>, <Item: two>] >>> len(qs.query.tables) 1 |
