Django

Code

Changeset 5100

Show
Ignore:
Timestamp:
04/26/07 15:45:53 (1 year ago)
Author:
bouldersprinters
Message:

boulder-oracle-sprint: Merged to [5099]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/boulder-oracle-sprint/AUTHORS

    r5079 r5100  
    151151    Petar Marić <http://www.petarmaric.com/> 
    152152    Nuno Mariz <nmariz@gmail.com> 
     153    marijn@metronomo.cl 
    153154    mark@junklight.com 
    154155    Yasushi Masuda <whosaysni@gmail.com> 
     
    168169    Neal Norwitz <nnorwitz@google.com> 
    169170    oggie rob <oz.robharvey@gmail.com> 
     171    onaiort@gmail.com 
    170172    Jay Parlar <parlar@gmail.com> 
    171173    pavithran s <pavithran.s@gmail.com> 
  • django/branches/boulder-oracle-sprint/django/bin/make-messages.py

    r4722 r5100  
    8282                    open(os.path.join(dirpath, '%s.py' % file), "wb").write(src) 
    8383                    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"' % ( 
    8585                        os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile)) 
    8686                    (stdin, stdout, stderr) = os.popen3(cmd, 'b') 
     
    104104                        thefile = '%s.py' % file 
    105105                    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"' % ( 
    107107                        os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile)) 
    108108                    (stdin, stdout, stderr) = os.popen3(cmd, 'b') 
  • django/branches/boulder-oracle-sprint/django/bin/profiling/gather_profile_stats.py

    r4279 r5100  
    2323            continue 
    2424        print "Processing %s" % f 
    25         if profiles.has_key(path)
     25        if path in profiles
    2626            profiles[path].add(prof) 
    2727        else: 
  • django/branches/boulder-oracle-sprint/django/conf/urls/defaults.py

    r4906 r5100  
    1212    for t in args: 
    1313        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) 
    1718    return pattern_list 
    1819 
  • django/branches/boulder-oracle-sprint/django/contrib/admin/templatetags/admin_modify.py

    r4695 r5100  
    7575 
    7676    def get_nodelist(cls, klass): 
    77         if not cls.nodelists.has_key(klass)
     77        if klass not in cls.nodelists
    7878            try: 
    7979                field_class_name = klass.__name__ 
  • django/branches/boulder-oracle-sprint/django/contrib/admin/views/auth.py

    r4279 r5100  
    1818            new_user = manipulator.save(new_data) 
    1919            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
    2121                request.user.message_set.create(message=msg) 
    2222                return HttpResponseRedirect(request.path) 
     
    3030        'title': _('Add user'), 
    3131        'form': form, 
    32         'is_popup': request.REQUEST.has_key('_popup')
     32        'is_popup': '_popup' in request.REQUEST
    3333        'add': True, 
    3434        'change': False, 
     
    6464        'title': _('Change password: %s') % escape(user.username), 
    6565        'form': form, 
    66         'is_popup': request.REQUEST.has_key('_popup')
     66        'is_popup': '_popup' in request.REQUEST
    6767        'add': True, 
    6868        'change': False, 
  • django/branches/boulder-oracle-sprint/django/contrib/admin/views/decorators.py

    r5079 r5100  
    1313def _display_login_form(request, error_message=''): 
    1414    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
    1616        # User has failed login BUT has previously saved post data. 
    1717        post_data = request.POST['post_data'] 
     
    4949        if request.user.is_authenticated() and request.user.is_staff: 
    5050            # The user is valid. Continue to the admin page. 
    51             if request.POST.has_key('post_data')
     51            if 'post_data' in request.POST
    5252                # User must have re-authenticated through a different window 
    5353                # or tab. 
     
    5858 
    5959        # 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
    6161            if request.POST: 
    6262                message = _("Please log in again, because your session has expired. Don't worry: Your submission has been saved.") 
     
    9191                login(request, user) 
    9292                # TODO: set last_login with an event. 
    93                 if request.POST.has_key('post_data')
     93                if 'post_data' in request.POST
    9494                    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
    9696                        # overwrite request.POST with the saved post_data, and continue 
    9797                        request.POST = post_data 
  • django/branches/boulder-oracle-sprint/django/contrib/admin/views/main.py

    r4695 r5100  
    258258            # Here, we distinguish between different save types by checking for 
    259259            # the presence of keys in request.POST. 
    260             if request.POST.has_key("_continue")
     260            if "_continue" in request.POST
    261261                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
    263263                    post_url_continue += "?_popup=1" 
    264264                return HttpResponseRedirect(post_url_continue % pk_value) 
    265             if request.POST.has_key("_popup")
     265            if "_popup" in request.POST
    266266                if type(pk_value) is str: # Quote if string, so JavaScript doesn't think it's a variable. 
    267267                    pk_value = '"%s"' % pk_value.replace('"', '\\"') 
    268268                return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, %s, "%s");</script>' % \ 
    269269                    (pk_value, str(new_object).replace('"', '\\"'))) 
    270             elif request.POST.has_key("_addanother")
     270            elif "_addanother" in request.POST
    271271                request.user.message_set.create(message=msg + ' ' + (_("You may add another %s below.") % opts.verbose_name)) 
    272272                return HttpResponseRedirect(request.path) 
     
    289289        'title': _('Add %s') % opts.verbose_name, 
    290290        'form': form, 
    291         'is_popup': request.REQUEST.has_key('_popup')
     291        'is_popup': '_popup' in request.REQUEST
    292292        'show_delete': show_delete, 
    293293    }) 
     
    309309        raise PermissionDenied 
    310310 
    311     if request.POST and request.POST.has_key("_saveasnew")
     311    if request.POST and "_saveasnew" in request.POST
    312312        return add_stage(request, app_label, model_name, form_url='../../add/') 
    313313 
     
    344344 
    345345            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
    347347                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
    349349                    return HttpResponseRedirect(request.path + "?_popup=1") 
    350350                else: 
    351351                    return HttpResponseRedirect(request.path) 
    352             elif request.POST.has_key("_saveasnew")
     352            elif "_saveasnew" in request.POST
    353353                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}) 
    354354                return HttpResponseRedirect("../%s/" % pk_value) 
    355             elif request.POST.has_key("_addanother")
     355            elif "_addanother" in request.POST
    356356                request.user.message_set.create(message=msg + ' ' + (_("You may add another %s below.") % opts.verbose_name)) 
    357357                return HttpResponseRedirect("../add/") 
     
    393393        'object_id': object_id, 
    394394        'original': manipulator.original_object, 
    395         'is_popup': request.REQUEST.has_key('_popup')
     395        'is_popup': '_popup' in request.REQUEST
    396396    }) 
    397397    return render_change_form(model, manipulator, c, change=True) 
     
    559559        except ValueError: 
    560560            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 
    563563        self.params = dict(request.GET.items()) 
    564         if self.params.has_key(PAGE_VAR)
     564        if PAGE_VAR in self.params
    565565            del self.params[PAGE_VAR] 
    566         if self.params.has_key(ERROR_FLAG)
     566        if ERROR_FLAG in self.params
    567567            del self.params[ERROR_FLAG] 
    568568 
     
    595595                    del p[k] 
    596596        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: 
    598598                del p[k] 
    599599            elif v is not None: 
     
    657657        else: 
    658658            order_field, order_type = ordering[0], 'asc' 
    659         if params.has_key(ORDER_VAR)
     659        if ORDER_VAR in params
    660660            try: 
    661661                field_name = lookup_opts.admin.list_display[int(params[ORDER_VAR])] 
     
    675675            except (IndexError, ValueError): 
    676676                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'): 
    678678            order_type = params[ORDER_TYPE_VAR] 
    679679        return order_field, order_type 
     
    683683        lookup_params = self.params.copy() # a dictionary of the query string 
    684684        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
    686686                del lookup_params[i] 
    687687 
  • django/branches/boulder-oracle-sprint/django/contrib/comments/templatetags/comments.py

    r5079 r5100  
    117117 
    118118        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(): 
    120120                user_id = context['user'].id 
    121121                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  
    218218    # If user gave correct username/password and wasn't already logged in, log them in 
    219219    # 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']): 
    221221        from django.contrib.auth import login 
    222222        login(request, manipulator.get_user()) 
    223     if errors or request.POST.has_key('preview')
     223    if errors or 'preview' in request.POST
    224224        class CommentFormWrapper(oldforms.FormWrapper): 
    225225            def __init__(self, manipulator, new_data, errors, rating_choices): 
     
    245245            'rating_choices': rating_choices, 
    246246        }, context_instance=RequestContext(request)) 
    247     elif request.POST.has_key('post')
     247    elif 'post' in request.POST
    248248        # If the IP is banned, mail the admins, do NOT save the comment, and 
    249249        # serve up the "Thanks for posting" page as if the comment WAS posted. 
     
    299299    manipulator = PublicFreeCommentManipulator() 
    300300    errors = manipulator.get_validation_errors(new_data) 
    301     if errors or request.POST.has_key('preview')
     301    if errors or 'preview' in request.POST
    302302        comment = errors and '' or manipulator.get_comment(new_data) 
    303303        return render_to_response('comments/free_preview.html', { 
     
    308308            'hash': security_hash, 
    309309        }, context_instance=RequestContext(request)) 
    310     elif request.POST.has_key('post')
     310    elif 'post' in request.POST
    311311        # If the IP is banned, mail the admins, do NOT save the comment, and 
    312312        # serve up the "Thanks for posting" page as if the comment WAS posted. 
     
    331331    """ 
    332332    obj = None 
    333     if request.GET.has_key('c')
     333    if 'c' in request.GET
    334334        content_type_id, object_id = request.GET['c'].split(':') 
    335335        try: 
  • django/branches/boulder-oracle-sprint/django/contrib/localflavor/br/forms.py

    r4935 r5100  
    55 
    66from django.newforms import ValidationError 
    7 from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES 
     7from django.newforms.fields import Field, RegexField, CharField, Select, EMPTY_VALUES 
    88from django.utils.encoding import smart_unicode 
    99from django.utils.translation import gettext 
     
    1616        super(BRZipCodeField, self).__init__(r'^\d{5}-\d{3}$', 
    1717            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.'), 
    1919            *args, **kwargs) 
    2020 
     
    3232class BRStateSelect(Select): 
    3333    """ 
    34     A Select widget that uses a list of brazilian states/territories 
     34    A Select widget that uses a list of Brazilian states/territories 
    3535    as its choices. 
    3636    """ 
     
    3838        from br_states import STATE_CHOICES # relative import 
    3939        super(BRStateSelect, self).__init__(attrs, choices=STATE_CHOICES) 
     40 
     41 
     42def DV_maker(v): 
     43    if v >= 2: 
     44        return 11 - v 
     45    return 0 
     46 
     47class 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 
     88class 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  
    1717    maps, urls = [], [] 
    1818    if section is not None: 
    19         if not sitemaps.has_key(section)
     19        if section not in sitemaps
    2020            raise Http404("No sitemap available for section: %r" % section) 
    2121        maps.append(sitemaps[section]) 
  • django/branches/boulder-oracle-sprint/django/core/cache/backends/simple.py

    r4279 r5100  
    5353 
    5454    def has_key(self, key): 
    55         return self._cache.has_key(key) 
     55        return key in self._cache 
    5656 
    5757    def _cull(self): 
  • django/branches/boulder-oracle-sprint/django/core/handlers/modpython.py

    r4279 r5100  
    4343    def is_secure(self): 
    4444        # 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' 
    4646 
    4747    def _load_post_and_files(self): 
    4848        "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'): 
    5050            self._post, self._files = http.parse_file_upload(self._req.headers_in, self.raw_post_data) 
    5151        else: 
  • django/branches/boulder-oracle-sprint/django/core/handlers/wsgi.py

    r4279 r5100  
    104104 
    105105    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' 
    107107 
    108108    def _load_post_and_files(self): 
  • django/branches/boulder-oracle-sprint/django/core/management.py

    r5036 r5100  
    357357            output.append('%s %s;' % (style.SQL_KEYWORD('DROP TABLE'), 
    358358                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
    360360                for rel_class, f in references_to_delete[model]: 
    361361                    table = rel_class._meta.db_table 
     
    903903                comment_notes.append('Field renamed because it was a Python reserved word.') 
    904904 
    905             if relations.has_key(i)
     905            if i in relations
    906906                rel_to = relations[i][1] == table_name and "'self'" or table2model(relations[i][1]) 
    907907                field_type = 'ForeignKey(%s' % rel_to 
     
    16101610    except IndexError: 
    16111611        parser.print_usage_and_exit() 
    1612     if not action_mapping.has_key(action)
     1612    if action not in action_mapping
    16131613        print_error("Your action, %r, was invalid." % action, argv[0]) 
    16141614 
  • django/branches/boulder-oracle-sprint/django/core/servers/basehttp.py

    r4279 r5100  
    209209        return 'http' 
    210210 
    211 _hoppish = { 
     211_hop_headers = { 
    212212    'connection':1, 'keep-alive':1, 'proxy-authenticate':1, 
    213213    'proxy-authorization':1, 'te':1, 'trailers':1, 'transfer-encoding':1, 
    214214    'upgrade':1 
    215 }.has_key 
     215} 
    216216 
    217217def is_hop_by_hop(header_name): 
    218218    """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 
    220220 
    221221class ServerHandler(object): 
     
    335335        Subclasses can extend this to add other defaults. 
    336336        """ 
    337         if not self.headers.has_key('Content-Length')
     337        if 'Content-Length' not in self.headers
    338338            self.set_content_length() 
    339339 
     
    369369            if self.client_is_modern(): 
    370370                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
    372372                    self._write( 
    373373                        'Date: %s\r\n' % time.asctime(time.gmtime(time.time())) 
    374374                    ) 
    375                 if self.server_software and not self.headers.has_key('Server')
     375                if self.server_software and 'Server' not in self.headers
    376376                    self._write('Server: %s\r\n' % self.server_software) 
    377377        else: 
  • django/branches/boulder-oracle-sprint/django/core/urlresolvers.py

    r4906 r5100  
    103103        self.name = name 
    104104 
     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 
    105113    def resolve(self, path): 
    106114        match = self.regex.search(path) 
  • django/branches/boulder-oracle-sprint/django/core/validators.py

    r4722 r5100  
    285285 
    286286    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: 
    288288            for v in self.validator_list: 
    289289                v(field_data, all_data) 
     
    323323 
    324324    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: 
    326326            raise ValidationError(self.error_message) 
    327327 
     
    336336 
    337337    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: 
    339339            raise ValidationError(self.error_message) 
    340340 
  • django/branches/boulder-oracle-sprint/django/db/backends/mysql_old/base.py

    r5079 r5100  
    5454 
    5555    def __getattr__(self, attr): 
    56         if self.__dict__.has_key(attr)
     56        if attr in self.__dict__
    5757            return self.__dict__[attr] 
    5858        else: 
  • django/branches/boulder-oracle-sprint/django/db/backends/postgresql/base.py

    r5079 r5100  
    4949 
    5050    def __getattr__(self, attr): 
    51         if self.__dict__.has_key(attr)
     51        if attr in self.__dict__
    5252            return self.__dict__[attr] 
    5353        else: 
  • django/branches/boulder-oracle-sprint/django/db/backends/util.py

    r4843 r5100  
    3535 
    3636    def __getattr__(self, attr): 
    37         if self.__dict__.has_key(attr)
     37        if attr in self.__dict__
    3838            return self.__dict__[attr] 
    3939        else: 
  • django/branches/boulder-oracle-sprint/django/db/models/fields/generic.py

    r4755 r5100  
    3838        # Handle initalizing an object with the generic FK instaed of  
    3939        # content-type/object-id fields.         
    40         if kwargs.has_key(self.name)
     40        if self.name in kwargs
    4141            value = kwargs.pop(self.name) 
    4242            kwargs[self.ct_field] = self.get_content_type(value) 
  • django/branches/boulder-oracle-sprint/django/db/models/fields/__init__.py

    r5046 r5100  
    789789        kwargs.setdefault('validator_list', []).append(validators.isSlug) 
    790790        # 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
    792792            kwargs['db_index'] = True 
    793793        Field.__init__(self, *args, **kwargs) 
  • django/branches/boulder-oracle-sprint/django/db/models/fields/related.py

    r4994 r5100  
    472472        kwargs['verbose_name'] = kwargs.get('verbose_name', '') 
    473473 
    474         if kwargs.has_key('edit_inline_type')
     474        if 'edit_inline_type' in kwargs
    475475            import warnings 
    476476            warnings.warn("edit_inline_type is deprecated. Use edit_inline instead.") 
     
    565565        kwargs['verbose_name'] = kwargs.get('verbose_name', '') 
    566566 
    567         if kwargs.has_key('edit_inline_type')
     567        if 'edit_inline_type' in kwargs
    568568            import warnings 
    569569            warnings.warn("edit_inline_type is deprecated. Use edit_inline instead.") 
  • django/branches/boulder-oracle-sprint/django/db/models/loading.py