Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removed comma splices in max_length DeprecationWarning and elsewhere …

…in the module

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6872 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 72a5c03dee783d20817d54bb7ee9566b1ea66296 1 parent 0c8f8f2
Adrian Holovaty authored December 04, 2007

Showing 1 changed file with 8 additions and 10 deletions. Show diff stats Hide diff stats

  1. 18  django/utils/maxlength.py
18  django/utils/maxlength.py
... ...
@@ -1,6 +1,6 @@
1 1
 """
2 2
 Utilities for providing backwards compatibility for the maxlength argument,
3  
-which has been replaced by max_length, see ticket #2101.
  3
+which has been replaced by max_length. See ticket #2101.
4 4
 """
5 5
 
6 6
 from warnings import warn
@@ -15,17 +15,15 @@ def legacy_maxlength(max_length, maxlength):
15 15
     """
16 16
     Consolidates max_length and maxlength, providing backwards compatibilty
17 17
     for the legacy "maxlength" argument.
  18
+
18 19
     If one of max_length or maxlength is given, then that value is returned.
19  
-    If both are given, a TypeError is raised.
20  
-    If maxlength is used at all, a deprecation warning is issued.
  20
+    If both are given, a TypeError is raised. If maxlength is used at all, a
  21
+    deprecation warning is issued.
21 22
     """
22 23
     if maxlength is not None:
23  
-        warn("maxlength is deprecated, use max_length instead.",
24  
-             DeprecationWarning,
25  
-             stacklevel=3)
  24
+        warn("maxlength is deprecated. Use max_length instead.", DeprecationWarning, stacklevel=3)
26 25
         if max_length is not None:
27  
-            raise TypeError("field can not take both the max_length"
28  
-                            " argument and the legacy maxlength argument.")
  26
+            raise TypeError("Field cannot take both the max_length argument and the legacy maxlength argument.")
29 27
         max_length = maxlength
30 28
     return max_length
31 29
 
@@ -33,7 +31,8 @@ def remove_maxlength(func):
33 31
     """
34 32
     A decorator to be used on a class's __init__ that provides backwards
35 33
     compatibilty for the legacy "maxlength" keyword argument, i.e.
36  
-      name = models.CharField(maxlength=20)
  34
+        name = models.CharField(maxlength=20)
  35
+
37 36
     It does this by changing the passed "maxlength" keyword argument
38 37
     (if it exists) into a "max_length" keyword argument.
39 38
     """
@@ -58,7 +57,6 @@ class LegacyMaxlength(type):
58 57
     Metaclass for providing backwards compatibility support for the
59 58
     "maxlength" keyword argument.
60 59
     """
61  
-
62 60
     def __init__(cls, name, bases, attrs):
63 61
         super(LegacyMaxlength, cls).__init__(name, bases, attrs)
64 62
         # Decorate the class's __init__ to remove any maxlength keyword.

0 notes on commit 72a5c03

Please sign in to comment.
Something went wrong with that request. Please try again.