mirror of
https://github.com/django/django.git
synced 2025-10-29 19:17:24 +00:00
Fixed #4040 -- Changed uses of has_key() to "in". Slight performance
improvement and forward-compatible with future Python releases. Patch from Gary Wilson. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
6c02565e4f
commit
439cb4047f
37 changed files with 112 additions and 92 deletions
|
|
@ -97,7 +97,7 @@ def javascript_catalog(request, domain='djangojs', packages=None):
|
|||
deliver your JavaScript source from Django templates.
|
||||
"""
|
||||
if request.GET:
|
||||
if request.GET.has_key('language'):
|
||||
if 'language' in request.GET:
|
||||
if check_for_language(request.GET['language']):
|
||||
activate(request.GET['language'])
|
||||
if packages is None:
|
||||
|
|
@ -136,7 +136,7 @@ def javascript_catalog(request, domain='djangojs', packages=None):
|
|||
t.update(catalog._catalog)
|
||||
src = [LibHead]
|
||||
plural = None
|
||||
if t.has_key(''):
|
||||
if '' in t:
|
||||
for l in t[''].split('\n'):
|
||||
if l.startswith('Plural-Forms:'):
|
||||
plural = l.split(':',1)[1].strip()
|
||||
|
|
@ -155,7 +155,7 @@ def javascript_catalog(request, domain='djangojs', packages=None):
|
|||
if type(k) in (str, unicode):
|
||||
csrc.append("catalog['%s'] = '%s';\n" % (javascript_quote(k), javascript_quote(v)))
|
||||
elif type(k) == tuple:
|
||||
if not pdict.has_key(k[0]):
|
||||
if k[0] not in pdict:
|
||||
pdict[k[0]] = k[1]
|
||||
else:
|
||||
pdict[k[0]] = max(k[1], pdict[k[0]])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue