Changeset 5091
- Timestamp:
- 04/26/07 08:30:48 (1 year ago)
- Files:
-
- django/trunk/django/bin/profiling/gather_profile_stats.py (modified) (1 diff)
- django/trunk/django/contrib/admin/templatetags/admin_modify.py (modified) (1 diff)
- django/trunk/django/contrib/admin/views/auth.py (modified) (3 diffs)
- django/trunk/django/contrib/admin/views/decorators.py (modified) (4 diffs)
- django/trunk/django/contrib/admin/views/main.py (modified) (10 diffs)
- django/trunk/django/contrib/comments/templatetags/comments.py (modified) (1 diff)
- django/trunk/django/contrib/comments/views/comments.py (modified) (5 diffs)
- django/trunk/django/contrib/sitemaps/views.py (modified) (1 diff)
- django/trunk/django/core/cache/backends/simple.py (modified) (1 diff)
- django/trunk/django/core/handlers/modpython.py (modified) (1 diff)
- django/trunk/django/core/handlers/wsgi.py (modified) (1 diff)
- django/trunk/django/core/management.py (modified) (3 diffs)
- django/trunk/django/core/servers/basehttp.py (modified) (3 diffs)
- django/trunk/django/core/validators.py (modified) (3 diffs)
- django/trunk/django/db/backends/mysql_old/base.py (modified) (1 diff)
- django/trunk/django/db/backends/postgresql/base.py (modified) (1 diff)
- django/trunk/django/db/backends/util.py (modified) (1 diff)
- django/trunk/django/db/models/fields/generic.py (modified) (1 diff)
- django/trunk/django/db/models/fields/__init__.py (modified) (1 diff)
- django/trunk/django/db/models/fields/related.py (modified) (2 diffs)
- django/trunk/django/db/models/loading.py (modified) (1 diff)
- django/trunk/django/db/models/options.py (modified) (2 diffs)
- django/trunk/django/db/transaction.py (modified) (5 diffs)
- django/trunk/django/http/__init__.py (modified) (3 diffs)
- django/trunk/django/middleware/common.py (modified) (1 diff)
- django/trunk/django/newforms/forms.py (modified) (1 diff)
- django/trunk/django/newforms/widgets.py (modified) (2 diffs)
- django/trunk/django/oldforms/__init__.py (modified) (1 diff)
- django/trunk/django/template/context.py (modified) (3 diffs)
- django/trunk/django/template/defaulttags.py (modified) (4 diffs)
- django/trunk/django/template/__init__.py (modified) (1 diff)
- django/trunk/django/utils/datastructures.py (modified) (1 diff)
- django/trunk/django/utils/functional.py (modified) (1 diff)
- django/trunk/django/utils/translation/trans_real.py (modified) (1 diff)
- django/trunk/django/views/i18n.py (modified) (3 diffs)
- django/trunk/tests/regressiontests/dispatch/tests/test_saferef.py (modified) (1 diff)
- django/trunk/tests/regressiontests/httpwrappers/tests.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/bin/profiling/gather_profile_stats.py
r4265 r5091 23 23 continue 24 24 print "Processing %s" % f 25 if p rofiles.has_key(path):25 if path in profiles: 26 26 profiles[path].add(prof) 27 27 else: django/trunk/django/contrib/admin/templatetags/admin_modify.py
r4692 r5091 75 75 76 76 def get_nodelist(cls, klass): 77 if not cls.nodelists.has_key(klass):77 if klass not in cls.nodelists: 78 78 try: 79 79 field_class_name = klass.__name__ django/trunk/django/contrib/admin/views/auth.py
r4486 r5091 18 18 new_user = manipulator.save(new_data) 19 19 msg = _('The %(name)s "%(obj)s" was added successfully.') % {'name': 'user', 'obj': new_user} 20 if request.POST.has_key("_addanother"):20 if "_addanother" in request.POST: 21 21 request.user.message_set.create(message=msg) 22 22 return HttpResponseRedirect(request.path) … … 30 30 'title': _('Add user'), 31 31 'form': form, 32 'is_popup': request.REQUEST.has_key('_popup'),32 'is_popup': '_popup' in request.REQUEST, 33 33 'add': True, 34 34 'change': False, … … 64 64 'title': _('Change password: %s') % escape(user.username), 65 65 'form': form, 66 'is_popup': request.REQUEST.has_key('_popup'),66 'is_popup': '_popup' in request.REQUEST, 67 67 'add': True, 68 68 'change': False, django/trunk/django/contrib/admin/views/decorators.py
r5074 r5091 13 13 def _display_login_form(request, error_message=''): 14 14 request.session.set_test_cookie() 15 if request.POST and request.POST.has_key('post_data'):15 if request.POST and 'post_data' in request.POST: 16 16 # User has failed login BUT has previously saved post data. 17 17 post_data = request.POST['post_data'] … … 49 49 if request.user.is_authenticated() and request.user.is_staff: 50 50 # The user is valid. Continue to the admin page. 51 if request.POST.has_key('post_data'):51 if 'post_data' in request.POST: 52 52 # User must have re-authenticated through a different window 53 53 # or tab. … … 58 58 59 59 # If this isn't already the login page, display it. 60 if not request.POST.has_key(LOGIN_FORM_KEY):60 if LOGIN_FORM_KEY not in request.POST: 61 61 if request.POST: 62 62 message = _("Please log in again, because your session has expired. Don't worry: Your submission has been saved.") … … 91 91 login(request, user) 92 92 # TODO: set last_login with an event. 93 if request.POST.has_key('post_data'):93 if 'post_data' in request.POST: 94 94 post_data = _decode_post_data(request.POST['post_data']) 95 if post_data and not post_data.has_key(LOGIN_FORM_KEY):95 if post_data and LOGIN_FORM_KEY not in post_data: 96 96 # overwrite request.POST with the saved post_data, and continue 97 97 request.POST = post_data django/trunk/django/contrib/admin/views/main.py
r4616 r5091 258 258 # Here, we distinguish between different save types by checking for 259 259 # the presence of keys in request.POST. 260 if request.POST.has_key("_continue"):260 if "_continue" in request.POST: 261 261 request.user.message_set.create(message=msg + ' ' + _("You may edit it again below.")) 262 if request.POST.has_key("_popup"):262 if "_popup" in request.POST: 263 263 post_url_continue += "?_popup=1" 264 264 return HttpResponseRedirect(post_url_continue % pk_value) 265 if request.POST.has_key("_popup"):265 if "_popup" in request.POST: 266 266 if type(pk_value) is str: # Quote if string, so JavaScript doesn't think it's a variable. 267 267 pk_value = '"%s"' % pk_value.replace('"', '\\"') 268 268 return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, %s, "%s");</script>' % \ 269 269 (pk_value, str(new_object).replace('"', '\\"'))) 270 elif request.POST.has_key("_addanother"):270 elif "_addanother" in request.POST: 271 271 request.user.message_set.create(message=msg + ' ' + (_("You may add another %s below.") % opts.verbose_name)) 272 272 return HttpResponseRedirect(request.path) … … 289 289 'title': _('Add %s') % opts.verbose_name, 290 290 'form': form, 291 'is_popup': request.REQUEST.has_key('_popup'),291 'is_popup': '_popup' in request.REQUEST, 292 292 'show_delete': show_delete, 293 293 }) … … 309 309 raise PermissionDenied 310 310 311 if request.POST and request.POST.has_key("_saveasnew"):311 if request.POST and "_saveasnew" in request.POST: 312 312 return add_stage(request, app_label, model_name, form_url='../../add/') 313 313 … … 344 344 345 345 msg = _('The %(name)s "%(obj)s" was changed successfully.') % {'name': opts.verbose_name, 'obj': new_object} 346 if request.POST.has_key("_continue"):346 if "_continue" in request.POST: 347 347 request.user.message_set.create(message=msg + ' ' + _("You may edit it again below.")) 348 if request.REQUEST.has_key('_popup'):348 if '_popup' in request.REQUEST: 349 349 return HttpResponseRedirect(request.path + "?_popup=1") 350 350 else: 351 351 return HttpResponseRedirect(request.path) 352 elif request.POST.has_key("_saveasnew"):352 elif "_saveasnew" in request.POST: 353 353 request.user.message_set.create(message=_('The %(name)s "%(obj)s" was added successfully. You may edit it again below.') % {'name': opts.verbose_name, 'obj': new_object}) 354 354 return HttpResponseRedirect("../%s/" % pk_value) 355 elif request.POST.has_key("_addanother"):355 elif "_addanother" in request.POST: 356 356 request.user.message_set.create(message=msg + ' ' + (_("You may add another %s below.") % opts.verbose_name)) 357 357 return HttpResponseRedirect("../add/") … … 393 393 'object_id': object_id, 394 394 'original': manipulator.original_object, 395 'is_popup': request.REQUEST.has_key('_popup'),395 'is_popup': '_popup' in request.REQUEST, 396 396 }) 397 397 return render_change_form(model, manipulator, c, change=True) … … 559 559 except ValueError: 560 560 self.page_num = 0 561 self.show_all = request.GET.has_key(ALL_VAR)562 self.is_popup = request.GET.has_key(IS_POPUP_VAR)561 self.show_all = ALL_VAR in request.GET 562 self.is_popup = IS_POPUP_VAR in request.GET 563 563 self.params = dict(request.GET.items()) 564 if self.params.has_key(PAGE_VAR):564 if PAGE_VAR in self.params: 565 565 del self.params[PAGE_VAR] 566 if self.params.has_key(ERROR_FLAG):566 if ERROR_FLAG in self.params: 567 567 del self.params[ERROR_FLAG] 568 568 … … 595 595 del p[k] 596 596 for k, v in new_params.items(): 597 if p.has_key(k)and v is None:597 if k in p and v is None: 598 598 del p[k] 599 599 elif v is not None: … … 657 657 else: 658 658 order_field, order_type = ordering[0], 'asc' 659 if params.has_key(ORDER_VAR):659 if ORDER_VAR in params: 660 660 try: 661 661 field_name = lookup_opts.admin.list_display[int(params[ORDER_VAR])] … … 675 675 except (IndexError, ValueError): 676 676 pass # Invalid ordering specified. Just use the default. 677 if params.has_key(ORDER_TYPE_VAR)and params[ORDER_TYPE_VAR] in ('asc', 'desc'):677 if ORDER_TYPE_VAR in params and params[ORDER_TYPE_VAR] in ('asc', 'desc'): 678 678 order_type = params[ORDER_TYPE_VAR] 679 679 return order_field, order_type … … 683 683 lookup_params = self.params.copy() # a dictionary of the query string 684 684 for i in (ALL_VAR, ORDER_VAR, ORDER_TYPE_VAR, SEARCH_VAR, IS_POPUP_VAR): 685 if lookup_params.has_key(i):685 if i in lookup_params: 686 686 del lookup_params[i] 687 687 django/trunk/django/contrib/comments/templatetags/comments.py
r5072 r5091 117 117 118 118 if not self.free: 119 if context.has_key('user')and context['user'].is_authenticated():119 if 'user' in context and context['user'].is_authenticated(): 120 120 user_id = context['user'].id 121 121 context['user_can_moderate_comments'] = Comment.objects.user_is_moderator(context['user']) django/trunk/django/contrib/comments/views/comments.py
r4486 r5091 218 218 # If user gave correct username/password and wasn't already logged in, log them in 219 219 # so they don't have to enter a username/password again. 220 if manipulator.get_user() and not manipulator.get_user().is_authenticated() and new_data.has_key('password')and manipulator.get_user().check_password(new_data['password']):220 if manipulator.get_user() and not manipulator.get_user().is_authenticated() and 'password' in new_data and manipulator.get_user().check_password(new_data['password']): 221 221 from django.contrib.auth import login 222 222 login(request, manipulator.get_user()) 223 if errors or request.POST.has_key('preview'):223 if errors or 'preview' in request.POST: 224 224 class CommentFormWrapper(oldforms.FormWrapper): 225 225 def __init__(self, manipulator, new_data, errors, rating_choices): … … 245 245 'rating_choices': rating_choices, 246 246 }, context_instance=RequestContext(request)) 247 elif request.POST.has_key('post'):247 elif 'post' in request.POST: 248 248 # If the IP is banned, mail the admins, do NOT save the comment, and 249 249 # serve up the "Thanks for posting" page as if the comment WAS posted. … … 299 299 manipulator = PublicFreeCommentManipulator() 300 300 errors = manipulator.get_validation_errors(new_data) 301 if errors or request.POST.has_key('preview'):301 if errors or 'preview' in request.POST: 302 302 comment = errors and '' or manipulator.get_comment(new_data) 303 303 return render_to_response('comments/free_preview.html', { … … 308 308 'hash': security_hash, 309 309 }, context_instance=RequestContext(request)) 310 elif request.POST.has_key('post'):310 elif 'post' in request.POST: 311 311 # If the IP is banned, mail the admins, do NOT save the comment, and 312 312 # serve up the "Thanks for posting" page as if the comment WAS posted. … … 331 331 """ 332 332 obj = None 333 if request.GET.has_key('c'):333 if 'c' in request.GET: 334 334 content_type_id, object_id = request.GET['c'].split(':') 335 335 try: django/trunk/django/contrib/sitemaps/views.py
r4265 r5091 17 17 maps, urls = [], [] 18 18 if section is not None: 19 if not sitemaps.has_key(section):19 if section not in sitemaps: 20 20 raise Http404("No sitemap available for section: %r" % section) 21 21 maps.append(sitemaps[section]) django/trunk/django/core/cache/backends/simple.py
r4265 r5091 53 53 54 54 def has_key(self, key): 55 return self._cache.has_key(key)55 return key in self._cache 56 56 57 57 def _cull(self): django/trunk/django/core/handlers/modpython.py
r4265 r5091 43 43 def is_secure(self): 44 44 # Note: modpython 3.2.10+ has req.is_https(), but we need to support previous versions 45 return self._req.subprocess_env.has_key('HTTPS')and self._req.subprocess_env['HTTPS'] == 'on'45 return 'HTTPS' in self._req.subprocess_env and self._req.subprocess_env['HTTPS'] == 'on' 46 46 47 47 def _load_post_and_files(self): 48 48 "Populates self._post and self._files" 49 if self._req.headers_in.has_key('content-type')and self._req.headers_in['content-type'].startswith('multipart'):49 if 'content-type' in self._req.headers_in and self._req.headers_in['content-type'].startswith('multipart'): 50 50 self._post, self._files = http.parse_file_upload(self._req.headers_in, self.raw_post_data) 51 51 else: django/trunk/django/core/handlers/wsgi.py
r4265 r5091 104 104 105 105 def is_secure(self): 106 return self.environ.has_key('HTTPS')and self.environ['HTTPS'] == 'on'106 return 'HTTPS' in self.environ and self.environ['HTTPS'] == 'on' 107 107 108 108 def _load_post_and_files(self): django/trunk/django/core/management.py
r4989 r5091 315 315 output.append('%s %s;' % (style.SQL_KEYWORD('DROP TABLE'), 316 316 style.SQL_TABLE(backend.quote_name(model._meta.db_table)))) 317 if backend.supports_constraints and references_to_delete.has_key(model):317 if backend.supports_constraints and model in references_to_delete: 318 318 for rel_class, f in references_to_delete[model]: 319 319 table = rel_class._meta.db_table … … 844 844 comment_notes.append('Field renamed because it was a Python reserved word.') 845 845 846 if relations.has_key(i):846 if i in relations: 847 847 rel_to = relations[i][1] == table_name and "'self'" or table2model(relations[i][1]) 848 848 field_type = 'ForeignKey(%s' % rel_to … … 1551 1551 except IndexError: 1552 1552 parser.print_usage_and_exit() 1553 if not action_mapping.has_key(action):1553 if action not in action_mapping: 1554 1554 print_error("Your action, %r, was invalid." % action, argv[0]) 1555 1555 django/trunk/django/core/servers/basehttp.py
r4265 r5091 209 209 return 'http' 210 210 211 _hop pish= {211 _hop_headers = { 212 212 'connection':1, 'keep-alive':1, 'proxy-authenticate':1, 213 213 'proxy-authorization':1, 'te':1, 'trailers':1, 'transfer-encoding':1, 214 214 'upgrade':1 215 } .has_key215 } 216 216 217 217 def is_hop_by_hop(header_name): 218 218 """Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header""" 219 return _hoppish(header_name.lower())219 return header_name.lower() in _hop_headers 220 220 221 221 class ServerHandler(object): … … 335 335 Subclasses can extend this to add other defaults. 336 336 """ 337 if not self.headers.has_key('Content-Length'):337 if 'Content-Length' not in self.headers: 338 338 self.set_content_length() 339 339 … … 369 369 if self.client_is_modern(): 370 370 self._write('HTTP/%s %s\r\n' % (self.http_version,self.status)) 371 if not self.headers.has_key('Date'):371 if 'Date' not in self.headers: 372 372 self._write( 373 373 'Date: %s\r\n' % time.asctime(time.gmtime(time.time())) 374 374 ) 375 if self.server_software and not self.headers.has_key('Server'):375 if self.server_software and 'Server' not in self.headers: 376 376 self._write('Server: %s\r\n' % self.server_software) 377 377 else: django/trunk/django/core/validators.py
r4704 r5091 285 285 286 286 def __call__(self, field_data, all_data): 287 if all_data.has_key(self.other_field)and all_data[self.other_field] == self.other_value:287 if self.other_field in all_data and all_data[self.other_field] == self.other_value: 288 288 for v in self.validator_list: 289 289 v(field_data, all_data) … … 323 323 324 324 def __call__(self, field_data, all_data): 325 if all_data.has_key(self.other_field)and all_data[self.other_field] == self.other_value and not field_data:325 if self.other_field in all_data and all_data[self.other_field] == self.other_value and not field_data: 326 326 raise ValidationError(self.error_message) 327 327 … … 336 336 337 337 def __call__(self, field_data, all_data): 338 if all_data.has_key(self.other_field)and all_data[self.other_field] != self.other_value and not field_data:338 if self.other_field in all_data and all_data[self.other_field] != self.other_value and not field_data: 339 339 raise ValidationError(self.error_message) 340 340 django/trunk/django/db/backends/mysql_old/base.py
r5076 r5091 54 54 55 55 def __getattr__(self, attr): 56 if self.__dict__.has_key(attr):56 if attr in self.__dict__: 57 57 return self.__dict__[attr] 58 58 else: django/trunk/django/db/backends/postgresql/base.py
r5076 r5091 49 49 50 50 def __getattr__(self, attr): 51 if self.__dict__.has_key(attr):51 if attr in self.__dict__: 52 52 return self.__dict__[attr] 53 53 else: django/trunk/django/db/backends/util.py
r4265 r5091 34 34 35 35 def __getattr__(self, attr): 36 if self.__dict__.has_key(attr):36 if attr in self.__dict__: 37 37 return self.__dict__[attr] 38 38 else: django/trunk/django/db/models/fields/generic.py
r4752 r5091 38 38 # Handle initalizing an object with the generic FK instaed of 39 39 # content-type/object-id fields. 40 if kwargs.has_key(self.name):40 if self.name in kwargs: 41 41 value = kwargs.pop(self.name) 42 42 kwargs[self.ct_field] = self.get_content_type(value) django/trunk/django/db/models/fields/__init__.py
r4954 r5091 780 780 kwargs.setdefault('validator_list', []).append(validators.isSlug) 781 781 # Set db_index=True unless it's been set manually. 782 if not kwargs.has_key('db_index'):782 if 'db_index' not in kwargs: 783 783 kwargs['db_index'] = True 784 784 Field.__init__(self, *args, **kwargs) django/trunk/django/db/models/fields/related.py
r4611 r5091 475 475 kwargs['verbose_name'] = kwargs.get('verbose_name', '') 476 476 477 if kwargs.has_key('edit_inline_type'):477 if 'edit_inline_type' in kwargs: 478 478 import warnings 479 479 warnings.warn("edit_inline_type is deprecated. Use edit_inline instead.") … … 568 568 kwargs['verbose_name'] = kwargs.get('verbose_name', '') 569 569 570 if kwargs.has_key('edit_inline_type'):570 if 'edit_inline_type' in kwargs: 571 571 import warnings 572 572 warnings.warn("edit_inline_type is deprecated. Use edit_inline instead.") django/trunk/django/db/models/loading.py
r4265 r5091 104 104 model_name = model._meta.object_name.lower() 105 105 model_dict = _app_models.setdefault(app_label, {}) 106 if model_ dict.has_key(model_name):106 if model_name in model_dict: 107 107 # The same model may be imported via different paths (e.g. 108 108 # appname.models and project.appname.models). We use the source django/trunk/django/db/models/options.py
r4752 r5091 141 141 follow = {} 142 142 for f in self.fields + self.many_to_many + self.get_all_related_objects(): 143 if override and override.has_key(f.name):143 if override and f.name in override: 144 144 child_override = override[f.name] 145 145 else: … … 183 183 if not hasattr(self, '_field_types'): 184 184 self._field_types = {} 185 if not self._field_types.has_key(field_type):185 if field_type not in self._field_types: 186 186 try: 187 187 # First check self.fields. django/trunk/django/db/transaction.py
r4265 r5091 47 47 """ 48 48 thread_ident = thread.get_ident() 49 if state.has_key(thread_ident)and state[thread_ident]:49 if thread_ident in state and state[thread_ident]: 50 50 state[thread_ident].append(state[thread_ident][-1]) 51 51 else: 52 52 state[thread_ident] = [] 53 53 state[thread_ident].append(settings.TRANSACTIONS_MANAGED) 54 if not dirty.has_key(thread_ident):54 if thread_ident not in dirty: 55 55 dirty[thread_ident] = False 56 56 … … 62 62 """ 63 63 thread_ident = thread.get_ident() 64 if state.has_key(thread_ident)and state[thread_ident]:64 if thread_ident in state and state[thread_ident]: 65 65 del state[thread_ident][-1] 66 66 else: … … 85 85 """ 86 86 thread_ident = thread.get_ident() 87 if dirty.has_key(thread_ident):87 if thread_ident in dirty: 88 88 dirty[thread_ident] = True 89 89 else: … … 97 97 """ 98 98 thread_ident = thread.get_ident() 99 if dirty.has_key(thread_ident):99 if thread_ident in dirty: 100 100 dirty[thread_ident] = False 101 101 else: … … 107 107 """ 108 108 thread_ident = thread.get_ident() 109 if state.has_key(thread_ident):109 if thread_ident in state: 110 110 if state[thread_ident]: 111 111 return state[thread_ident][-1] django/trunk/django/http/__init__.py
r4866 r5091 30 30 def __getitem__(self, key): 31 31 for d in (self.POST, self.GET): 32 if d.has_key(key):32 if key in d: 33 33 return d[key] 34 34 raise KeyError, "%s not found in either POST or GET" % key 35 35 36 36 def has_key(self, key): 37 return self.GET.has_key(key) or self.POST.has_key(key)37 return key in self.GET or key in self.POST 38 38 39 39 def get_full_path(self): … … 58 58 # or {'name': 'blah'} for POST fields 59 59 # We assume all uploaded files have a 'filename' set. 60 if name_dict.has_key('filename'):60 if 'filename' in name_dict: 61 61 assert type([]) != type(submessage.get_payload()), "Nested MIME messages are not supported" 62 62 if not name_dict['filename'].strip(): … … 67 67 FILES.appendlist(name_dict['name'], { 68 68 'filename': filename, 69 'content-type': (submessage.has_key('Content-Type') and submessage['Content-Type'] or None),69 'content-type': 'Content-Type' in submessage and submessage['Content-Type'] or None, 70 70 'content': submessage.get_payload(), 71 71 }) django/trunk/django/middleware/common.py
r5043 r5091 26 26 27 27 # Check for denied User-Agents 28 if request.META.has_key('HTTP_USER_AGENT'):28 if 'HTTP_USER_AGENT' in request.META: 29 29 for user_agent_regex in settings.DISALLOWED_USER_AGENTS: 30 30 if user_agent_regex.search(request.META['HTTP_USER_AGENT']): django/trunk/django/newforms/forms.py
r4925 r5091 245 245 attrs = attrs or {} 246 246 auto_id = self.auto_id 247 if auto_id and not attrs.has_key('id') and not widget.attrs.has_key('id'):247 if auto_id and 'id' not in attrs and 'id' not in widget.attrs: 248 248 attrs['id'] = auto_id 249 249 if not self.form.is_bound: django/trunk/django/newforms/widgets.py
r5088 r5091 231 231 232 232 def tag(self): 233 if self.attrs.has_key('id'):233 if 'id' in self.attrs: 234 234 self.attrs['id'] = '%s_%s' % (self.attrs['id'], self.index) 235 235 final_attrs = dict(self.attrs, type='radio', name=self.name, value=self.choice_value) … … 277 277 def render(self, name, value, attrs=None, choices=()): 278 278 if value is None: value = [] 279 has_id = attrs and attrs.has_key('id')279 has_id = attrs and 'id' in attrs 280 280 final_attrs = self.build_attrs(attrs, name=name) 281 281 output = [u'<ul>'] django/trunk/django/oldforms/__init__.py
r4896 r5091 330 330 def convert_post_data(self, new_data): 331 331 name = self.get_member_name() 332 if new_data.has_key(self.field_name):332 if self.field_name in new_data: 333 333 d = new_data.getlist(self.field_name) 334 334 try: django/trunk/django/template/context.py
r4480 r5091 36 36 "Get a variable's value, starting at the current context and going upward" 37 37 for d in self.dicts: 38 if d.has_key(key):38 if key in d: 39 39 return d[key] 40 40 raise KeyError(key) … … 46 46 def has_key(self, key): 47 47 for d in self.dicts: 48 if d.has_key(key):48 if key in d: 49 49 return True 50 50 return False … … 55 55 def get(self, key, otherwise=None): 56 56 for d in self.dicts: 57 if d.has_key(key):57 if key in d: 58 58 return d[key] 59 59 return otherwise django/trunk/django/template/defaulttags.py
r5077 r5091 88 88 def render(self, context): 89 89 nodelist = NodeList() 90 if context.has_key('forloop'):90 if 'forloop' in context: 91 91 parentloop = context['forloop'] 92 92 else: … … 134 134 135 135 def render(self, context): 136 if context.has_key('forloop')and context['forloop']['first']:136 if 'forloop' in context and context['forloop']['first']: 137 137 self._last_seen = None 138 138 try: … … 433 433 if not hasattr(parser, '_namedCycleNodes'): 434 434 raise TemplateSyntaxError("No named cycles in template: '%s' is not defined" % name) 435 if n ot parser._namedCycleNodes.has_key(name):435 if name not in parser._namedCycleNodes: 436 436 raise TemplateSyntaxError("Named cycle '%s' does not exist" % name) 437 437 return parser._namedCycleNodes[name] … … 912 912 raise TemplateSyntaxError, "'templatetag' statement takes one argument" 913 913 tag = bits[1] 914 if not TemplateTagNode.mapping.has_key(tag):914 if tag not in TemplateTagNode.mapping: 915 915 raise TemplateSyntaxError, "Invalid templatetag argument: '%s'. Must be one of: %s" % \ 916 916 (tag, TemplateTagNode.mapping.keys()) django/trunk/django/template/__init__.py
r5067 r5091 339 339 340 340 def find_filter(self, filter_name): 341 if self.filters.has_key(filter_name):341 if filter_name in self.filters: 342 342 return self.filters[filter_name] 343 343 else: django/trunk/django/utils/datastructures.py
r5069 r5091 43 43 def has_key(self, key): 44 44 for dict in self.dicts: 45 if dict.has_key(key):45 if key in dict: 46 46 return True 47 47 return False django/trunk/django/utils/functional.py
r4265 r5091 43 43 return self.__dispatch[type(res)][funcname](res, *args, **kw) 44 44 45 if not self.__dispatch.has_key(klass):45 if klass not in self.__dispatch: 46 46 self.__dispatch[klass] = {} 47 47 self.__dispatch[klass][funcname] = func django/trunk/django/utils/translation/trans_real.py
r4905 r5091 200 200 """ 201 201 global _active 202 if _active.has_key(currentThread()):202 if currentThread() in _active: 203 203 del _a
