Ticket #7316: localflavor_r7554.diff

File localflavor_r7554.diff, 20.9 KB (added by Manuel Saelices, 16 years ago)

Patch that fixes problem.

  • django/contrib/localflavor/uk/uk_regions.py

     
    55    Welsh regions: http://en.wikipedia.org/wiki/Preserved_counties_of_Wales
    66    Scottish regions: http://en.wikipedia.org/wiki/Regions_and_districts_of_Scotland
    77"""
    8 from django.utils.translation import ugettext as _
     8from django.utils.translation import ugettext_lazy as _
    99
    1010ENGLAND_REGION_CHOICES = (
    1111    ("Bedfordshire", _("Bedfordshire")),
  • django/contrib/localflavor/uk/forms.py

     
    66
    77from django.newforms.fields import CharField, Select
    88from django.newforms import ValidationError
    9 from django.utils.translation import ugettext
     9from django.utils.translation import ugettext_lazy as _
    1010
    1111class UKPostcodeField(CharField):
    1212    """
     
    1818    The value is uppercased and a space added in the correct place, if required.
    1919    """
    2020    default_error_messages = {
    21         'invalid': ugettext(u'Enter a valid postcode.'),
     21        'invalid': _(u'Enter a valid postcode.'),
    2222    }
    2323    outcode_pattern = '[A-PR-UWYZ]([0-9]{1,2}|([A-HIK-Y][0-9](|[0-9]|[ABEHMNPRVWXY]))|[0-9][A-HJKSTUW])'
    2424    incode_pattern = '[0-9][ABD-HJLNP-UW-Z]{2}'
  • django/contrib/localflavor/ca/forms.py

     
    55from django.newforms import ValidationError
    66from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
    77from django.newforms.util import smart_unicode
    8 from django.utils.translation import gettext, ugettext
     8from django.utils.translation import ugettext_lazy as _
    99import re
    1010
    1111phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$')
     
    1414class CAPostalCodeField(RegexField):
    1515    """Canadian postal code field."""
    1616    default_error_messages = {
    17         'invalid': gettext(u'Enter a postal code in the format XXX XXX.'),
     17        'invalid': _(u'Enter a postal code in the format XXX XXX.'),
    1818    }
    1919
    2020    def __init__(self, *args, **kwargs):
     
    8585             See: http://en.wikipedia.org/wiki/Social_Insurance_Number
    8686    """
    8787    default_error_messages = {
    88         'invalid': ugettext('Enter a valid Canadian Social Insurance number in XXX-XXX-XXX format.'),
     88        'invalid': _('Enter a valid Canadian Social Insurance number in XXX-XXX-XXX format.'),
    8989    }
    9090
    9191    def clean(self, value):
  • django/contrib/localflavor/us/forms.py

     
    55from django.newforms import ValidationError
    66from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
    77from django.utils.encoding import smart_unicode
    8 from django.utils.translation import ugettext
     8from django.utils.translation import ugettext_lazy as _
    99import re
    1010
    1111phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$')
     
    1313
    1414class USZipCodeField(RegexField):
    1515    default_error_messages = {
    16         'invalid': ugettext('Enter a zip code in the format XXXXX or XXXXX-XXXX.'),
     16        'invalid': _('Enter a zip code in the format XXXXX or XXXXX-XXXX.'),
    1717    }
    1818
    1919    def __init__(self, *args, **kwargs):
     
    5151          1962 promotional number).
    5252    """
    5353    default_error_messages = {
    54         'invalid': ugettext('Enter a valid U.S. Social Security number in XXX-XX-XXXX format.'),
     54        'invalid': _('Enter a valid U.S. Social Security number in XXX-XX-XXXX format.'),
    5555    }
    5656
    5757    def clean(self, value):
  • django/contrib/localflavor/de/forms.py

     
    44
    55from django.newforms import ValidationError
    66from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
    7 from django.utils.translation import ugettext
     7from django.utils.translation import ugettext_lazy as _
    88import re
    99
    1010id_re = re.compile(r"^(?P<residence>\d{10})(?P<origin>\w{1,3})[-\ ]?(?P<birthday>\d{7})[-\ ]?(?P<validity>\d{7})[-\ ]?(?P<checksum>\d{1})$")
    1111
    1212class DEZipCodeField(RegexField):
    1313    default_error_messages = {
    14         'invalid': ugettext('Enter a zip code in the format XXXXX.'),
     14        'invalid': _('Enter a zip code in the format XXXXX.'),
    1515    }
    1616    def __init__(self, *args, **kwargs):
    1717        super(DEZipCodeField, self).__init__(r'^\d{5}$',
     
    3838    Algorithm is documented at http://de.wikipedia.org/wiki/Personalausweis
    3939    """
    4040    default_error_messages = {
    41         'invalid': ugettext('Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.'),
     41        'invalid': _('Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.'),
    4242    }
    4343
    4444    def has_valid_checksum(self, number):
  • django/contrib/localflavor/ch/forms.py

     
    55from django.newforms import ValidationError
    66from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
    77from django.utils.encoding import smart_unicode
    8 from django.utils.translation import ugettext
     8from django.utils.translation import ugettext_lazy as _
    99import re
    1010
    1111id_re = re.compile(r"^(?P<idnumber>\w{8})(?P<pos9>(\d{1}|<))(?P<checksum>\d{1})$")
     
    1313
    1414class CHZipCodeField(RegexField):
    1515    default_error_messages = {
    16         'invalid': ugettext('Enter a zip code in the format XXXX.'),
     16        'invalid': _('Enter a zip code in the format XXXX.'),
    1717    }
    1818
    1919    def __init__(self, *args, **kwargs):
     
    6161    Algorithm is documented at http://adi.kousz.ch/artikel/IDCHE.htm
    6262    """
    6363    default_error_messages = {
    64         'invalid': ugettext('Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.'),
     64        'invalid': _('Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.'),
    6565    }
    6666
    6767    def has_valid_checksum(self, number):
  • django/contrib/localflavor/fi/forms.py

     
    55import re
    66from django.newforms import ValidationError
    77from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
    8 from django.utils.translation import ugettext
     8from django.utils.translation import ugettext_lazy as _
    99
    1010class FIZipCodeField(RegexField):
    1111    default_error_messages = {
    12         'invalid': ugettext('Enter a zip code in the format XXXXX.'),
     12        'invalid': _('Enter a zip code in the format XXXXX.'),
    1313    }
    1414    def __init__(self, *args, **kwargs):
    1515        super(FIZipCodeField, self).__init__(r'^\d{5}$',
     
    2525
    2626class FISocialSecurityNumber(Field):
    2727    default_error_messages = {
    28         'invalid': ugettext('Enter a valid Finnish social security number.'),
     28        'invalid': _('Enter a valid Finnish social security number.'),
    2929    }
    3030
    3131    def clean(self, value):
  • django/contrib/localflavor/cl/forms.py

     
    44
    55from django.newforms import ValidationError
    66from django.newforms.fields import RegexField, Select, EMPTY_VALUES
    7 from django.utils.translation import ugettext
     7from django.utils.translation import ugettext_lazy as _
    88from django.utils.encoding import smart_unicode
    99
    1010
     
    2626    https://palena.sii.cl/cvc/dte/ee_empresas_emisoras.html
    2727    """
    2828    default_error_messages = {
    29         'invalid': ugettext('Enter a valid Chilean RUT.'),
    30         'strict': ugettext('Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.'),
    31         'checksum': ugettext('The Chilean RUT is not valid.'),
     29        'invalid': _('Enter a valid Chilean RUT.'),
     30        'strict': _('Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.'),
     31        'checksum': _('The Chilean RUT is not valid.'),
    3232    }
    3333
    3434    def __init__(self, *args, **kwargs):
  • django/contrib/localflavor/ar/forms.py

     
    66from django.newforms import ValidationError
    77from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES
    88from django.utils.encoding import smart_unicode
    9 from django.utils.translation import ugettext
     9from django.utils.translation import ugettext_lazy as _
    1010
    1111class ARProvinceSelect(Select):
    1212    """
     
    2424    See http://www.correoargentino.com.ar/consulta_cpa/home.php
    2525    """
    2626    default_error_messages = {
    27         'invalid': ugettext("Enter a postal code in the format NNNN or ANNNNAAA."),
     27        'invalid': _("Enter a postal code in the format NNNN or ANNNNAAA."),
    2828    }
    2929
    3030    def __init__(self, *args, **kwargs):
     
    4646    A field that validates 'Documento Nacional de Identidad' (DNI) numbers.
    4747    """
    4848    default_error_messages = {
    49         'invalid': ugettext("This field requires only numbers."),
    50         'max_digits': ugettext("This field requires 7 or 8 digits."),
     49        'invalid': _("This field requires only numbers."),
     50        'max_digits': _("This field requires 7 or 8 digits."),
    5151    }
    5252
    5353    def __init__(self, *args, **kwargs):
     
    7676    CUIT is of the form XX-XXXXXXXX-V. The last digit is a check digit.
    7777    """
    7878    default_error_messages = {
    79         'invalid': ugettext('Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format.'),
    80         'checksum': ugettext("Invalid CUIT."),
     79        'invalid': _('Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format.'),
     80        'checksum': _("Invalid CUIT."),
    8181    }
    8282
    8383    def __init__(self, *args, **kwargs):
  • django/contrib/localflavor/br/forms.py

     
    66from django.newforms import ValidationError
    77from django.newforms.fields import Field, RegexField, CharField, Select, EMPTY_VALUES
    88from django.utils.encoding import smart_unicode
    9 from django.utils.translation import ugettext as _
     9from django.utils.translation import ugettext_lazy as _
    1010import re
    1111
    1212try:
  • django/contrib/localflavor/pe/forms.py

     
    55
    66from django.newforms import ValidationError
    77from django.newforms.fields import RegexField, CharField, Select, EMPTY_VALUES
    8 from django.utils.translation import ugettext
     8from django.utils.translation import ugettext_lazy as _
    99
    1010class PEDepartmentSelect(Select):
    1111    """
     
    2020    A field that validates `Documento Nacional de IdentidadŽ (DNI) numbers.
    2121    """
    2222    default_error_messages = {
    23         'invalid': ugettext("This field requires only numbers."),
    24         'max_digits': ugettext("This field requires 8 digits."),
     23        'invalid': _("This field requires only numbers."),
     24        'max_digits': _("This field requires 8 digits."),
    2525    }
    2626
    2727    def __init__(self, *args, **kwargs):
     
    4848    the form XXXXXXXXXXX.
    4949    """
    5050    default_error_messages = {
    51         'invalid': ugettext("This field requires only numbers."),
    52         'max_digits': ugettext("This field requires 11 digits."),
     51        'invalid': _("This field requires only numbers."),
     52        'max_digits': _("This field requires 11 digits."),
    5353    }
    5454
    5555    def __init__(self, *args, **kwargs):
  • django/contrib/localflavor/au/forms.py

     
    55from django.newforms import ValidationError
    66from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
    77from django.newforms.util import smart_unicode
    8 from django.utils.translation import ugettext
     8from django.utils.translation import ugettext_lazy as _
    99import re
    1010
    1111PHONE_DIGITS_RE = re.compile(r'^(\d{10})$')
     
    1313class AUPostCodeField(RegexField):
    1414    """Australian post code field."""
    1515    default_error_messages = {
    16         'invalid': ugettext('Enter a 4 digit post code.'),
     16        'invalid': _('Enter a 4 digit post code.'),
    1717    }
    1818
    1919    def __init__(self, *args, **kwargs):
  • django/contrib/localflavor/es/forms.py

     
    55
    66from django.newforms import ValidationError
    77from django.newforms.fields import RegexField, Select, EMPTY_VALUES
    8 from django.utils.translation import ugettext as _
     8from django.utils.translation import ugettext_lazy as _
    99import re
    1010
    1111class ESPostalCodeField(RegexField):
  • django/contrib/localflavor/fr/forms.py

     
    55from django.newforms import ValidationError
    66from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
    77from django.utils.encoding import smart_unicode
    8 from django.utils.translation import ugettext
     8from django.utils.translation import ugettext_lazy as _
    99import re
    1010
    1111phone_digits_re = re.compile(r'^0\d(\s|\.)?(\d{2}(\s|\.)?){3}\d{2}$')
    1212
    1313class FRZipCodeField(RegexField):
    1414    default_error_messages = {
    15         'invalid': ugettext('Enter a zip code in the format XXXXX.'),
     15        'invalid': _('Enter a zip code in the format XXXXX.'),
    1616    }
    1717
    1818    def __init__(self, *args, **kwargs):
  • django/contrib/localflavor/nl/forms.py

     
    66
    77from django.newforms import ValidationError
    88from django.newforms.fields import Field, Select, EMPTY_VALUES
    9 from django.utils.translation import ugettext as _
     9from django.utils.translation import ugettext_lazy as _
    1010from django.utils.encoding import smart_unicode
    1111
    1212pc_re = re.compile('^\d{4}[A-Z]{2}$')
  • django/contrib/localflavor/jp/forms.py

     
    44
    55from django.core import validators
    66from django.newforms import ValidationError
    7 from django.utils.translation import ugettext
     7from django.utils.translation import ugettext_lazy as _
    88from django.newforms.fields import RegexField, Select
    99
    1010class JPPostalCodeField(RegexField):
     
    1414    Accepts 7 digits, with or without a hyphen.
    1515    """
    1616    default_error_messages = {
    17         'invalid': ugettext('Enter a postal code in the format XXXXXXX or XXX-XXXX.'),
     17        'invalid': _('Enter a postal code in the format XXXXXXX or XXX-XXXX.'),
    1818    }
    1919
    2020    def __init__(self, *args, **kwargs):
  • django/contrib/localflavor/is_/forms.py

     
    55from django.newforms import ValidationError
    66from django.newforms.fields import RegexField, EMPTY_VALUES
    77from django.newforms.widgets import Select
    8 from django.utils.translation import ugettext
     8from django.utils.translation import ugettext_lazy as _
    99from django.utils.encoding import smart_unicode
    1010
    1111class ISIdNumberField(RegexField):
     
    1414    of Iceland has.
    1515    """
    1616    default_error_messages = {
    17         'invalid': ugettext('Enter a valid Icelandic identification number. The format is XXXXXX-XXXX.'),
    18         'checksum': ugettext(u'The Icelandic identification number is not valid.'),
     17        'invalid': _('Enter a valid Icelandic identification number. The format is XXXXXX-XXXX.'),
     18        'checksum': _(u'The Icelandic identification number is not valid.'),
    1919    }
    2020
    2121    def __init__(self, *args, **kwargs):
  • django/contrib/localflavor/pl/forms.py

     
    66
    77from django.newforms import ValidationError
    88from django.newforms.fields import Select, RegexField
    9 from django.utils.translation import ugettext as _
     9from django.utils.translation import ugettext_lazy as _
    1010
    1111class PLVoivodeshipSelect(Select):
    1212    """
  • django/contrib/localflavor/no/forms.py

     
    55import re, datetime
    66from django.newforms import ValidationError
    77from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
    8 from django.utils.translation import ugettext
     8from django.utils.translation import ugettext_lazy as _
    99
    1010class NOZipCodeField(RegexField):
    1111    default_error_messages = {
    12         'invalid': ugettext('Enter a zip code in the format XXXX.'),
     12        'invalid': _('Enter a zip code in the format XXXX.'),
    1313    }
    1414
    1515    def __init__(self, *args, **kwargs):
     
    3030    Algorithm is documented at http://no.wikipedia.org/wiki/Personnummer
    3131    """
    3232    default_error_messages = {
    33         'invalid': ugettext(u'Enter a valid Norwegian social security number.'),
     33        'invalid': _(u'Enter a valid Norwegian social security number.'),
    3434    }
    3535
    3636    def clean(self, value):
  • django/contrib/localflavor/it/forms.py

     
    44
    55from django.newforms import ValidationError
    66from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
    7 from django.utils.translation import ugettext
     7from django.utils.translation import ugettext_lazy as _
    88from django.utils.encoding import smart_unicode
    99from django.contrib.localflavor.it.util import ssn_check_digit, vat_number_check_digit
    1010import re
    1111
    1212class ITZipCodeField(RegexField):
    1313    default_error_messages = {
    14         'invalid': ugettext('Enter a valid zip code.'),
     14        'invalid': _('Enter a valid zip code.'),
    1515    }
    1616    def __init__(self, *args, **kwargs):
    1717        super(ITZipCodeField, self).__init__(r'^\d{5}$',
     
    4040    'Informazioni sulla codificazione delle persone fisiche'.
    4141    """
    4242    default_error_messages = {
    43         'invalid': ugettext(u'Enter a valid Social Security number.'),
     43        'invalid': _(u'Enter a valid Social Security number.'),
    4444    }
    4545
    4646    def __init__(self, *args, **kwargs):
     
    6565    A form field that validates Italian VAT numbers (partita IVA).
    6666    """
    6767    default_error_messages = {
    68         'invalid': ugettext(u'Enter a valid VAT number.'),
     68        'invalid': _(u'Enter a valid VAT number.'),
    6969    }
    7070
    7171    def clean(self, value):
  • django/contrib/localflavor/sk/forms.py

     
    33"""
    44
    55from django.newforms.fields import Select, RegexField
    6 from django.utils.translation import ugettext
     6from django.utils.translation import ugettext_lazy as _
    77
    88class SKRegionSelect(Select):
    99    """
     
    2727    Valid form is XXXXX or XXX XX, where X represents integer.
    2828    """
    2929    default_error_messages = {
    30         'invalid': ugettext(u'Enter a postal code in the format XXXXX or XXX XX.'),
     30        'invalid': _(u'Enter a postal code in the format XXXXX or XXX XX.'),
    3131    }
    3232
    3333    def __init__(self, *args, **kwargs):
Back to Top