Ticket #4607: fallback_plus_new.patch

File fallback_plus_new.patch, 6.6 KB (added by Chris Beaven, 17 years ago)
  • django/contrib/admin/views/main.py

     
    1414from django.utils.text import capfirst, get_text_list
    1515import operator
    1616
     17import __builtin__
     18if not hasattr(__builtin__, 'set'):
     19    from sets import Set as set   # Python 2.3 fallback
     20
    1721from django.contrib.admin.models import LogEntry, ADDITION, CHANGE, DELETION
    1822if not LogEntry._meta.installed:
    1923    raise ImproperlyConfigured, "You'll need to put 'django.contrib.admin' in your INSTALLED_APPS setting before you can use the admin application."
     
    489493                perms_needed.add(related.opts.verbose_name)
    490494
    491495def delete_stage(request, app_label, model_name, object_id):
    492     import sets
    493496    model = models.get_model(app_label, model_name)
    494497    object_id = unquote(object_id)
    495498    if model is None:
     
    502505    # Populate deleted_objects, a data structure of all related objects that
    503506    # will also be deleted.
    504507    deleted_objects = ['%s: <a href="../../%s/">%s</a>' % (capfirst(opts.verbose_name), object_id, escape(str(obj))), []]
    505     perms_needed = sets.Set()
     508    perms_needed = set()
    506509    _get_deleted_objects(deleted_objects, perms_needed, request.user, obj, opts, 1)
    507510
    508511    if request.POST: # The user has already confirmed the deletion.
  • django/contrib/auth/models.py

     
    55from django.utils.translation import gettext_lazy as _
    66import datetime
    77
     8import __builtin__
     9if not hasattr(__builtin__, 'set'):
     10    from sets import Set as set   # Python 2.3 fallback
     11
    812def check_password(raw_password, enc_password):
    913    """
    1014    Returns a boolean of whether the raw_password was correct. Handles
     
    175179    def get_group_permissions(self):
    176180        "Returns a list of permission strings that this user has through his/her groups."
    177181        if not hasattr(self, '_group_perm_cache'):
    178             import sets
    179182            cursor = connection.cursor()
    180183            # The SQL below works out to the following, after DB quoting:
    181184            # cursor.execute("""
     
    200203                backend.quote_name('id'), backend.quote_name('content_type_id'),
    201204                backend.quote_name('user_id'),)
    202205            cursor.execute(sql, [self.id])
    203             self._group_perm_cache = sets.Set(["%s.%s" % (row[0], row[1]) for row in cursor.fetchall()])
     206            self._group_perm_cache = set(["%s.%s" % (row[0], row[1]) for row in cursor.fetchall()])
    204207        return self._group_perm_cache
    205208
    206209    def get_all_permissions(self):
    207210        if not hasattr(self, '_perm_cache'):
    208211            import sets
    209             self._perm_cache = sets.Set(["%s.%s" % (p.content_type.app_label, p.codename) for p in self.user_permissions.select_related()])
     212            self._perm_cache = set(["%s.%s" % (p.content_type.app_label, p.codename) for p in self.user_permissions.select_related()])
    210213            self._perm_cache.update(self.get_group_permissions())
    211214        return self._perm_cache
    212215
  • django/core/management.py

     
    77from django.utils import termcolors
    88import os, re, shutil, sys, textwrap
    99
    10 # For Python 2.3
    11 if not hasattr(__builtins__, 'set'):
    12     from sets import Set as set
     10import __builtin__
     11if not hasattr(__builtin__, 'set'):
     12    from sets import Set as set   # Python 2.3 fallback
    1313
    1414# For backwards compatibility: get_version() used to be in this module.
    1515get_version = django.get_version
  • django/db/models/fields/related.py

     
    1010from django import newforms as forms
    1111from django.dispatch import dispatcher
    1212
    13 # For Python 2.3
    14 if not hasattr(__builtins__, 'set'):
    15     from sets import Set as set
     13import __builtin__
     14if not hasattr(__builtin__, 'set'):
     15    from sets import Set as set   # Python 2.3 fallback
    1616
    1717# Values for Relation.edit_inline.
    1818TABULAR, STACKED = 1, 2
  • django/db/models/query.py

     
    77import operator
    88import re
    99
    10 # For Python 2.3
    11 if not hasattr(__builtins__, 'set'):
    12     from sets import Set as set
     10import __builtin__
     11if not hasattr(__builtin__, 'set'):
     12    from sets import Set as set   # Python 2.3 fallback
    1313
    1414# The string constant used to separate query parts
    1515LOOKUP_SEPARATOR = '__'
  • django/newforms/fields.py

     
    2626# These values, if given to to_python(), will trigger the self.required check.
    2727EMPTY_VALUES = (None, '')
    2828
    29 try:
    30     set # Only available in Python 2.4+
    31 except NameError:
    32     from sets import Set as set # Python 2.3 fallback
     29import __builtin__
     30if not hasattr(__builtin__, 'set'):
     31    from sets import Set as set   # Python 2.3 fallback
    3332
    3433try:
    3534    from decimal import Decimal
  • django/newforms/widgets.py

     
    22HTML Widget classes
    33"""
    44
    5 try:
    6     set # Only available in Python 2.4+
    7 except NameError:
    8     from sets import Set as set # Python 2.3 fallback
     5import __builtin__
     6if not hasattr(__builtin__, 'set'):
     7    from sets import Set as set   # Python 2.3 fallback
     8
    99from itertools import chain
    1010
    1111from django.utils.datastructures import MultiValueDict
  • django/template/defaulttags.py

     
    88import sys
    99import re
    1010
    11 if not hasattr(__builtins__, 'reversed'):
    12     # For Python 2.3.
     11import __builtin__
     12if not hasattr(__builtin__, 'reversed'):
     13    # Python 2.3 fallback.
    1314    # From http://www.python.org/doc/current/tut/node11.html
    1415    def reversed(data):
    1516        for index in xrange(len(data)-1, -1, -1):
Back to Top