mirror of
https://github.com/django/django.git
synced 2025-07-05 02:09:13 +00:00
[soc2009/multidb] Change a conditional to be more idiomatic.
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/multidb@11421 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5fe110e149
commit
50ad53dbca
@ -14,6 +14,11 @@ from django.test.client import Client
|
||||
from django.utils import simplejson
|
||||
from django.utils.encoding import smart_str
|
||||
|
||||
try:
|
||||
all
|
||||
except NameError:
|
||||
from django.utils.itercompat import all
|
||||
|
||||
normalize_long_ints = lambda s: re.sub(r'(?<![\w])(\d+)L(?![\w])', '\\1', s)
|
||||
normalize_decimals = lambda s: re.sub(r"Decimal\('(\d+(\.\d*)?)'\)", lambda m: "Decimal(\"%s\")" % m.groups()[0], s)
|
||||
|
||||
@ -433,7 +438,8 @@ def connections_support_transactions():
|
||||
Returns True if all connections support transactions. This is messy
|
||||
because 2.4 doesn't support any or all.
|
||||
"""
|
||||
return len([None for conn in connections.all() if conn.settings_dict['DATABASE_SUPPORTS_TRANSACTIONS']]) == len(connections.all())
|
||||
return all(conn.settings_dict['DATABASE_SUPPORTS_TRANSACTIONS']
|
||||
for conn in connections.all())
|
||||
|
||||
class TestCase(TransactionTestCase):
|
||||
"""
|
||||
|
@ -73,3 +73,8 @@ def sorted(in_value):
|
||||
out_value.sort()
|
||||
return out_value
|
||||
|
||||
def all(iterable):
|
||||
for item in iterable:
|
||||
if not item:
|
||||
return False
|
||||
return True
|
||||
|
Loading…
x
Reference in New Issue
Block a user