Changeset 5100
- Timestamp:
- 04/26/07 15:45:53 (1 year ago)
- Files:
-
- django/branches/boulder-oracle-sprint/AUTHORS (modified) (2 diffs)
- django/branches/boulder-oracle-sprint/django/bin/make-messages.py (modified) (2 diffs)
- django/branches/boulder-oracle-sprint/django/bin/profiling/gather_profile_stats.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/conf/urls/defaults.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/contrib/admin/templatetags/admin_modify.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/contrib/admin/views/auth.py (modified) (3 diffs)
- django/branches/boulder-oracle-sprint/django/contrib/admin/views/decorators.py (modified) (4 diffs)
- django/branches/boulder-oracle-sprint/django/contrib/admin/views/main.py (modified) (10 diffs)
- django/branches/boulder-oracle-sprint/django/contrib/comments/templatetags/comments.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/contrib/comments/views/comments.py (modified) (5 diffs)
- django/branches/boulder-oracle-sprint/django/contrib/localflavor/br/forms.py (modified) (4 diffs)
- django/branches/boulder-oracle-sprint/django/contrib/localflavor/cl (copied) (copied from django/trunk/django/contrib/localflavor/cl)
- django/branches/boulder-oracle-sprint/django/contrib/localflavor/cl/forms.py (copied) (copied from django/trunk/django/contrib/localflavor/cl/forms.py)
- django/branches/boulder-oracle-sprint/django/contrib/localflavor/cl/__init__.py (copied) (copied from django/trunk/django/contrib/localflavor/cl/__init__.py)
- django/branches/boulder-oracle-sprint/django/contrib/localflavor/is_ (copied) (copied from django/trunk/django/contrib/localflavor/is_)
- django/branches/boulder-oracle-sprint/django/contrib/localflavor/is_/forms.py (copied) (copied from django/trunk/django/contrib/localflavor/is_/forms.py)
- django/branches/boulder-oracle-sprint/django/contrib/localflavor/is_/__init__.py (copied) (copied from django/trunk/django/contrib/localflavor/is_/__init__.py)
- django/branches/boulder-oracle-sprint/django/contrib/localflavor/is_/is_postalcodes.py (copied) (copied from django/trunk/django/contrib/localflavor/is_/is_postalcodes.py)
- django/branches/boulder-oracle-sprint/django/contrib/sitemaps/views.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/core/cache/backends/simple.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/core/handlers/modpython.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/core/handlers/wsgi.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/core/management.py (modified) (3 diffs)
- django/branches/boulder-oracle-sprint/django/core/servers/basehttp.py (modified) (3 diffs)
- django/branches/boulder-oracle-sprint/django/core/urlresolvers.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/core/validators.py (modified) (3 diffs)
- django/branches/boulder-oracle-sprint/django/db/backends/mysql_old/base.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/db/backends/postgresql/base.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/db/backends/util.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/db/models/fields/generic.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/db/models/fields/__init__.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/db/models/fields/related.py (modified) (2 diffs)
- django/branches/boulder-oracle-sprint/django/db/models/loading.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/db/models/options.py (modified) (2 diffs)
- django/branches/boulder-oracle-sprint/django/db/transaction.py (modified) (5 diffs)
- django/branches/boulder-oracle-sprint/django/http/__init__.py (modified) (3 diffs)
- django/branches/boulder-oracle-sprint/django/middleware/common.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/newforms/fields.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/newforms/forms.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/newforms/widgets.py (modified) (3 diffs)
- django/branches/boulder-oracle-sprint/django/oldforms/__init__.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/template/context.py (modified) (3 diffs)
- django/branches/boulder-oracle-sprint/django/template/defaulttags.py (modified) (4 diffs)
- django/branches/boulder-oracle-sprint/django/template/__init__.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/utils/datastructures.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/utils/functional.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/utils/translation/trans_real.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/views/i18n.py (modified) (3 diffs)
- django/branches/boulder-oracle-sprint/docs/authentication.txt (modified) (1 diff)
- django/branches/boulder-oracle-sprint/docs/install.txt (modified) (1 diff)
- django/branches/boulder-oracle-sprint/docs/settings.txt (modified) (3 diffs)
- django/branches/boulder-oracle-sprint/tests/regressiontests/dispatch/tests/test_saferef.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/tests/regressiontests/forms/localflavor.py (modified) (2 diffs)
- django/branches/boulder-oracle-sprint/tests/regressiontests/forms/tests.py (modified) (2 diffs)
- django/branches/boulder-oracle-sprint/tests/regressiontests/httpwrappers/tests.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/boulder-oracle-sprint/AUTHORS
r5079 r5100 151 151 Petar Marić <http://www.petarmaric.com/> 152 152 Nuno Mariz <nmariz@gmail.com> 153 marijn@metronomo.cl 153 154 mark@junklight.com 154 155 Yasushi Masuda <whosaysni@gmail.com> … … 168 169 Neal Norwitz <nnorwitz@google.com> 169 170 oggie rob <oz.robharvey@gmail.com> 171 onaiort@gmail.com 170 172 Jay Parlar <parlar@gmail.com> 171 173 pavithran s <pavithran.s@gmail.com> django/branches/boulder-oracle-sprint/django/bin/make-messages.py
r4722 r5100 82 82 open(os.path.join(dirpath, '%s.py' % file), "wb").write(src) 83 83 thefile = '%s.py' % file 84 cmd = 'xgettext %s -d %s -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy --from-code UTF-8 -o - "%s"' % (84 cmd = 'xgettext %s -d %s -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % ( 85 85 os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile)) 86 86 (stdin, stdout, stderr) = os.popen3(cmd, 'b') … … 104 104 thefile = '%s.py' % file 105 105 if verbose: sys.stdout.write('processing file %s in %s\n' % (file, dirpath)) 106 cmd = 'xgettext %s -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy --from-code UTF-8 -o - "%s"' % (106 cmd = 'xgettext %s -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % ( 107 107 os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile)) 108 108 (stdin, stdout, stderr) = os.popen3(cmd, 'b') django/branches/boulder-oracle-sprint/django/bin/profiling/gather_profile_stats.py
r4279 r5100 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/branches/boulder-oracle-sprint/django/conf/urls/defaults.py
r4906 r5100 12 12 for t in args: 13 13 if isinstance(t, (list, tuple)): 14 pattern_list.append(url(prefix=prefix, *t)) 15 else: 16 pattern_list.append(t) 14 t = url(prefix=prefix, *t) 15 elif isinstance(t, RegexURLPattern): 16 t.add_prefix(prefix) 17 pattern_list.append(t) 17 18 return pattern_list 18 19 django/branches/boulder-oracle-sprint/django/contrib/admin/templatetags/admin_modify.py
r4695 r5100 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/branches/boulder-oracle-sprint/django/contrib/admin/views/auth.py
r4279 r5100 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/branches/boulder-oracle-sprint/django/contrib/admin/views/decorators.py
r5079 r5100 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/branches/boulder-oracle-sprint/django/contrib/admin/views/main.py
r4695 r5100 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/branches/boulder-oracle-sprint/django/contrib/comments/templatetags/comments.py
r5079 r5100 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/branches/boulder-oracle-sprint/django/contrib/comments/views/comments.py
r4212 r5100 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/branches/boulder-oracle-sprint/django/contrib/localflavor/br/forms.py
r4935 r5100 5 5 6 6 from django.newforms import ValidationError 7 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES7 from django.newforms.fields import Field, RegexField, CharField, Select, EMPTY_VALUES 8 8 from django.utils.encoding import smart_unicode 9 9 from django.utils.translation import gettext … … 16 16 super(BRZipCodeField, self).__init__(r'^\d{5}-\d{3}$', 17 17 max_length=None, min_length=None, 18 error_message=gettext( u'Enter a zip code in the format XXXXX-XXX.'),18 error_message=gettext('Enter a zip code in the format XXXXX-XXX.'), 19 19 *args, **kwargs) 20 20 … … 32 32 class BRStateSelect(Select): 33 33 """ 34 A Select widget that uses a list of brazilian states/territories34 A Select widget that uses a list of Brazilian states/territories 35 35 as its choices. 36 36 """ … … 38 38 from br_states import STATE_CHOICES # relative import 39 39 super(BRStateSelect, self).__init__(attrs, choices=STATE_CHOICES) 40 41 42 def DV_maker(v): 43 if v >= 2: 44 return 11 - v 45 return 0 46 47 class BRCPFField(CharField): 48 """ 49 This field validate a CPF number or a CPF string. A CPF number is 50 compounded by XXX.XXX.XXX-VD. The two last digits are check digits. 51 52 More information: 53 http://en.wikipedia.org/wiki/Cadastro_de_Pessoas_F%C3%ADsicas 54 """ 55 def __init__(self, *args, **kwargs): 56 super(BRCPFField, self).__init__(max_length=14, min_length=11, *args, **kwargs) 57 58 def clean(self, value): 59 """ 60 Value can be either a string in the format XXX.XXX.XXX-XX or an 61 11-digit number. 62 """ 63 value = super(BRCPFField, self).clean(value) 64 if value in EMPTY_VALUES: 65 return u'' 66 orig_value = value[:] 67 if not value.isdigit(): 68 value = re.sub("[-\.]", "", value) 69 try: 70 int(value) 71 except ValueError: 72 raise ValidationError(gettext("This field requires only numbers.")) 73 if len(value) != 11: 74 raise ValidationError(gettext("This field requires at most 11 digits or 14 characters.")) 75 orig_dv = value[-2:] 76 77 new_1dv = sum([i * int(value[idx]) for idx, i in enumerate(range(10, 1, -1))]) 78 new_1dv = DV_maker(new_1dv % 11) 79 value = value[:-2] + str(new_1dv) + value[-1] 80 new_2dv = sum([i * int(value[idx]) for idx, i in enumerate(range(11, 1, -1))]) 81 new_2dv = DV_maker(new_2dv % 11) 82 value = value[:-1] + str(new_2dv) 83 if value[-2:] != orig_dv: 84 raise ValidationError(gettext("Invalid CPF number.")) 85 86 return orig_value 87 88 class BRCNPJField(Field): 89 def clean(self, value): 90 """ 91 Value can be either a string in the format XX.XXX.XXX/XXXX-XX or a 92 group of 14 characters. 93 """ 94 value = super(BRCNPJField, self).clean(value) 95 if value in EMPTY_VALUES: 96 return u'' 97 orig_value = value[:] 98 if not value.isdigit(): 99 value = re.sub("[-/\.]", "", value) 100 try: 101 int(value) 102 except ValueError: 103 raise ValidationError("This field requires only numbers.") 104 if len(value) != 14: 105 raise ValidationError( 106 gettext("This field requires at least 14 digits")) 107 orig_dv = value[-2:] 108 109 new_1dv = sum([i * int(value[idx]) for idx, i in enumerate(range(5, 1, -1) + range(9, 1, -1))]) 110 new_1dv = DV_maker(new_1dv % 11) 111 value = value[:-2] + str(new_1dv) + value[-1] 112 new_2dv = sum([i * int(value[idx]) for idx, i in enumerate(range(6, 1, -1) + range(9, 1, -1))]) 113 new_2dv = DV_maker(new_2dv % 11) 114 value = value[:-1] + str(new_2dv) 115 if value[-2:] != orig_dv: 116 raise ValidationError(gettext("Invalid CNPJ number.")) 117 118 return orig_value 119 django/branches/boulder-oracle-sprint/django/contrib/sitemaps/views.py
r4279 r5100 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/branches/boulder-oracle-sprint/django/core/cache/backends/simple.py
r4279 r5100 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/branches/boulder-oracle-sprint/django/core/handlers/modpython.py
r4279 r5100 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/branches/boulder-oracle-sprint/django/core/handlers/wsgi.py
r4279 r5100 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/branches/boulder-oracle-sprint/django/core/management.py
r5036 r5100 357 357 output.append('%s %s;' % (style.SQL_KEYWORD('DROP TABLE'), 358 358 style.SQL_TABLE(backend.quote_name(model._meta.db_table)))) 359 if backend.supports_constraints and references_to_delete.has_key(model):359 if backend.supports_constraints and model in references_to_delete: 360 360 for rel_class, f in references_to_delete[model]: 361 361 table = rel_class._meta.db_table … … 903 903 comment_notes.append('Field renamed because it was a Python reserved word.') 904 904 905 if relations.has_key(i):905 if i in relations: 906 906 rel_to = relations[i][1] == table_name and "'self'" or table2model(relations[i][1]) 907 907 field_type = 'ForeignKey(%s' % rel_to … … 1610 1610 except IndexError: 1611 1611 parser.print_usage_and_exit() 1612 if not action_mapping.has_key(action):1612 if action not in action_mapping: 1613 1613 print_error("Your action, %r, was invalid." % action, argv[0]) 1614 1614 django/branches/boulder-oracle-sprint/django/core/servers/basehttp.py
r4279 r5100 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/branches/boulder-oracle-sprint/django/core/urlresolvers.py
r4906 r5100 103 103 self.name = name 104 104 105 def add_prefix(self, prefix): 106 """ 107 Adds the prefix string to a string-based callback. 108 """ 109 if not prefix or not hasattr(self, '_callback_str'): 110 return 111 self._callback_str = prefix + '.' + self._callback_str 112 105 113 def resolve(self, path): 106 114 match = self.regex.search(path) django/branches/boulder-oracle-sprint/django/core/validators.py
r4722 r5100 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/branches/boulder-oracle-sprint/django/db/backends/mysql_old/base.py
r5079 r5100 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/branches/boulder-oracle-sprint/django/db/backends/postgresql/base.py
r5079 r5100 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/branches/boulder-oracle-sprint/django/db/backends/util.py
r4843 r5100 35 35 36 36 def __getattr__(self, attr): 37 if self.__dict__.has_key(attr):37 if attr in self.__dict__: 38 38 return self.__dict__[attr] 39 39 else: django/branches/boulder-oracle-sprint/django/db/models/fields/generic.py
r4755 r5100 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/branches/boulder-oracle-sprint/django/db/models/fields/__init__.py
r5046 r5100 789 789 kwargs.setdefault('validator_list', []).append(validators.isSlug) 790 790 # Set db_index=True unless it's been set manually. 791 if not kwargs.has_key('db_index'):791 if 'db_index' not in kwargs: 792 792 kwargs['db_index'] = True 793 793 Field.__init__(self, *args, **kwargs) django/branches/boulder-oracle-sprint/django/db/models/fields/related.py
r4994 r5100 472 472 kwargs['verbose_name'] = kwargs.get('verbose_name', '') 473 473 474 if kwargs.has_key('edit_inline_type'):474 if 'edit_inline_type' in kwargs: 475 475 import warnings 476 476 warnings.warn("edit_inline_type is deprecated. Use edit_inline instead.") … … 565 565 kwargs['verbose_name'] = kwargs.get('verbose_name', '') 566 566 567 if kwargs.has_key('edit_inline_type'):567 if 'edit_inline_type' in kwargs: 568 568 import warnings 569 569 warnings.warn("edit_inline_type is deprecated. Use edit_inline instead.") django/branches/boulder-oracle-sprint/django/db/models/loading.py
