Permalink
Browse files

Remove all relative imports. We have always been at war with relative…

… imports.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17009 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 66210cb commit 396fcaaef92b6e5e56175b883c2cf6fcbda7ae97 @alex alex committed Oct 18, 2011
Showing with 218 additions and 106 deletions.
  1. +5 −2 django/contrib/localflavor/ar/forms.py
  2. +5 −1 django/contrib/localflavor/au/forms.py
  3. +12 −8 django/contrib/localflavor/be/forms.py
  4. +6 −3 django/contrib/localflavor/br/forms.py
  5. +6 −3 django/contrib/localflavor/ca/forms.py
  6. +6 −2 django/contrib/localflavor/ch/forms.py
  7. +3 −1 django/contrib/localflavor/cl/forms.py
  8. +3 −1 django/contrib/localflavor/cn/forms.py
  9. +4 −1 django/contrib/localflavor/co/forms.py
  10. +6 −2 django/contrib/localflavor/cz/forms.py
  11. +6 −2 django/contrib/localflavor/de/forms.py
  12. +3 −1 django/contrib/localflavor/ec/forms.py
  13. +7 −3 django/contrib/localflavor/es/forms.py
  14. +5 −1 django/contrib/localflavor/fi/forms.py
  15. +5 −2 django/contrib/localflavor/fr/forms.py
  16. +4 −2 django/contrib/localflavor/gb/forms.py
  17. +8 −7 django/contrib/localflavor/hr/forms.py
  18. +4 −3 django/contrib/localflavor/id/forms.py
  19. +4 −1 django/contrib/localflavor/ie/forms.py
  20. +5 −2 django/contrib/localflavor/in_/forms.py
  21. +5 −2 django/contrib/localflavor/is_/forms.py
  22. +8 −4 django/contrib/localflavor/it/forms.py
  23. +5 −2 django/contrib/localflavor/jp/forms.py
  24. +3 −1 django/contrib/localflavor/mk/forms.py
  25. +5 −2 django/contrib/localflavor/nl/forms.py
  26. +5 −1 django/contrib/localflavor/no/forms.py
  27. +4 −1 django/contrib/localflavor/pe/forms.py
  28. +6 −3 django/contrib/localflavor/pl/forms.py
  29. +5 −2 django/contrib/localflavor/py/forms.py
  30. +4 −2 django/contrib/localflavor/ro/forms.py
  31. +4 −3 django/contrib/localflavor/ru/forms.py
  32. +17 −13 django/contrib/localflavor/se/forms.py
  33. +4 −3 django/contrib/localflavor/si/forms.py
  34. +5 −2 django/contrib/localflavor/sk/forms.py
  35. +6 −2 django/contrib/localflavor/tr/forms.py
  36. +4 −2 django/contrib/messages/__init__.py
  37. +5 −3 django/db/models/sql/__init__.py
  38. +6 −4 django/forms/__init__.py
  39. +3 −1 django/forms/extras/__init__.py
  40. +7 −5 django/http/__init__.py
