Ticket #16584: 16584.diff
File 16584.diff, 20.7 KB (added by , 13 years ago) |
---|
-
django/http/__init__.py
282 282 283 283 def _get_upload_handlers(self): 284 284 if not self._upload_handlers: 285 # If th re are no upload handlers defined, initialize them from settings.285 # If there are no upload handlers defined, initialize them from settings. 286 286 self._initialize_handlers() 287 287 return self._upload_handlers 288 288 -
django/test/_doctest.py
552 552 ^ (?P<msg> \w+ .*) # a line *starts* with alphanum. 553 553 """, re.VERBOSE | re.MULTILINE | re.DOTALL) 554 554 555 # A callable returning a true value if fits argument is a blank line555 # A callable returning a true value if its argument is a blank line 556 556 # or contains a single comment. 557 557 _IS_BLANK_OR_COMMENT = re.compile(r'^[ ]*(#.*)?$').match 558 558 -
django/conf/global_settings.py
13 13 TEMPLATE_DEBUG = False 14 14 15 15 # Whether the framework should propagate raw exceptions rather than catching 16 # them. This is useful under some testing si utations and should never be used16 # them. This is useful under some testing situations and should never be used 17 17 # on a live site. 18 18 DEBUG_PROPAGATE_EXCEPTIONS = False 19 19 … … 389 389 # Boolean that sets whether to add thousand separator when formatting numbers 390 390 USE_THOUSAND_SEPARATOR = False 391 391 392 # Number of digits that will be together, when split ing them by392 # Number of digits that will be together, when splitting them by 393 393 # THOUSAND_SEPARATOR. 0 means no grouping, 3 means splitting by thousands... 394 394 NUMBER_GROUPING = 0 395 395 … … 506 506 # MESSAGES # 507 507 ############ 508 508 509 # Class to use as mess ges backend509 # Class to use as messages backend 510 510 MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage' 511 511 512 512 # Default values of MESSAGE_LEVEL and MESSAGE_TAGS are defined within -
django/db/models/deletion.py
217 217 self.data[model] = sorted(instances, key=attrgetter("pk")) 218 218 219 219 # if possible, bring the models in an order suitable for databases that 220 # don't support transactions or cannot defer con traint checks until the220 # don't support transactions or cannot defer constraint checks until the 221 221 # end of a transaction. 222 222 self.sort() 223 223 -
django/forms/formsets.py
213 213 return (1, 0) # +infinity, larger than any number 214 214 return (0, k[1]) 215 215 self._ordering.sort(key=compare_ordering_key) 216 # Return a list of form.cleaned_data dicts in the order sp cified by216 # Return a list of form.cleaned_data dicts in the order specified by 217 217 # the form data. 218 218 return [self.forms[i[0]] for i in self._ordering] 219 219 ordered_forms = property(_get_ordered_forms) -
django/forms/models.py
117 117 if exclude and f.name in exclude: 118 118 continue 119 119 if isinstance(f, ManyToManyField): 120 # If the object doesn't have a prim ry key yet, just use an empty120 # If the object doesn't have a primary key yet, just use an empty 121 121 # list for its m2m fields. Calling f.value_from_object will raise 122 122 # an exception. 123 123 if instance.pk is None: … … 288 288 # Exclude empty fields that are not required by the form, if the 289 289 # underlying model field is required. This keeps the model field 290 290 # from raising a required error. Note: don't exclude the field from 291 # validat on if the model field allows blanks. If it does, the blank291 # validation if the model field allows blanks. If it does, the blank 292 292 # value may be included in a unique check, so cannot be excluded 293 293 # from validation. 294 294 else: -
django/core/management/commands/syncdb.py
140 140 141 141 if verbosity >= 1: 142 142 print "Installing indexes ..." 143 # Install SQL indic ies for all newly created models143 # Install SQL indices for all newly created models 144 144 for app_name, model_list in manifest.items(): 145 145 for model in model_list: 146 146 if model in created_models: -
django/core/management/sql.py
11 11 12 12 if connection.settings_dict['ENGINE'] == 'django.db.backends.dummy': 13 13 # This must be the "dummy" database backend, which means the user 14 # hasn't set ENGINE for the datab se.14 # hasn't set ENGINE for the database. 15 15 raise CommandError("Django doesn't know which syntax to use for your SQL statements,\n" + 16 16 "because you haven't specified the ENGINE setting for the database.\n" + 17 17 "Edit your settings file and change DATBASES['default']['ENGINE'] to something like\n" + -
django/contrib/gis/db/backends/spatialite/operations.py
90 90 'contains' : SpatiaLiteFunction('Contains'), 91 91 'intersects' : SpatiaLiteFunction('Intersects'), 92 92 'relate' : (SpatiaLiteRelate, basestring), 93 # Ret runs true if B's bounding box completely contains A's bounding box.93 # Returns true if B's bounding box completely contains A's bounding box. 94 94 'contained' : SpatiaLiteFunction('MbrWithin'), 95 95 # Returns true if A's bounding box completely contains B's bounding box. 96 96 'bbcontains' : SpatiaLiteFunction('MbrContains'), -
django/contrib/gis/db/backends/postgis/operations.py
536 536 op = op(self.geom_func_prefix, value[1]) 537 537 elif lookup_type in self.distance_functions and lookup_type != 'dwithin': 538 538 if not field.geography and field.geodetic(self.connection): 539 # Geodetic distances are only avail ble from Points to539 # Geodetic distances are only available from Points to 540 540 # PointFields on PostGIS 1.4 and below. 541 541 if not self.connection.ops.geography: 542 542 if field.geom_type != 'POINT': -
django/contrib/gis/geos/prototypes/io.py
207 207 thread_context = ThreadLocalIO() 208 208 209 209 # These module-level routines return the I/O object that is local to the 210 # th e thread.If the I/O object does not exist yet it will be initialized.210 # thread. If the I/O object does not exist yet it will be initialized. 211 211 def wkt_r(): 212 212 if not thread_context.wkt_r: 213 213 thread_context.wkt_r = _WKTReader() -
django/contrib/gis/maps/google/zoom.py
41 41 # Getting the degrees and radians per pixel, and the 1/2 the number of 42 42 # for every zoom level. 43 43 self._degpp.append(z / 360.) # degrees per pixel 44 self._radpp.append(z / (2 * pi)) # radians per pix l44 self._radpp.append(z / (2 * pi)) # radians per pixel 45 45 self._npix.append(z / 2) # number of pixels to center of tile 46 46 47 47 # Multiplying `z` by 2 for the next iteration. -
django/contrib/gis/tests/relatedapp/tests.py
130 130 131 131 # Now creating a second Parcel where the borders are the same, just 132 132 # in different coordinate systems. The center points are also the 133 # thesame (but in different coordinate systems), and this time they133 # same (but in different coordinate systems), and this time they 134 134 # actually correspond to the centroid of the border. 135 135 c1 = b1.centroid 136 136 c2 = c1.transform(2276, clone=True) -
django/contrib/gis/tests/geoapp/tests.py
671 671 '12.40500 43.94833,12.40889 43.95499,12.41580 43.95795)))') 672 672 sm = Country.objects.create(name='San Marino', mpoly=fromstr(wkt)) 673 673 674 # Because floating-point arithm itic isn't exact, we set a tolerance674 # Because floating-point arithmetic isn't exact, we set a tolerance 675 675 # to pass into GEOS `equals_exact`. 676 676 tol = 0.000000001 677 677 -
django/contrib/gis/gdal/envelope.py
50 50 else: 51 51 raise TypeError('Incorrect type of argument: %s' % str(type(args[0]))) 52 52 elif len(args) == 4: 53 # Individ iual parameters passed in.53 # Individual parameters passed in. 54 54 # Thanks to ww for the help 55 55 self._from_sequence(map(float, args)) 56 56 else: … … 125 125 # An x and an y parameter were passed in 126 126 return self.expand_to_include((args[0], args[1], args[0], args[1])) 127 127 elif len(args) == 4: 128 # Individ iual parameters passed in.128 # Individual parameters passed in. 129 129 return self.expand_to_include(args) 130 130 else: 131 131 raise OGRException('Incorrect number (%d) of arguments.' % len(args[0])) -
django/contrib/formtools/wizard/views.py
152 152 # if not, add the form with a zero based counter as unicode 153 153 init_form_list[unicode(i)] = form 154 154 155 # walk through the ne created list of forms155 # walk through the new created list of forms 156 156 for form in init_form_list.itervalues(): 157 157 if issubclass(form, formsets.BaseFormSet): 158 158 # if the element is based on BaseFormSet (FormSet/ModelFormSet) -
django/contrib/comments/views/moderation.py
87 87 ) 88 88 89 89 # The following functions actually perform the various flag/aprove/delete 90 # actions. They've been broken out into sep erate functions to that they90 # actions. They've been broken out into separate functions to that they 91 91 # may be called from admin actions. 92 92 93 93 def perform_flag(request, comment): -
django/contrib/comments/views/comments.py
87 87 # preview templates, so we have to preserve that format. 88 88 "comments/%s_%s_preview.html" % (model._meta.app_label, model._meta.module_name), 89 89 "comments/%s_preview.html" % model._meta.app_label, 90 # Now the usual directory based template h eirarchy.90 # Now the usual directory based template hierarchy. 91 91 "comments/%s/%s/preview.html" % (model._meta.app_label, model._meta.module_name), 92 92 "comments/%s/preview.html" % model._meta.app_label, 93 93 "comments/preview.html", -
django/contrib/localflavor/cz/forms.py
134 134 # remainder is equal: 135 135 # 0 or 10: last digit is 1 136 136 # 1: last digit is 0 137 # in other case, last digi nis 11 - remainder137 # in other case, last digit is 11 - remainder 138 138 139 139 if (not remainder % 10 and check == 1) or \ 140 140 (remainder == 1 and check == 0) or \ -
django/middleware/gzip.py
22 22 if response.has_header('Content-Encoding'): 23 23 return response 24 24 25 # MSIE have issues with gzipped respon esof various content types.25 # MSIE have issues with gzipped response of various content types. 26 26 if "msie" in request.META.get('HTTP_USER_AGENT', '').lower(): 27 27 ctype = response.get('Content-Type', '').lower() 28 28 if not ctype.startswith("text/") or "javascript" in ctype: -
tests/modeltests/unmanaged_models/models.py
5 5 6 6 from django.db import models 7 7 8 # All of these models are creat d in the database by Django.8 # All of these models are created in the database by Django. 9 9 10 10 class A01(models.Model): 11 11 f_a = models.CharField(max_length=10, db_index=True) -
tests/modeltests/lookup/tests.py
251 251 def test_values_list(self): 252 252 # values_list() is similar to values(), except that the results are 253 253 # returned as a list of tuples, rather than a list of dictionaries. 254 # Within each tuple, the order of the elem nts is the same as the order254 # Within each tuple, the order of the elements is the same as the order 255 255 # of fields in the values_list() call. 256 256 identity = lambda x:x 257 257 self.assertQuerysetEqual(Article.objects.values_list('headline'), -
tests/regressiontests/cache/tests.py
220 220 self.assertEqual(self.cache.has_key("goodbye1"), False) 221 221 222 222 def test_in(self): 223 # The in operator can be used to inspe t cache contents223 # The in operator can be used to inspect cache contents 224 224 self.cache.set("hello2", "goodbye2") 225 225 self.assertEqual("hello2" in self.cache, True) 226 226 self.assertEqual("goodbye2" in self.cache, False) … … 338 338 self.assertEqual(self.cache.get(key), value) 339 339 340 340 def test_binary_string(self): 341 # Binary strings should be cach able341 # Binary strings should be cacheable 342 342 from zlib import compress, decompress 343 343 value = 'value_to_be_compressed' 344 344 compressed_value = compress(value) -
tests/regressiontests/admin_widgets/tests.py
274 274 ) 275 275 276 276 def test_fk_related_model_not_in_admin(self): 277 # FK to a model not registered with admin site. Raw ID widget shou d277 # FK to a model not registered with admin site. Raw ID widget should 278 278 # have no magnifying glass link. See #16542 279 279 big_honeycomb = models.Honeycomb.objects.create(location='Old tree') 280 280 big_honeycomb.bee_set.create() … … 287 287 ) 288 288 289 289 def test_fk_to_self_model_not_in_admin(self): 290 # FK to self, not registered with admin site. Raw ID widget shou d have290 # FK to self, not registered with admin site. Raw ID widget should have 291 291 # no magnifying glass link. See #16542 292 292 subject1 = models.Individual.objects.create(name='Subject #1') 293 293 models.Individual.objects.create(name='Child', parent=subject1) … … 345 345 346 346 def test_m2m_related_model_not_in_admin(self): 347 347 # M2M relationship with model not registered with admin site. Raw ID 348 # widget shou d have no magnifying glass link. See #16542348 # widget should have no magnifying glass link. See #16542 349 349 consultor1 = models.Advisor.objects.create(name='Rockstar Techie') 350 350 351 351 c1 = models.Company.objects.create(name='Doodle') -
tests/regressiontests/multiple_database/tests.py
1085 1085 self.assertEqual(list(pro.authors.values_list('name', flat=True)), [u'Marty Alchin']) 1086 1086 self.assertEqual(pro.editor.name, u'Marty Alchin') 1087 1087 1088 # get_or_create is a special case. The get needs to be target ted at1088 # get_or_create is a special case. The get needs to be targeted at 1089 1089 # the write database in order to avoid potential transaction 1090 1090 # consistency problems 1091 1091 book, created = Book.objects.get_or_create(title="Pro Django") -
tests/regressiontests/aggregation_regress/tests.py
644 644 ) 645 645 646 646 # Regression for #10766 - Shouldn't be able to reference an aggregate 647 # fields in an a n aggregate() call.647 # fields in an aggregate() call. 648 648 self.assertRaises( 649 649 FieldError, 650 650 lambda: Book.objects.annotate(mean_age=Avg('authors__age')).annotate(Avg('mean_age')) -
tests/regressiontests/generic_views/dates.py
339 339 self.assertEqual(list(res.context['book_list']), [b]) 340 340 self.assertEqual(res.context['day'], future) 341 341 342 # allow_future but not allow_empty, next/prev amust be valid342 # allow_future but not allow_empty, next/prev must be valid 343 343 self.assertEqual(res.context['next_day'], None) 344 344 self.assertEqual(res.context['previous_day'], datetime.date(2008, 10, 1)) 345 345 -
extras/csrf_migration_helper.py
43 43 # 44 44 # - It's impossible to programmatically determine which forms should and should 45 45 # not have the token added. The developer must decide when to do this, 46 # ensuring that the token is only added to internally target ted forms.46 # ensuring that the token is only added to internally targeted forms. 47 47 # 48 48 # - It's impossible to programmatically work out when a template is used. The 49 49 # attempts to trace back to view functions are guesses, and could easily fail