Ticket #4607: fallback_try_except.patch
File fallback_try_except.patch, 6.2 KB (added by , 17 years ago) |
---|
-
django/contrib/admin/views/main.py
14 14 from django.utils.text import capfirst, get_text_list 15 15 import operator 16 16 17 try: 18 set 19 except NameError: 20 from sets import Set as set # Python 2.3 fallback 21 17 22 from django.contrib.admin.models import LogEntry, ADDITION, CHANGE, DELETION 18 23 if not LogEntry._meta.installed: 19 24 raise ImproperlyConfigured, "You'll need to put 'django.contrib.admin' in your INSTALLED_APPS setting before you can use the admin application." … … 489 494 perms_needed.add(related.opts.verbose_name) 490 495 491 496 def delete_stage(request, app_label, model_name, object_id): 492 import sets493 497 model = models.get_model(app_label, model_name) 494 498 object_id = unquote(object_id) 495 499 if model is None: … … 502 506 # Populate deleted_objects, a data structure of all related objects that 503 507 # will also be deleted. 504 508 deleted_objects = ['%s: <a href="../../%s/">%s</a>' % (capfirst(opts.verbose_name), object_id, escape(str(obj))), []] 505 perms_needed = set s.Set()509 perms_needed = set() 506 510 _get_deleted_objects(deleted_objects, perms_needed, request.user, obj, opts, 1) 507 511 508 512 if request.POST: # The user has already confirmed the deletion. -
django/contrib/auth/models.py
5 5 from django.utils.translation import gettext_lazy as _ 6 6 import datetime 7 7 8 try: 9 set 10 except NameError: 11 from sets import Set as set # Python 2.3 fallback 12 8 13 def check_password(raw_password, enc_password): 9 14 """ 10 15 Returns a boolean of whether the raw_password was correct. Handles … … 175 180 def get_group_permissions(self): 176 181 "Returns a list of permission strings that this user has through his/her groups." 177 182 if not hasattr(self, '_group_perm_cache'): 178 import sets179 183 cursor = connection.cursor() 180 184 # The SQL below works out to the following, after DB quoting: 181 185 # cursor.execute(""" … … 200 204 backend.quote_name('id'), backend.quote_name('content_type_id'), 201 205 backend.quote_name('user_id'),) 202 206 cursor.execute(sql, [self.id]) 203 self._group_perm_cache = set s.Set(["%s.%s" % (row[0], row[1]) for row in cursor.fetchall()])207 self._group_perm_cache = set(["%s.%s" % (row[0], row[1]) for row in cursor.fetchall()]) 204 208 return self._group_perm_cache 205 209 206 210 def get_all_permissions(self): 207 211 if not hasattr(self, '_perm_cache'): 208 212 import sets 209 self._perm_cache = set s.Set(["%s.%s" % (p.content_type.app_label, p.codename) for p in self.user_permissions.select_related()])213 self._perm_cache = set(["%s.%s" % (p.content_type.app_label, p.codename) for p in self.user_permissions.select_related()]) 210 214 self._perm_cache.update(self.get_group_permissions()) 211 215 return self._perm_cache 212 216 -
django/core/management.py
7 7 from django.utils import termcolors 8 8 import os, re, shutil, sys, textwrap 9 9 10 # For Python 2.3 11 if not hasattr(__builtins__, 'set'): 12 from sets import Set as set 10 try: 11 set 12 except NameError: 13 from sets import Set as set # Python 2.3 fallback 13 14 14 15 # For backwards compatibility: get_version() used to be in this module. 15 16 get_version = django.get_version -
django/db/models/fields/related.py
10 10 from django import newforms as forms 11 11 from django.dispatch import dispatcher 12 12 13 # For Python 2.3 14 if not hasattr(__builtins__, 'set'): 15 from sets import Set as set 13 try: 14 set 15 except NameError: 16 from sets import Set as set # Python 2.3 fallback 16 17 17 18 # Values for Relation.edit_inline. 18 19 TABULAR, STACKED = 1, 2 -
django/db/models/query.py
7 7 import operator 8 8 import re 9 9 10 # For Python 2.3 11 if not hasattr(__builtins__, 'set'): 12 from sets import Set as set 10 try: 11 set 12 except NameError: 13 from sets import Set as set # Python 2.3 fallback 13 14 14 15 # The string constant used to separate query parts 15 16 LOOKUP_SEPARATOR = '__' -
django/newforms/fields.py
27 27 EMPTY_VALUES = (None, '') 28 28 29 29 try: 30 set # Only available in Python 2.4+30 set 31 31 except NameError: 32 from sets import Set as set # Python 2.3 fallback32 from sets import Set as set # Python 2.3 fallback 33 33 34 34 try: 35 35 from decimal import Decimal -
django/newforms/widgets.py
3 3 """ 4 4 5 5 try: 6 set # Only available in Python 2.4+6 set 7 7 except NameError: 8 from sets import Set as set # Python 2.3 fallback 8 from sets import Set as set # Python 2.3 fallback 9 9 10 from itertools import chain 10 11 11 12 from django.utils.datastructures import MultiValueDict -
django/template/defaulttags.py
8 8 import sys 9 9 import re 10 10 11 if not hasattr(__builtins__, 'reversed'): 12 # For Python 2.3. 11 try: 12 reversed 13 except NameError: 14 # Python 2.3 fallback. 13 15 # From http://www.python.org/doc/current/tut/node11.html 14 16 def reversed(data): 15 17 for index in xrange(len(data)-1, -1, -1):