Django

Code

Changeset 6872

Show
Ignore:
Timestamp:
12/03/07 23:56:30 (7 months ago)
Author:
adrian
Message:

Removed comma splices in max_length DeprecationWarning? and elsewhere in the module

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/utils/maxlength.py

    r6825 r6872  
    11""" 
    22Utilities for providing backwards compatibility for the maxlength argument, 
    3 which has been replaced by max_length, see ticket #2101. 
     3which has been replaced by max_length. See ticket #2101. 
    44""" 
    55 
     
    1616    Consolidates max_length and maxlength, providing backwards compatibilty 
    1717    for the legacy "maxlength" argument. 
     18 
    1819    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. 
    2122    """ 
    2223    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) 
    2625        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.") 
    2927        max_length = maxlength 
    3028    return max_length 
     
    3432    A decorator to be used on a class's __init__ that provides backwards 
    3533    compatibilty for the legacy "maxlength" keyword argument, i.e. 
    36       name = models.CharField(maxlength=20) 
     34        name = models.CharField(maxlength=20) 
     35 
    3736    It does this by changing the passed "maxlength" keyword argument 
    3837    (if it exists) into a "max_length" keyword argument. 
     
    5958    "maxlength" keyword argument. 
    6059    """ 
    61  
    6260    def __init__(cls, name, bases, attrs): 
    6361        super(LegacyMaxlength, cls).__init__(name, bases, attrs)