Django

Code

Changeset 7944

Show
Ignore:
Timestamp:
07/17/08 15:12:21 (4 months ago)
Author:
brosner
Message:

newforms-admin: Merged from trunk up to [7941].

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/newforms-admin

    • Property svnmerge-integrated changed from /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-7936 to /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6390,6392-7943
  • django/branches/newforms-admin/django/db/models/query.py

    r7922 r7944  
    281281        integer. 
    282282 
    283         If the QuerySet is already cached (i.e. self._result_cache is set) this 
    284         simply returns the length of the cached results set to avoid multiple 
    285         SELECT COUNT(*) calls. 
    286         """ 
    287         if self._result_cache is not None: 
     283        If the QuerySet is already fully cached this simply returns the length 
     284        of the cached results set to avoid multiple SELECT COUNT(*) calls. 
     285        """ 
     286        if self._result_cache is not None and not self._iter: 
    288287            return len(self._result_cache) 
    289288 
  • django/branches/newforms-admin/django/test/utils.py

    r6955 r7944  
    7575    "Make sure a connection is in autocommit mode." 
    7676    if hasattr(connection.connection, "autocommit"): 
    77         connection.connection.autocommit(True) 
     77        if callable(connection.connection.autocommit): 
     78            connection.connection.autocommit(True) 
     79        else: 
     80            connection.connection.autocommit = True 
    7881    elif hasattr(connection.connection, "set_isolation_level"): 
    7982        connection.connection.set_isolation_level(0) 
  • django/branches/newforms-admin/tests/regressiontests/admin_scripts/tests.py

    r7922 r7944  
    109109    def assertOutput(self, stream, msg): 
    110110        "Utility assertion: assert that the given message exists in the output" 
    111         self.assertTrue(msg in stream, "'%s' does not match actual output text '%s'" % (msg, stream)) 
     111        self.failUnless(msg in stream, "'%s' does not match actual output text '%s'" % (msg, stream)) 
    112112 
    113113########################################################################## 
  • django/branches/newforms-admin/tests/regressiontests/queries/models.py

    r7937 r7944  
    55import datetime 
    66import pickle 
     7import sys 
    78 
    89from django.db import models 
     
    483484>>> Cover.objects.all() 
    484485[<Cover: first>, <Cover: second>] 
    485  
    486 # If you're not careful, it's possible to introduce infinite loops via default 
    487 # ordering on foreign keys in a cycle. We detect that. 
    488 >>> LoopX.objects.all() 
    489 Traceback (most recent call last): 
    490 ... 
    491 FieldError: Infinite loop caused by ordering. 
    492  
    493 >>> LoopZ.objects.all() 
    494 Traceback (most recent call last): 
    495 ... 
    496 FieldError: Infinite loop caused by ordering. 
    497  
    498 # ... but you can still order in a non-recursive fashion amongst linked fields 
    499 # (the previous test failed because the default ordering was recursive). 
    500 >>> LoopX.objects.all().order_by('y__x__y__x__id') 
    501 [] 
    502486 
    503487# If the remote model does not have a default ordering, we order by its 'id' 
     
    831815...     if i > 10: break 
    832816 
     817Bug #7759 -- count should work with a partially read result set. 
     818>>> count = Number.objects.count() 
     819>>> qs = Number.objects.all() 
     820>>> for obj in qs: 
     821...     qs.count() == count 
     822...     break 
     823True 
     824 
    833825"""} 
    834826 
     827# In Python 2.3, exceptions raised in __len__ are swallowed (Python issue 
     828# 1242657), so these cases return an empty list, rather than raising an 
     829# exception. Not a lot we can do about that, unfortunately, due to the way 
     830# Python handles list() calls internally. Thus, we skip the tests for Python 
     831# 2.3. 
     832if sys.version_info >= (2, 4): 
     833    __test__["API_TESTS"] += """ 
     834# If you're not careful, it's possible to introduce infinite loops via default 
     835# ordering on foreign keys in a cycle. We detect that. 
     836>>> LoopX.objects.all() 
     837Traceback (most recent call last): 
     838... 
     839FieldError: Infinite loop caused by ordering. 
     840 
     841>>> LoopZ.objects.all() 
     842Traceback (most recent call last): 
     843... 
     844FieldError: Infinite loop caused by ordering. 
     845 
     846# ... but you can still order in a non-recursive fashion amongst linked fields 
     847# (the previous test failed because the default ordering was recursive). 
     848>>> LoopX.objects.all().order_by('y__x__y__x__id') 
     849[] 
     850"""