Permalink
Browse files

queryset-refactor: Fixed some Python 2.3 problems.

git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6756 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent bef4ca2 commit 648a3d87a331674b3e566d8e47ea5ae8422437aa @malcolmt malcolmt committed Nov 29, 2007
Showing with 9 additions and 7 deletions.
  1. +1 −1 django/contrib/formtools/preview.py
  2. +6 −5 django/db/models/options.py
  3. +2 −1 django/db/models/query.py
@@ -109,7 +109,7 @@ def security_hash(self, request, form):
data = [(bf.name, bf.data) for bf in form] + [settings.SECRET_KEY]
# Use HIGHEST_PROTOCOL because it's the most efficient. It requires
# Python 2.3, but Django requires 2.3 anyway, so that's OK.
- pickled = pickle.dumps(data, protocol=pickle.HIGHEST_PROTOCOL)
+ pickled = pickle.dumps(data, pickle.HIGHEST_PROTOCOL)
return md5.new(pickled).hexdigest()
def failed_hash(self, request):
@@ -173,11 +173,12 @@ def init_name_map(self):
Initialises the field name -> field object mapping.
"""
cache = dict([(f.name, (f, True, False)) for f in self.fields])
- cache.update([(f.name, (f, True, True)) for f in self.many_to_many])
- cache.update([(f.field.related_query_name(), (f, False, True))
- for f in self.get_all_related_many_to_many_objects()])
- cache.update([(f.field.related_query_name(), (f, False, False))
- for f in self.get_all_related_objects()])
+ for f in self.many_to_many:
+ cache[f.name] = (f, True, True)
+ for f in self.get_all_related_many_to_many_objects():
+ cache[f.field.related_query_name()] = (f, False, True)
+ for f in self.get_all_related_objects():
+ cache[f.field.related_query_name()] = (f, False, False)
if app_cache_ready():
self._name_map = cache
return cache
@@ -395,7 +395,8 @@ def _setup_query(self):
if self._fields:
opts = self.model._meta
all = dict([(field.column, field) for field in opts.fields])
- all.update([(field.name, field) for field in opts.fields])
+ for field in opts.fields:
+ all[field.name] = field
if not self.query.extra_select:
try:
fields = [all[f] for f in self._fields]

0 comments on commit 648a3d8

Please sign in to comment.