@@ -3,18 +3,21 @@
AR-specific Form helpers.
"""
-from django.forms import ValidationError
+from __future__ import absolute_import
+
+from django.contrib.localflavor.ar.ar_provinces import PROVINCE_CHOICES
from django.core.validators import EMPTY_VALUES
+from django.forms import ValidationError
from django.forms.fields import RegexField, CharField, Select
from django.utils.translation import ugettext_lazy as _
+
class ARProvinceSelect(Select):
"""
A Select widget that uses a list of Argentinean provinces/autonomous cities
as its choices.
"""
def __init__(self, attrs=None):
- from ar_provinces import PROVINCE_CHOICES
super(ARProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES)
class ARPostalCodeField(RegexField):
@@ -1,14 +1,19 @@
"""
Australian-specific Form helpers
"""
+
+from __future__ import absolute_import
+
import re
+from django.contrib.localflavor.au.au_states import STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
+
PHONE_DIGITS_RE = re.compile(r'^(\d{10})$')
class AUPostCodeField(RegexField):
@@ -52,5 +57,4 @@ class AUStateSelect(Select):
choices.
"""
def __init__(self, attrs=None):
- from au_states import STATE_CHOICES
super(AUStateSelect, self).__init__(attrs, choices=STATE_CHOICES)
@@ -1,13 +1,19 @@
"""
Belgium-specific Form helpers
"""
+
+from __future__ import absolute_import
+
+from django.contrib.localflavor.be.be_provinces import PROVINCE_CHOICES
+from django.contrib.localflavor.be.be_regions import REGION_CHOICES
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
+
class BEPostalCodeField(RegexField):
"""
A form field that validates its input as a belgium postal code.
-
+
Belgium postal code is a 4 digits string. The first digit indicates
the province (except for the 3ddd numbers that are shared by the
eastern part of Flemish Brabant and Limburg and the and 1ddd that
@@ -28,14 +34,14 @@ class BEPhoneNumberField(RegexField):
A form field that validates its input as a belgium phone number.
Landlines have a seven-digit subscriber number and a one-digit area code,
- while smaller cities have a six-digit subscriber number and a two-digit
- area code. Cell phones have a six-digit subscriber number and a two-digit
+ while smaller cities have a six-digit subscriber number and a two-digit
+ area code. Cell phones have a six-digit subscriber number and a two-digit
area code preceeded by the number 4.
- 0d ddd dd dd, 0d/ddd.dd.dd, 0d.ddd.dd.dd,
+ 0d ddd dd dd, 0d/ddd.dd.dd, 0d.ddd.dd.dd,
0dddddddd - dialling a bigger city
- 0dd dd dd dd, 0dd/dd.dd.dd, 0dd.dd.dd.dd,
+ 0dd dd dd dd, 0dd/dd.dd.dd, 0dd.dd.dd.dd,
0dddddddd - dialling a smaller city
- 04dd ddd dd dd, 04dd/ddd.dd.dd,
+ 04dd ddd dd dd, 04dd/ddd.dd.dd,
04dd.ddd.dd.dd, 04ddddddddd - dialling a mobile number
"""
default_error_messages = {
@@ -55,13 +61,11 @@ class BERegionSelect(Select):
A Select widget that uses a list of belgium regions as its choices.
"""
def __init__(self, attrs=None):
- from be_regions import REGION_CHOICES
super(BERegionSelect, self).__init__(attrs, choices=REGION_CHOICES)
class BEProvinceSelect(Select):
"""
A Select widget that uses a list of belgium provinces as its choices.
"""
def __init__(self, attrs=None):
- from be_provinces import PROVINCE_CHOICES
super(BEProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES)
@@ -3,12 +3,17 @@
BR-specific Form helpers
"""
+from __future__ import absolute_import
+
+import re
+
+from django.contrib.localflavor.br.br_states import STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, CharField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
-import re
+
phone_digits_re = re.compile(r'^(\d{2})[-\.]?(\d{4})[-\.]?(\d{4})$')
@@ -42,7 +47,6 @@ class BRStateSelect(Select):
as its choices.
"""
def __init__(self, attrs=None):
- from br_states import STATE_CHOICES
super(BRStateSelect, self).__init__(attrs, choices=STATE_CHOICES)
class BRStateChoiceField(Field):
@@ -58,7 +62,6 @@ def __init__(self, required=True, widget=None, label=None,
initial=None, help_text=None):
super(BRStateChoiceField, self).__init__(required, widget, label,
initial, help_text)
- from br_states import STATE_CHOICES
self.widget.choices = STATE_CHOICES
def clean(self, value):
@@ -2,12 +2,17 @@
Canada-specific Form helpers
"""
+from __future__ import absolute_import
+
+import re
+
+from django.contrib.localflavor.ca.ca_provinces import PROVINCE_CHOICES, PROVINCES_NORMALIZED
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, CharField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
-import re
+
phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$')
sin_re = re.compile(r"^(\d{3})-(\d{3})-(\d{3})$")
@@ -66,7 +71,6 @@ class CAProvinceField(Field):
}
def clean(self, value):
- from ca_provinces import PROVINCES_NORMALIZED
super(CAProvinceField, self).clean(value)
if value in EMPTY_VALUES:
return u''
@@ -87,7 +91,6 @@ class CAProvinceSelect(Select):
territories as its choices.
"""
def __init__(self, attrs=None):
- from ca_provinces import PROVINCE_CHOICES # relative import
super(CAProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES)
class CASocialInsuranceNumberField(Field):
@@ -2,12 +2,17 @@
Swiss-specific Form helpers
"""
+from __future__ import absolute_import
+
+import re
+
+from django.contrib.localflavor.ch.ch_states import STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
-import re
+
id_re = re.compile(r"^(?P<idnumber>\w{8})(?P<pos9>(\d{1}|<))(?P<checksum>\d{1})$")
phone_digits_re = re.compile(r'^0([1-9]{1})\d{8}$')
@@ -47,7 +52,6 @@ class CHStateSelect(Select):
A Select widget that uses a list of CH states as its choices.
"""
def __init__(self, attrs=None):
- from ch_states import STATE_CHOICES # relative import
super(CHStateSelect, self).__init__(attrs, choices=STATE_CHOICES)
class CHIdentityCardNumberField(Field):
@@ -2,6 +2,9 @@
Chile specific form helpers.
"""
+from __future__ import absolute_import
+
+from django.contrib.localflavor.cl.cl_regions import REGION_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
@@ -15,7 +18,6 @@ class CLRegionSelect(Select):
as its choices.
"""
def __init__(self, attrs=None):
- from cl_regions import REGION_CHOICES
super(CLRegionSelect, self).__init__(attrs, choices=REGION_CHOICES)
class CLRutField(RegexField):
@@ -3,8 +3,11 @@
"""
Chinese-specific form helpers
"""
+from __future__ import absolute_import
+
import re
+from django.contrib.localflavor.cn.cn_provinces import CN_PROVINCE_CHOICES
from django.forms import ValidationError
from django.forms.fields import CharField, RegexField, Select
from django.utils.translation import ugettext_lazy as _
@@ -67,7 +70,6 @@ class CNProvinceSelect(Select):
A select widget with list of Chinese provinces as choices.
"""
def __init__(self, attrs=None):
- from cn_provinces import CN_PROVINCE_CHOICES
super(CNProvinceSelect, self).__init__(
attrs, choices=CN_PROVINCE_CHOICES,
)
@@ -2,12 +2,15 @@
Colombian-specific form helpers.
"""
+from __future__ import absolute_import
+
+from django.contrib.localflavor.co.co_departments import DEPARTMENT_CHOICES
from django.forms.fields import Select
+
class CODepartmentSelect(Select):
"""
A Select widget that uses a list of Colombian states as its choices.
"""
def __init__(self, attrs=None):
- from co_departments import DEPARTMENT_CHOICES
super(CODepartmentSelect, self).__init__(attrs, choices=DEPARTMENT_CHOICES)
@@ -2,11 +2,16 @@
Czech-specific form helpers
"""
+from __future__ import absolute_import
+
+import re
+
+from django.contrib.localflavor.cz.cz_regions import REGION_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Select, RegexField, Field
from django.utils.translation import ugettext_lazy as _
-import re
+
birth_number = re.compile(r'^(?P<birth>\d{6})/?(?P<id>\d{3,4})$')
ic_number = re.compile(r'^(?P<number>\d{7})(?P<check>\d)$')
@@ -16,7 +21,6 @@ class CZRegionSelect(Select):
A select widget widget with list of Czech regions as choices.
"""
def __init__(self, attrs=None):
- from cz_regions import REGION_CHOICES
super(CZRegionSelect, self).__init__(attrs, choices=REGION_CHOICES)
class CZPostalCodeField(RegexField):
@@ -2,11 +2,16 @@
DE-specific Form helpers
"""
+from __future__ import absolute_import
+
+import re
+
+from django.contrib.localflavor.de.de_states import STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
-import re
+
id_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})$")
@@ -23,7 +28,6 @@ class DEStateSelect(Select):
A Select widget that uses a list of DE states as its choices.
"""
def __init__(self, attrs=None):
- from de_states import STATE_CHOICES
super(DEStateSelect, self).__init__(attrs, choices=STATE_CHOICES)
class DEIdentityCardNumberField(Field):
@@ -2,12 +2,14 @@
Ecuador-specific form helpers.
"""
+from __future__ import absolute_import
+
+from django.contrib.localflavor.ec.ec_provinces import PROVINCE_CHOICES
from django.forms.fields import Select
class ECProvinceSelect(Select):
"""
A Select widget that uses a list of Ecuador provinces as its choices.
"""
def __init__(self, attrs=None):
- from ec_provinces import PROVINCE_CHOICES
super(ECProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES)
@@ -3,11 +3,17 @@
Spanish-specific Form helpers
"""
+from __future__ import absolute_import
+
+import re
+
+from django.contrib.localflavor.es.es_provinces import PROVINCE_CHOICES
+from django.contrib.localflavor.es.es_regions import REGION_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
-import re
+
class ESPostalCodeField(RegexField):
"""
@@ -166,15 +172,13 @@ class ESRegionSelect(Select):
A Select widget that uses a list of spanish regions as its choices.
"""
def __init__(self, attrs=None):
- from es_regions import REGION_CHOICES
super(ESRegionSelect, self).__init__(attrs, choices=REGION_CHOICES)
class ESProvinceSelect(Select):
"""
A Select widget that uses a list of spanish provinces as its choices.
"""
def __init__(self, attrs=None):
- from es_provinces import PROVINCE_CHOICES
super(ESProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES)
@@ -2,12 +2,17 @@
FI-specific Form helpers
"""
+from __future__ import absolute_import
+
import re
+
+from django.contrib.localflavor.fi.fi_municipalities import MUNICIPALITY_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
+
class FIZipCodeField(RegexField):
default_error_messages = {
'invalid': _('Enter a zip code in the format XXXXX.'),
@@ -21,7 +26,6 @@ class FIMunicipalitySelect(Select):
A Select widget that uses a list of Finnish municipalities as its choices.
"""
def __init__(self, attrs=None):
- from fi_municipalities import MUNICIPALITY_CHOICES
super(FIMunicipalitySelect, self).__init__(attrs, choices=MUNICIPALITY_CHOICES)
class FISocialSecurityNumber(Field):
Oops, something went wrong. Retry.

0 comments on commit 396fcaa

Please sign in to comment.