Fixed all E261 warnings

This commit is contained in:
coagulant 2013-11-03 01:02:56 +04:00 committed by Jason Myers
parent c3791463a5
commit 8eec2d93b6
152 changed files with 630 additions and 630 deletions

View File

@ -36,7 +36,7 @@ class LazySettings(LazyObject):
""" """
try: try:
settings_module = os.environ[ENVIRONMENT_VARIABLE] settings_module = os.environ[ENVIRONMENT_VARIABLE]
if not settings_module: # If it's set but is an empty string. if not settings_module: # If it's set but is an empty string.
raise KeyError raise KeyError
except KeyError: except KeyError:
desc = ("setting %s" % name) if name else "settings" desc = ("setting %s" % name) if name else "settings"

View File

@ -302,7 +302,7 @@ FILE_UPLOAD_HANDLERS = (
# Maximum size, in bytes, of a request before it will be streamed to the # Maximum size, in bytes, of a request before it will be streamed to the
# file system instead of into memory. # file system instead of into memory.
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440 # i.e. 2.5 MB FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440 # i.e. 2.5 MB
# Directory in which upload streamed files will be temporarily saved. A value of # Directory in which upload streamed files will be temporarily saved. A value of
# `None` will make Django use the operating system's default temporary directory # `None` will make Django use the operating system's default temporary directory
@ -360,11 +360,11 @@ SHORT_DATETIME_FORMAT = 'm/d/Y P'
# http://docs.python.org/library/datetime.html#strftime-behavior # http://docs.python.org/library/datetime.html#strftime-behavior
# * Note that these format strings are different from the ones to display dates # * Note that these format strings are different from the ones to display dates
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06' '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
'%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006' '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006' '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
'%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006' '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'
'%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006' '%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006'
) )
# Default formats to be used when parsing times from input boxes, in order # Default formats to be used when parsing times from input boxes, in order

View File

@ -20,5 +20,5 @@ SHORT_DATE_FORMAT = 'd.m.Y'
# TIME_INPUT_FORMATS = # TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS = # DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = ' ' # Non-breaking space THOUSAND_SEPARATOR = ' ' # Non-breaking space
# NUMBER_GROUPING = # NUMBER_GROUPING =

View File

@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = r'F \d\e\l Y'
MONTH_DAY_FORMAT = r'j \d\e F' MONTH_DAY_FORMAT = r'j \d\e F'
SHORT_DATE_FORMAT = 'd/m/Y' SHORT_DATE_FORMAT = 'd/m/Y'
SHORT_DATETIME_FORMAT = 'd/m/Y G:i' SHORT_DATETIME_FORMAT = 'd/m/Y G:i'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior

View File

@ -12,34 +12,34 @@ YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F' MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATE_FORMAT = 'd.m.Y'
SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s' SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%d.%m.%Y', '%d.%m.%y', # '05.01.2006', '05.01.06' '%d.%m.%Y', '%d.%m.%y', # '05.01.2006', '05.01.06'
'%d. %m. %Y', '%d. %m. %y', # '5. 1. 2006', '5. 1. 06' '%d. %m. %Y', '%d. %m. %y', # '5. 1. 2006', '5. 1. 06'
# '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006' # '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006'
) )
# Kept ISO formats as one is in first position # Kept ISO formats as one is in first position
TIME_INPUT_FORMATS = ( TIME_INPUT_FORMATS = (
'%H:%M:%S', # '04:30:59' '%H:%M:%S', # '04:30:59'
'%H.%M', # '04.30' '%H.%M', # '04.30'
'%H:%M', # '04:30' '%H:%M', # '04:30'
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '05.01.2006 04:30:59' '%d.%m.%Y %H:%M:%S', # '05.01.2006 04:30:59'
'%d.%m.%Y %H:%M:%S.%f', # '05.01.2006 04:30:59.000200' '%d.%m.%Y %H:%M:%S.%f', # '05.01.2006 04:30:59.000200'
'%d.%m.%Y %H.%M', # '05.01.2006 04.30' '%d.%m.%Y %H.%M', # '05.01.2006 04.30'
'%d.%m.%Y %H:%M', # '05.01.2006 04:30' '%d.%m.%Y %H:%M', # '05.01.2006 04:30'
'%d.%m.%Y', # '05.01.2006' '%d.%m.%Y', # '05.01.2006'
'%d. %m. %Y %H:%M:%S', # '05. 01. 2006 04:30:59' '%d. %m. %Y %H:%M:%S', # '05. 01. 2006 04:30:59'
'%d. %m. %Y %H:%M:%S.%f', # '05. 01. 2006 04:30:59.000200' '%d. %m. %Y %H:%M:%S.%f', # '05. 01. 2006 04:30:59.000200'
'%d. %m. %Y %H.%M', # '05. 01. 2006 04.30' '%d. %m. %Y %H.%M', # '05. 01. 2006 04.30'
'%d. %m. %Y %H:%M', # '05. 01. 2006 04:30' '%d. %m. %Y %H:%M', # '05. 01. 2006 04:30'
'%d. %m. %Y', # '05. 01. 2006' '%d. %m. %Y', # '05. 01. 2006'
'%Y-%m-%d %H.%M', # '2006-01-05 04.30' '%Y-%m-%d %H.%M', # '2006-01-05 04.30'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '\xa0' # non-breaking space THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F' MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATE_FORMAT = 'd.m.Y'
SHORT_DATETIME_FORMAT = 'd.m.Y H:i:s' SHORT_DATETIME_FORMAT = 'd.m.Y H:i:s'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
@ -22,7 +22,7 @@ DATE_INPUT_FORMATS = (
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30' '%d.%m.%Y %H:%M', # '25.10.2006 14:30'
'%d.%m.%Y', # '25.10.2006' '%d.%m.%Y', # '25.10.2006'
) )

View File

@ -13,7 +13,7 @@ YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F' MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATE_FORMAT = 'd.m.Y'
SHORT_DATETIME_FORMAT = 'd.m.Y H:i:s' SHORT_DATETIME_FORMAT = 'd.m.Y H:i:s'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
@ -23,7 +23,7 @@ DATE_INPUT_FORMATS = (
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30' '%d.%m.%Y %H:%M', # '25.10.2006 14:30'
'%d.%m.%Y', # '25.10.2006' '%d.%m.%Y', # '25.10.2006'
) )
@ -34,5 +34,5 @@ DATETIME_INPUT_FORMATS = (
# For details, please refer to http://www.bk.admin.ch/dokumentation/sprachen/04915/05016/index.html?lang=de # For details, please refer to http://www.bk.admin.ch/dokumentation/sprachen/04915/05016/index.html?lang=de
# (in German) and the documentation # (in German) and the documentation
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '\xa0' # non-breaking space THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -12,13 +12,13 @@ YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'F j' MONTH_DAY_FORMAT = 'F j'
SHORT_DATE_FORMAT = 'm/d/Y' SHORT_DATE_FORMAT = 'm/d/Y'
SHORT_DATETIME_FORMAT = 'm/d/Y P' SHORT_DATETIME_FORMAT = 'm/d/Y P'
FIRST_DAY_OF_WEEK = 0 # Sunday FIRST_DAY_OF_WEEK = 0 # Sunday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# Kept ISO formats as they are in first position # Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06' '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
# '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006' # '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
# '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006' # '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
# '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006' # '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'

View File

@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = r'F \d\e Y'
MONTH_DAY_FORMAT = r'j \d\e F' MONTH_DAY_FORMAT = r'j \d\e F'
SHORT_DATE_FORMAT = 'd/m/Y' SHORT_DATE_FORMAT = 'd/m/Y'
SHORT_DATETIME_FORMAT = 'd/m/Y H:i' SHORT_DATETIME_FORMAT = 'd/m/Y H:i'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior

View File

@ -12,13 +12,13 @@ YEAR_MONTH_FORMAT = r'F Y'
MONTH_DAY_FORMAT = r'j \d\e F' MONTH_DAY_FORMAT = r'j \d\e F'
SHORT_DATE_FORMAT = r'd/m/Y' SHORT_DATE_FORMAT = r'd/m/Y'
SHORT_DATETIME_FORMAT = r'd/m/Y H:i' SHORT_DATETIME_FORMAT = r'd/m/Y H:i'
FIRST_DAY_OF_WEEK = 0 # 0: Sunday, 1: Monday FIRST_DAY_OF_WEEK = 0 # 0: Sunday, 1: Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%d/%m/%Y', # '31/12/2009' '%d/%m/%Y', # '31/12/2009'
'%d/%m/%y', # '31/12/09' '%d/%m/%y', # '31/12/09'
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S', '%d/%m/%Y %H:%M:%S',

View File

@ -24,5 +24,5 @@ DATETIME_INPUT_FORMATS = (
'%d/%m/%y %H:%M', '%d/%m/%y %H:%M',
) )
DECIMAL_SEPARATOR = '.' # ',' is also official (less common): NOM-008-SCFI-2002 DECIMAL_SEPARATOR = '.' # ',' is also official (less common): NOM-008-SCFI-2002
THOUSAND_SEPARATOR = '\xa0' # non-breaking space THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -10,7 +10,7 @@ YEAR_MONTH_FORMAT = r'F \d\e Y'
MONTH_DAY_FORMAT = r'j \d\e F' MONTH_DAY_FORMAT = r'j \d\e F'
SHORT_DATE_FORMAT = 'd/m/Y' SHORT_DATE_FORMAT = 'd/m/Y'
SHORT_DATETIME_FORMAT = 'd/m/Y H:i' SHORT_DATETIME_FORMAT = 'd/m/Y H:i'
FIRST_DAY_OF_WEEK = 1 # Monday: ISO 8601 FIRST_DAY_OF_WEEK = 1 # Monday: ISO 8601
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06' '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06'
'%Y%m%d', # '20061025' '%Y%m%d', # '20061025'

View File

@ -10,7 +10,7 @@ YEAR_MONTH_FORMAT = r'F \d\e Y'
MONTH_DAY_FORMAT = r'j \d\e F' MONTH_DAY_FORMAT = r'j \d\e F'
SHORT_DATE_FORMAT = 'd/m/Y' SHORT_DATE_FORMAT = 'd/m/Y'
SHORT_DATETIME_FORMAT = 'd/m/Y H:i' SHORT_DATETIME_FORMAT = 'd/m/Y H:i'
FIRST_DAY_OF_WEEK = 0 # Sunday FIRST_DAY_OF_WEEK = 0 # Sunday
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
# '31/12/2009', '31/12/09' # '31/12/2009', '31/12/09'

View File

@ -20,5 +20,5 @@ SHORT_DATE_FORMAT = 'd.m.Y'
# TIME_INPUT_FORMATS = # TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS = # DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = ' ' # Non-breaking space THOUSAND_SEPARATOR = ' ' # Non-breaking space
# NUMBER_GROUPING = # NUMBER_GROUPING =

View File

@ -20,5 +20,5 @@ SHORT_DATE_FORMAT = 'j.n.Y'
# TIME_INPUT_FORMATS = # TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS = # DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = ' ' # Non-breaking space THOUSAND_SEPARATOR = ' ' # Non-breaking space
# NUMBER_GROUPING = # NUMBER_GROUPING =

View File

@ -12,25 +12,25 @@ YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j F' MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'j N Y' SHORT_DATE_FORMAT = 'j N Y'
SHORT_DATETIME_FORMAT = 'j N Y H:i:s' SHORT_DATETIME_FORMAT = 'j N Y H:i:s'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06' '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06'
'%d.%m.%Y', '%d.%m.%y', # Swiss (fr_CH), '25.10.2006', '25.10.06' '%d.%m.%Y', '%d.%m.%y', # Swiss (fr_CH), '25.10.2006', '25.10.06'
# '%d %B %Y', '%d %b %Y', # '25 octobre 2006', '25 oct. 2006' # '%d %B %Y', '%d %b %Y', # '25 octobre 2006', '25 oct. 2006'
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59' '%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59'
'%d/%m/%Y %H:%M:%S.%f', # '25/10/2006 14:30:59.000200' '%d/%m/%Y %H:%M:%S.%f', # '25/10/2006 14:30:59.000200'
'%d/%m/%Y %H:%M', # '25/10/2006 14:30' '%d/%m/%Y %H:%M', # '25/10/2006 14:30'
'%d/%m/%Y', # '25/10/2006' '%d/%m/%Y', # '25/10/2006'
'%d.%m.%Y %H:%M:%S', # Swiss (fr_CH), '25.10.2006 14:30:59' '%d.%m.%Y %H:%M:%S', # Swiss (fr_CH), '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M:%S.%f', # Swiss (fr_CH), '25.10.2006 14:30:59.000200' '%d.%m.%Y %H:%M:%S.%f', # Swiss (fr_CH), '25.10.2006 14:30:59.000200'
'%d.%m.%Y %H:%M', # Swiss (fr_CH), '25.10.2006 14:30' '%d.%m.%Y %H:%M', # Swiss (fr_CH), '25.10.2006 14:30'
'%d.%m.%Y', # Swiss (fr_CH), '25.10.2006' '%d.%m.%Y', # Swiss (fr_CH), '25.10.2006'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '\xa0' # non-breaking space THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = r'F \d\e Y'
MONTH_DAY_FORMAT = r'j \d\e F' MONTH_DAY_FORMAT = r'j \d\e F'
SHORT_DATE_FORMAT = 'd-m-Y' SHORT_DATE_FORMAT = 'd-m-Y'
SHORT_DATETIME_FORMAT = 'd-m-Y, H:i' SHORT_DATETIME_FORMAT = 'd-m-Y, H:i'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior

View File

@ -23,26 +23,26 @@ DATE_INPUT_FORMATS = (
'%d. %m. %Y.', '%d. %m. %y.', # '25. 10. 2006.', '25. 10. 06.' '%d. %m. %Y.', '%d. %m. %y.', # '25. 10. 2006.', '25. 10. 06.'
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59' '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M:%S.%f', # '2006-10-25 14:30:59.000200' '%Y-%m-%d %H:%M:%S.%f', # '2006-10-25 14:30:59.000200'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30' '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
'%Y-%m-%d', # '2006-10-25' '%Y-%m-%d', # '2006-10-25'
'%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59' '%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59'
'%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200' '%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200'
'%d.%m.%Y. %H:%M', # '25.10.2006. 14:30' '%d.%m.%Y. %H:%M', # '25.10.2006. 14:30'
'%d.%m.%Y.', # '25.10.2006.' '%d.%m.%Y.', # '25.10.2006.'
'%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59' '%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59'
'%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200' '%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200'
'%d.%m.%y. %H:%M', # '25.10.06. 14:30' '%d.%m.%y. %H:%M', # '25.10.06. 14:30'
'%d.%m.%y.', # '25.10.06.' '%d.%m.%y.', # '25.10.06.'
'%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59' '%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59'
'%d. %m. %Y. %H:%M:%S.%f',# '25. 10. 2006. 14:30:59.000200' '%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200'
'%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30' '%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30'
'%d. %m. %Y.', # '25. 10. 2006.' '%d. %m. %Y.', # '25. 10. 2006.'
'%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59' '%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59'
'%d. %m. %y. %H:%M:%S.%f',# '25. 10. 06. 14:30:59.000200' '%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200'
'%d. %m. %y. %H:%M', # '25. 10. 06. 14:30' '%d. %m. %y. %H:%M', # '25. 10. 06. 14:30'
'%d. %m. %y.', # '25. 10. 06.' '%d. %m. %y.', # '25. 10. 06.'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','

View File

@ -12,23 +12,23 @@ YEAR_MONTH_FORMAT = 'Y. F'
MONTH_DAY_FORMAT = 'F j.' MONTH_DAY_FORMAT = 'F j.'
SHORT_DATE_FORMAT = 'Y.m.d.' SHORT_DATE_FORMAT = 'Y.m.d.'
SHORT_DATETIME_FORMAT = 'Y.m.d. G.i.s' SHORT_DATETIME_FORMAT = 'Y.m.d. G.i.s'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%Y.%m.%d.', # '2006.10.25.' '%Y.%m.%d.', # '2006.10.25.'
) )
TIME_INPUT_FORMATS = ( TIME_INPUT_FORMATS = (
'%H.%M.%S', # '14.30.59' '%H.%M.%S', # '14.30.59'
'%H.%M', # '14.30' '%H.%M', # '14.30'
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%Y.%m.%d. %H.%M.%S', # '2006.10.25. 14.30.59' '%Y.%m.%d. %H.%M.%S', # '2006.10.25. 14.30.59'
'%Y.%m.%d. %H.%M.%S.%f', # '2006.10.25. 14.30.59.000200' '%Y.%m.%d. %H.%M.%S.%f', # '2006.10.25. 14.30.59.000200'
'%Y.%m.%d. %H.%M', # '2006.10.25. 14.30' '%Y.%m.%d. %H.%M', # '2006.10.25. 14.30'
'%Y.%m.%d.', # '2006.10.25.' '%Y.%m.%d.', # '2006.10.25.'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = ' ' # Non-breaking space THOUSAND_SEPARATOR = ' ' # Non-breaking space
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -5,14 +5,14 @@ from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax, # The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd F Y' # 25 Ottobre 2006 DATE_FORMAT = 'd F Y' # 25 Ottobre 2006
TIME_FORMAT = 'H:i:s' # 14:30:59 TIME_FORMAT = 'H:i:s' # 14:30:59
DATETIME_FORMAT = 'l d F Y H:i:s' # Mercoledì 25 Ottobre 2006 14:30:59 DATETIME_FORMAT = 'l d F Y H:i:s' # Mercoledì 25 Ottobre 2006 14:30:59
YEAR_MONTH_FORMAT = 'F Y' # Ottobre 2006 YEAR_MONTH_FORMAT = 'F Y' # Ottobre 2006
MONTH_DAY_FORMAT = 'j/F' # 10/2006 MONTH_DAY_FORMAT = 'j/F' # 10/2006
SHORT_DATE_FORMAT = 'd/m/Y' # 25/12/2009 SHORT_DATE_FORMAT = 'd/m/Y' # 25/12/2009
SHORT_DATETIME_FORMAT = 'd/m/Y H:i:s' # 25/10/2009 14:30:59 SHORT_DATETIME_FORMAT = 'd/m/Y H:i:s' # 25/10/2009 14:30:59
FIRST_DAY_OF_WEEK = 1 # Lunedì FIRST_DAY_OF_WEEK = 1 # Lunedì
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior

View File

@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = 'F, Y'
MONTH_DAY_FORMAT = 'j F' MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'j.M.Y' SHORT_DATE_FORMAT = 'j.M.Y'
SHORT_DATETIME_FORMAT = 'j.M.Y H:i:s' SHORT_DATETIME_FORMAT = 'j.M.Y H:i:s'
FIRST_DAY_OF_WEEK = 1 # (Monday) FIRST_DAY_OF_WEEK = 1 # (Monday)
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior

View File

@ -18,7 +18,7 @@ SHORT_DATETIME_FORMAT = 'Y-n-j H:i'
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# Kept ISO formats as they are in first position # Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06' '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
# '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006' # '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
# '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006' # '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
# '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006' # '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'

View File

@ -17,7 +17,7 @@ FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06' '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06'
) )
TIME_INPUT_FORMATS = ( TIME_INPUT_FORMATS = (
'%H:%M:%S', # '14:30:59' '%H:%M:%S', # '14:30:59'

View File

@ -18,7 +18,7 @@ FIRST_DAY_OF_WEEK = 1 # Monday
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# Kept ISO formats as they are in first position # Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06' '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06'
) )
TIME_INPUT_FORMATS = ( TIME_INPUT_FORMATS = (
'%H:%M:%S', # '14:30:59' '%H:%M:%S', # '14:30:59'
@ -45,5 +45,5 @@ DATETIME_INPUT_FORMATS = (
'%d.%m.%y', # '25.10.06' '%d.%m.%y', # '25.10.06'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = ' ' # Non-breaking space THOUSAND_SEPARATOR = ' ' # Non-breaking space
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -22,22 +22,22 @@ DATE_INPUT_FORMATS = (
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59' '%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59'
'%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200' '%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200'
'%d.%m.%Y. %H:%M', # '25.10.2006. 14:30' '%d.%m.%Y. %H:%M', # '25.10.2006. 14:30'
'%d.%m.%Y.', # '25.10.2006.' '%d.%m.%Y.', # '25.10.2006.'
'%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59' '%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59'
'%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200' '%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200'
'%d.%m.%y. %H:%M', # '25.10.06. 14:30' '%d.%m.%y. %H:%M', # '25.10.06. 14:30'
'%d.%m.%y.', # '25.10.06.' '%d.%m.%y.', # '25.10.06.'
'%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59' '%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59'
'%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200' '%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200'
'%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30' '%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30'
'%d. %m. %Y.', # '25. 10. 2006.' '%d. %m. %Y.', # '25. 10. 2006.'
'%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59' '%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59'
'%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200' '%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200'
'%d. %m. %y. %H:%M', # '25. 10. 06. 14:30' '%d. %m. %y. %H:%M', # '25. 10. 06. 14:30'
'%d. %m. %y.', # '25. 10. 06.' '%d. %m. %y.', # '25. 10. 06.'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','

View File

@ -12,13 +12,13 @@ YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'F j' MONTH_DAY_FORMAT = 'F j'
SHORT_DATE_FORMAT = 'm/d/Y' SHORT_DATE_FORMAT = 'm/d/Y'
SHORT_DATETIME_FORMAT = 'm/d/Y P' SHORT_DATETIME_FORMAT = 'm/d/Y P'
FIRST_DAY_OF_WEEK = 0 # Sunday FIRST_DAY_OF_WEEK = 0 # Sunday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# Kept ISO formats as they are in first position # Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06' '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
# '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006' # '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
# '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006' # '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
# '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006' # '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'

View File

@ -12,13 +12,13 @@ YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F' MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATE_FORMAT = 'd.m.Y'
SHORT_DATETIME_FORMAT = 'd.m.Y H:i' SHORT_DATETIME_FORMAT = 'd.m.Y H:i'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# Kept ISO formats as they are in first position # Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06' '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06'
# '%d. %b %Y', '%d %b %Y', # '25. okt 2006', '25 okt 2006' # '%d. %b %Y', '%d %b %Y', # '25. okt 2006', '25 okt 2006'
# '%d. %b. %Y', '%d %b. %Y', # '25. okt. 2006', '25 okt. 2006' # '%d. %b. %Y', '%d %b. %Y', # '25. okt. 2006', '25 okt. 2006'
# '%d. %B %Y', '%d %B %Y', # '25. oktober 2006', '25 oktober 2006' # '%d. %B %Y', '%d %B %Y', # '25. oktober 2006', '25 oktober 2006'
@ -38,5 +38,5 @@ DATETIME_INPUT_FORMATS = (
'%d.%m.%y', # '25.10.06' '%d.%m.%y', # '25.10.06'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '\xa0' # non-breaking space THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -12,13 +12,13 @@ YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F' MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATE_FORMAT = 'd.m.Y'
SHORT_DATETIME_FORMAT = 'd.m.Y H:i' SHORT_DATETIME_FORMAT = 'd.m.Y H:i'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# Kept ISO formats as they are in first position # Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06' '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06'
# '%d. %b %Y', '%d %b %Y', # '25. okt 2006', '25 okt 2006' # '%d. %b %Y', '%d %b %Y', # '25. okt 2006', '25 okt 2006'
# '%d. %b. %Y', '%d %b. %Y', # '25. okt. 2006', '25 okt. 2006' # '%d. %b. %Y', '%d %b. %Y', # '25. okt. 2006', '25 okt. 2006'
# '%d. %B %Y', '%d %B %Y', # '25. oktober 2006', '25 oktober 2006' # '%d. %B %Y', '%d %B %Y', # '25. oktober 2006', '25 oktober 2006'
@ -39,5 +39,5 @@ DATETIME_INPUT_FORMATS = (
'%d.%m.%y', # '25.10.06' '%d.%m.%y', # '25.10.06'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '\xa0' # non-breaking space THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j F' MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd-m-Y' SHORT_DATE_FORMAT = 'd-m-Y'
SHORT_DATETIME_FORMAT = 'd-m-Y H:i:s' SHORT_DATETIME_FORMAT = 'd-m-Y H:i:s'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
@ -22,10 +22,10 @@ DATE_INPUT_FORMATS = (
# '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006' # '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006'
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30' '%d.%m.%Y %H:%M', # '25.10.2006 14:30'
'%d.%m.%Y', # '25.10.2006' '%d.%m.%Y', # '25.10.2006'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = ' ' THOUSAND_SEPARATOR = ' '

View File

@ -18,7 +18,7 @@ FIRST_DAY_OF_WEEK = 0 # Sunday
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# Kept ISO formats as they are in first position # Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06' '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
# '%d de %b de %Y', '%d de %b, %Y', # '25 de Out de 2006', '25 Out, 2006' # '%d de %b de %Y', '%d de %b, %Y', # '25 de Out de 2006', '25 Out, 2006'
# '%d de %B de %Y', '%d de %B, %Y', # '25 de Outubro de 2006', '25 de Outubro, 2006' # '%d de %B de %Y', '%d de %B, %Y', # '25 de Outubro de 2006', '25 de Outubro, 2006'
) )

View File

@ -17,7 +17,7 @@ FIRST_DAY_OF_WEEK = 0 # Sunday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06' '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06'
# '%d de %b de %Y', '%d de %b, %Y', # '25 de Out de 2006', '25 Out, 2006' # '%d de %b de %Y', '%d de %b, %Y', # '25 de Out de 2006', '25 Out, 2006'
# '%d de %B de %Y', '%d de %B, %Y', # '25 de Outubro de 2006', '25 de Outubro, 2006' # '%d de %B de %Y', '%d de %B, %Y', # '25 de Outubro de 2006', '25 de Outubro, 2006'
) )

View File

@ -21,15 +21,15 @@ DATE_INPUT_FORMATS = (
'%d.%m.%y', # '25.10.06' '%d.%m.%y', # '25.10.06'
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30' '%d.%m.%Y %H:%M', # '25.10.2006 14:30'
'%d.%m.%Y', # '25.10.2006' '%d.%m.%Y', # '25.10.2006'
'%d.%m.%y %H:%M:%S', # '25.10.06 14:30:59' '%d.%m.%y %H:%M:%S', # '25.10.06 14:30:59'
'%d.%m.%y %H:%M:%S.%f', # '25.10.06 14:30:59.000200' '%d.%m.%y %H:%M:%S.%f', # '25.10.06 14:30:59.000200'
'%d.%m.%y %H:%M', # '25.10.06 14:30' '%d.%m.%y %H:%M', # '25.10.06 14:30'
'%d.%m.%y', # '25.10.06' '%d.%m.%y', # '25.10.06'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '\xa0' # non-breaking space THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F' MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATE_FORMAT = 'd.m.Y'
SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s' SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
@ -22,11 +22,11 @@ DATE_INPUT_FORMATS = (
# '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006' # '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006'
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200' '%d.%m.%Y %H:%M:%S.%f', # '25.10.2006 14:30:59.000200'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30' '%d.%m.%Y %H:%M', # '25.10.2006 14:30'
'%d.%m.%Y', # '25.10.2006' '%d.%m.%Y', # '25.10.2006'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '\xa0' # non-breaking space THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -24,22 +24,22 @@ DATE_INPUT_FORMATS = (
# '%d. %b %Y.', '%d. %B %Y.', # '25. Oct 2006.', '25. October 2006.' # '%d. %b %Y.', '%d. %B %Y.', # '25. Oct 2006.', '25. October 2006.'
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59' '%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59'
'%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200' '%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200'
'%d.%m.%Y. %H:%M', # '25.10.2006. 14:30' '%d.%m.%Y. %H:%M', # '25.10.2006. 14:30'
'%d.%m.%Y.', # '25.10.2006.' '%d.%m.%Y.', # '25.10.2006.'
'%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59' '%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59'
'%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200' '%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200'
'%d.%m.%y. %H:%M', # '25.10.06. 14:30' '%d.%m.%y. %H:%M', # '25.10.06. 14:30'
'%d.%m.%y.', # '25.10.06.' '%d.%m.%y.', # '25.10.06.'
'%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59' '%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59'
'%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200' '%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200'
'%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30' '%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30'
'%d. %m. %Y.', # '25. 10. 2006.' '%d. %m. %Y.', # '25. 10. 2006.'
'%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59' '%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59'
'%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200' '%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200'
'%d. %m. %y. %H:%M', # '25. 10. 06. 14:30' '%d. %m. %y. %H:%M', # '25. 10. 06. 14:30'
'%d. %m. %y.', # '25. 10. 06.' '%d. %m. %y.', # '25. 10. 06.'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '.' THOUSAND_SEPARATOR = '.'

View File

@ -24,22 +24,22 @@ DATE_INPUT_FORMATS = (
# '%d. %b %Y.', '%d. %B %Y.', # '25. Oct 2006.', '25. October 2006.' # '%d. %b %Y.', '%d. %B %Y.', # '25. Oct 2006.', '25. October 2006.'
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59' '%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59'
'%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200' '%d.%m.%Y. %H:%M:%S.%f', # '25.10.2006. 14:30:59.000200'
'%d.%m.%Y. %H:%M', # '25.10.2006. 14:30' '%d.%m.%Y. %H:%M', # '25.10.2006. 14:30'
'%d.%m.%Y.', # '25.10.2006.' '%d.%m.%Y.', # '25.10.2006.'
'%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59' '%d.%m.%y. %H:%M:%S', # '25.10.06. 14:30:59'
'%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200' '%d.%m.%y. %H:%M:%S.%f', # '25.10.06. 14:30:59.000200'
'%d.%m.%y. %H:%M', # '25.10.06. 14:30' '%d.%m.%y. %H:%M', # '25.10.06. 14:30'
'%d.%m.%y.', # '25.10.06.' '%d.%m.%y.', # '25.10.06.'
'%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59' '%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59'
'%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200' '%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200'
'%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30' '%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30'
'%d. %m. %Y.', # '25. 10. 2006.' '%d. %m. %Y.', # '25. 10. 2006.'
'%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59' '%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59'
'%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200' '%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200'
'%d. %m. %y. %H:%M', # '25. 10. 06. 14:30' '%d. %m. %y. %H:%M', # '25. 10. 06. 14:30'
'%d. %m. %y.', # '25. 10. 06.' '%d. %m. %y.', # '25. 10. 06.'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '.' THOUSAND_SEPARATOR = '.'

View File

@ -37,5 +37,5 @@ DATETIME_INPUT_FORMATS = (
'%m/%d/%y', # '10/25/06' '%m/%d/%y', # '10/25/06'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '\xa0' # non-breaking space THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View File

@ -12,7 +12,7 @@ YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'd F' MONTH_DAY_FORMAT = 'd F'
SHORT_DATE_FORMAT = 'd M Y' SHORT_DATE_FORMAT = 'd M Y'
SHORT_DATETIME_FORMAT = 'd M Y H:i:s' SHORT_DATETIME_FORMAT = 'd M Y H:i:s'
FIRST_DAY_OF_WEEK = 1 # Pazartesi FIRST_DAY_OF_WEEK = 1 # Pazartesi
# The *_INPUT_FORMATS strings use the Python strftime format syntax, # The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
@ -22,10 +22,10 @@ DATE_INPUT_FORMATS = (
# '%d %B %Y', '%d %b. %Y', # '25 Ekim 2006', '25 Eki. 2006' # '%d %B %Y', '%d %b. %Y', # '25 Ekim 2006', '25 Eki. 2006'
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59' '%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59'
'%d/%m/%Y %H:%M:%S.%f', # '25/10/2006 14:30:59.000200' '%d/%m/%Y %H:%M:%S.%f', # '25/10/2006 14:30:59.000200'
'%d/%m/%Y %H:%M', # '25/10/2006 14:30' '%d/%m/%Y %H:%M', # '25/10/2006 14:30'
'%d/%m/%Y', # '25/10/2006' '%d/%m/%Y', # '25/10/2006'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '.' THOUSAND_SEPARATOR = '.'

View File

@ -83,7 +83,7 @@ class Fieldset(object):
class Fieldline(object): class Fieldline(object):
def __init__(self, form, field, readonly_fields=None, model_admin=None): def __init__(self, form, field, readonly_fields=None, model_admin=None):
self.form = form # A django.forms.Form instance self.form = form # A django.forms.Form instance
if not hasattr(field, "__iter__") or isinstance(field, six.text_type): if not hasattr(field, "__iter__") or isinstance(field, six.text_type):
self.fields = [field] self.fields = [field]
else: else:
@ -110,8 +110,8 @@ class Fieldline(object):
class AdminField(object): class AdminField(object):
def __init__(self, form, field, is_first): def __init__(self, form, field, is_first):
self.field = form[field] # A django.forms.BoundField instance self.field = form[field] # A django.forms.BoundField instance
self.is_first = is_first # Whether this field is first on the line self.is_first = is_first # Whether this field is first on the line
self.is_checkbox = isinstance(self.field.field.widget, forms.CheckboxInput) self.is_checkbox = isinstance(self.field.field.widget, forms.CheckboxInput)
def label_tag(self): def label_tag(self):

View File

@ -1033,7 +1033,7 @@ class ModelAdmin(BaseModelAdmin):
attr = obj._meta.pk.attname attr = obj._meta.pk.attname
value = obj.serializable_value(attr) value = obj.serializable_value(attr)
return SimpleTemplateResponse('admin/popup_response.html', { return SimpleTemplateResponse('admin/popup_response.html', {
'pk_value': escape(pk_value), # for possible backwards-compatibility 'pk_value': escape(pk_value), # for possible backwards-compatibility
'value': escape(value), 'value': escape(value),
'obj': escapejs(obj) 'obj': escapejs(obj)
}) })

View File

@ -136,13 +136,13 @@ def result_headers(cl):
new_order_type = {'asc': 'desc', 'desc': 'asc'}[order_type] new_order_type = {'asc': 'desc', 'desc': 'asc'}[order_type]
# build new ordering param # build new ordering param
o_list_primary = [] # URL for making this field the primary sort o_list_primary = [] # URL for making this field the primary sort
o_list_remove = [] # URL for removing this field from sort o_list_remove = [] # URL for removing this field from sort
o_list_toggle = [] # URL for toggling order type for this field o_list_toggle = [] # URL for toggling order type for this field
make_qs_param = lambda t, n: ('-' if t == 'desc' else '') + str(n) make_qs_param = lambda t, n: ('-' if t == 'desc' else '') + str(n)
for j, ot in ordering_field_columns.items(): for j, ot in ordering_field_columns.items():
if j == i: # Same column if j == i: # Same column
param = make_qs_param(new_order_type, j) param = make_qs_param(new_order_type, j)
# We want clicking on this header to bring the ordering to the # We want clicking on this header to bring the ordering to the
# front # front

View File

@ -49,7 +49,7 @@ def submit_row(context):
@register.filter @register.filter
def cell_count(inline_admin_form): def cell_count(inline_admin_form):
"""Returns the number of cells used in a tabular inline""" """Returns the number of cells used in a tabular inline"""
count = 1 # Hidden cell with hidden 'id' field count = 1 # Hidden cell with hidden 'id' field
for fieldset in inline_admin_form: for fieldset in inline_admin_form:
# Loop through all the fields (one per cell) # Loop through all the fields (one per cell)
for line in fieldset: for line in fieldset:

View File

@ -154,7 +154,7 @@ def get_deleted_objects(objs, opts, user, admin_site, using):
class NestedObjects(Collector): class NestedObjects(Collector):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(NestedObjects, self).__init__(*args, **kwargs) super(NestedObjects, self).__init__(*args, **kwargs)
self.edges = {} # {from_instance: [to_instances]} self.edges = {} # {from_instance: [to_instances]}
self.protected = set() self.protected = set()
def add_edge(self, source, target): def add_edge(self, source, target):
@ -391,7 +391,7 @@ class NotRelationField(Exception):
def get_model_from_relation(field): def get_model_from_relation(field):
if isinstance(field, models.related.RelatedObject): if isinstance(field, models.related.RelatedObject):
return field.model return field.model
elif getattr(field, 'rel'): # or isinstance? elif getattr(field, 'rel'): # or isinstance?
return field.rel.to return field.rel.to
else: else:
raise NotRelationField raise NotRelationField
@ -412,7 +412,7 @@ def reverse_field_path(model, path):
for piece in pieces: for piece in pieces:
field, model, direct, m2m = parent._meta.get_field_by_name(piece) field, model, direct, m2m = parent._meta.get_field_by_name(piece)
# skip trailing data field if extant: # skip trailing data field if extant:
if len(reversed_path) == len(pieces)-1: # final iteration if len(reversed_path) == len(pieces)-1: # final iteration
try: try:
get_model_from_relation(field) get_model_from_relation(field)
except NotRelationField: except NotRelationField:
@ -469,8 +469,8 @@ def get_limit_choices_to_from_path(model, path):
fields and hasattr(fields[-1], 'rel') and fields and hasattr(fields[-1], 'rel') and
getattr(fields[-1].rel, 'limit_choices_to', None)) getattr(fields[-1].rel, 'limit_choices_to', None))
if not limit_choices_to: if not limit_choices_to:
return models.Q() # empty Q return models.Q() # empty Q
elif isinstance(limit_choices_to, models.Q): elif isinstance(limit_choices_to, models.Q):
return limit_choices_to # already a Q return limit_choices_to # already a Q
else: else:
return models.Q(**limit_choices_to) # convert dict to Q return models.Q(**limit_choices_to) # convert dict to Q

View File

@ -70,7 +70,7 @@ class BaseValidator(object):
def validate_fields(self, cls, model): def validate_fields(self, cls, model):
" Validate that fields only refer to existing fields, doesn't contain duplicates. " " Validate that fields only refer to existing fields, doesn't contain duplicates. "
# fields # fields
if cls.fields: # default value is None if cls.fields: # default value is None
check_isseq(cls, 'fields', cls.fields) check_isseq(cls, 'fields', cls.fields)
self.check_field_spec(cls, model, cls.fields, 'fields') self.check_field_spec(cls, model, cls.fields, 'fields')
if cls.fieldsets: if cls.fieldsets:
@ -81,7 +81,7 @@ class BaseValidator(object):
def validate_fieldsets(self, cls, model): def validate_fieldsets(self, cls, model):
" Validate that fieldsets is properly formatted and doesn't contain duplicates. " " Validate that fieldsets is properly formatted and doesn't contain duplicates. "
from django.contrib.admin.options import flatten_fieldsets from django.contrib.admin.options import flatten_fieldsets
if cls.fieldsets: # default value is None if cls.fieldsets: # default value is None
check_isseq(cls, 'fieldsets', cls.fieldsets) check_isseq(cls, 'fieldsets', cls.fieldsets)
for idx, fieldset in enumerate(cls.fieldsets): for idx, fieldset in enumerate(cls.fieldsets):
check_isseq(cls, 'fieldsets[%d]' % idx, fieldset) check_isseq(cls, 'fieldsets[%d]' % idx, fieldset)
@ -100,7 +100,7 @@ class BaseValidator(object):
def validate_exclude(self, cls, model): def validate_exclude(self, cls, model):
" Validate that exclude is a sequence without duplicates. " " Validate that exclude is a sequence without duplicates. "
if cls.exclude: # default value is None if cls.exclude: # default value is None
check_isseq(cls, 'exclude', cls.exclude) check_isseq(cls, 'exclude', cls.exclude)
if len(cls.exclude) > len(set(cls.exclude)): if len(cls.exclude) > len(set(cls.exclude)):
raise ImproperlyConfigured('There are duplicate field(s) in %s.exclude' % cls.__name__) raise ImproperlyConfigured('There are duplicate field(s) in %s.exclude' % cls.__name__)
@ -384,7 +384,7 @@ class ModelAdminValidator(BaseValidator):
class InlineValidator(BaseValidator): class InlineValidator(BaseValidator):
def validate_fk_name(self, cls, model): def validate_fk_name(self, cls, model):
" Validate that fk_name refers to a ForeignKey. " " Validate that fk_name refers to a ForeignKey. "
if cls.fk_name: # default value is None if cls.fk_name: # default value is None
f = get_field(cls, model, 'fk_name', cls.fk_name) f = get_field(cls, model, 'fk_name', cls.fk_name)
if not isinstance(f, models.ForeignKey): if not isinstance(f, models.ForeignKey):
raise ImproperlyConfigured("'%s.fk_name is not an instance of " raise ImproperlyConfigured("'%s.fk_name is not an instance of "

View File

@ -130,7 +130,7 @@ class ChangeList(six.with_metaclass(RenameChangeListMethods)):
""" """
if not params: if not params:
params = self.params params = self.params
lookup_params = params.copy() # a dictionary of the query string lookup_params = params.copy() # a dictionary of the query string
# Remove all the parameters that are globally and systematically # Remove all the parameters that are globally and systematically
# ignored. # ignored.
for ignored in IGNORED_PARAMS: for ignored in IGNORED_PARAMS:
@ -299,10 +299,10 @@ class ChangeList(six.with_metaclass(RenameChangeListMethods)):
field_name = self.list_display[int(idx)] field_name = self.list_display[int(idx)]
order_field = self.get_ordering_field(field_name) order_field = self.get_ordering_field(field_name)
if not order_field: if not order_field:
continue # No 'admin_order_field', skip it continue # No 'admin_order_field', skip it
ordering.append(pfx + order_field) ordering.append(pfx + order_field)
except (IndexError, ValueError): except (IndexError, ValueError):
continue # Invalid ordering specified, skip it. continue # Invalid ordering specified, skip it.
# Add the given query's ordering fields, if any. # Add the given query's ordering fields, if any.
ordering.extend(queryset.query.order_by) ordering.extend(queryset.query.order_by)
@ -347,7 +347,7 @@ class ChangeList(six.with_metaclass(RenameChangeListMethods)):
try: try:
idx = int(idx) idx = int(idx)
except ValueError: except ValueError:
continue # skip it continue # skip it
ordering_fields[idx] = 'desc' if pfx == '-' else 'asc' ordering_fields[idx] = 'desc' if pfx == '-' else 'asc'
return ordering_fields return ordering_fields

View File

@ -164,7 +164,7 @@ class ForeignKeyRawIdWidget(forms.TextInput):
else: else:
url = '' url = ''
if "class" not in attrs: if "class" not in attrs:
attrs['class'] = 'vForeignKeyRawIdAdminField' # The JavaScript code looks for this hook. attrs['class'] = 'vForeignKeyRawIdAdminField' # The JavaScript code looks for this hook.
# TODO: "lookup_id_" is hard-coded here. This should instead use # TODO: "lookup_id_" is hard-coded here. This should instead use
# the correct API to determine the ID dynamically. # the correct API to determine the ID dynamically.
extra.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> ' extra.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> '

View File

@ -461,7 +461,7 @@ def generic_inlineformset_factory(model, form=ModelForm,
ct_field = opts.get_field(ct_field) ct_field = opts.get_field(ct_field)
if not isinstance(ct_field, models.ForeignKey) or ct_field.rel.to != ContentType: if not isinstance(ct_field, models.ForeignKey) or ct_field.rel.to != ContentType:
raise Exception("fk_name '%s' is not a ForeignKey to ContentType" % ct_field) raise Exception("fk_name '%s' is not a ForeignKey to ContentType" % ct_field)
fk_field = opts.get_field(fk_field) # let the exception propagate fk_field = opts.get_field(fk_field) # let the exception propagate
if exclude is not None: if exclude is not None:
exclude = list(exclude) exclude = list(exclude)
exclude.extend([ct_field.name, fk_field.name]) exclude.extend([ct_field.name, fk_field.name])

View File

@ -6,7 +6,7 @@ from django.conf import settings
class FlatpageFallbackMiddleware(object): class FlatpageFallbackMiddleware(object):
def process_response(self, request, response): def process_response(self, request, response):
if response.status_code != 404: if response.status_code != 404:
return response # No need to check for a flatpage for non-404 responses. return response # No need to check for a flatpage for non-404 responses.
try: try:
return flatpage(request, request.path_info) return flatpage(request, request.path_info)
# Return the original response if any errors happened. Because this # Return the original response if any errors happened. Because this

View File

@ -8,7 +8,7 @@ from django.template.context import RequestContext
from django.utils.crypto import constant_time_compare from django.utils.crypto import constant_time_compare
from django.contrib.formtools.utils import form_hmac from django.contrib.formtools.utils import form_hmac
AUTO_ID = 'formtools_%s' # Each form here uses this as its auto_id parameter. AUTO_ID = 'formtools_%s' # Each form here uses this as its auto_id parameter.
class FormPreview(object): class FormPreview(object):
@ -42,7 +42,7 @@ class FormPreview(object):
try: try:
self.form.base_fields[name] self.form.base_fields[name]
except KeyError: except KeyError:
break # This field name isn't being used by the form. break # This field name isn't being used by the form.
name += '_' name += '_'
return name return name
@ -75,7 +75,7 @@ class FormPreview(object):
if f.is_valid(): if f.is_valid():
if not self._check_security_hash(request.POST.get(self.unused_name('hash'), ''), if not self._check_security_hash(request.POST.get(self.unused_name('hash'), ''),
request, f): request, f):
return self.failed_hash(request) # Security hash failed. return self.failed_hash(request) # Security hash failed.
return self.done(request, f.cleaned_data) return self.done(request, f.cleaned_data)
else: else:
return render_to_response(self.form_template, return render_to_response(self.form_template,

View File

@ -14,11 +14,11 @@ class MySQLOperations(DatabaseOperations, BaseSpatialOperations):
from_text = 'GeomFromText' from_text = 'GeomFromText'
Adapter = WKTAdapter Adapter = WKTAdapter
Adaptor = Adapter # Backwards-compatibility alias. Adaptor = Adapter # Backwards-compatibility alias.
geometry_functions = { geometry_functions = {
'bbcontains': 'MBRContains', # For consistency w/PostGIS API 'bbcontains': 'MBRContains', # For consistency w/PostGIS API
'bboverlaps': 'MBROverlaps', # .. .. 'bboverlaps': 'MBROverlaps', # .. ..
'contained': 'MBRWithin', # .. .. 'contained': 'MBRWithin', # .. ..
'contains': 'MBRContains', 'contains': 'MBRContains',
'disjoint': 'MBRDisjoint', 'disjoint': 'MBRDisjoint',

View File

@ -86,7 +86,7 @@ class OracleOperations(DatabaseOperations, BaseSpatialOperations):
valid_aggregates = {'Union', 'Extent'} valid_aggregates = {'Union', 'Extent'}
Adapter = OracleSpatialAdapter Adapter = OracleSpatialAdapter
Adaptor = Adapter # Backwards-compatibility alias. Adaptor = Adapter # Backwards-compatibility alias.
area = 'SDO_GEOM.SDO_AREA' area = 'SDO_GEOM.SDO_AREA'
gml = 'SDO_UTIL.TO_GMLGEOMETRY' gml = 'SDO_UTIL.TO_GMLGEOMETRY'
@ -126,12 +126,12 @@ class OracleOperations(DatabaseOperations, BaseSpatialOperations):
'coveredby': SDOOperation('SDO_COVEREDBY'), 'coveredby': SDOOperation('SDO_COVEREDBY'),
'covers': SDOOperation('SDO_COVERS'), 'covers': SDOOperation('SDO_COVERS'),
'disjoint': SDOGeomRelate('DISJOINT'), 'disjoint': SDOGeomRelate('DISJOINT'),
'intersects': SDOOperation('SDO_OVERLAPBDYINTERSECT'), # TODO: Is this really the same as ST_Intersects()? 'intersects': SDOOperation('SDO_OVERLAPBDYINTERSECT'), # TODO: Is this really the same as ST_Intersects()?
'equals': SDOOperation('SDO_EQUAL'), 'equals': SDOOperation('SDO_EQUAL'),
'exact': SDOOperation('SDO_EQUAL'), 'exact': SDOOperation('SDO_EQUAL'),
'overlaps': SDOOperation('SDO_OVERLAPS'), 'overlaps': SDOOperation('SDO_OVERLAPS'),
'same_as': SDOOperation('SDO_EQUAL'), 'same_as': SDOOperation('SDO_EQUAL'),
'relate': (SDORelate, six.string_types), # Oracle uses a different syntax, e.g., 'mask=inside+touch' 'relate': (SDORelate, six.string_types), # Oracle uses a different syntax, e.g., 'mask=inside+touch'
'touches': SDOOperation('SDO_TOUCH'), 'touches': SDOOperation('SDO_TOUCH'),
'within': SDOOperation('SDO_INSIDE'), 'within': SDOOperation('SDO_INSIDE'),
} }

View File

@ -79,7 +79,7 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
valid_aggregates = {'Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union'} valid_aggregates = {'Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union'}
Adapter = PostGISAdapter Adapter = PostGISAdapter
Adaptor = Adapter # Backwards-compatibility alias. Adaptor = Adapter # Backwards-compatibility alias.
def __init__(self, connection): def __init__(self, connection):
super(PostGISOperations, self).__init__(connection) super(PostGISOperations, self).__init__(connection)

View File

@ -68,7 +68,7 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):
valid_aggregates = {'Extent', 'Union'} valid_aggregates = {'Extent', 'Union'}
Adapter = SpatiaLiteAdapter Adapter = SpatiaLiteAdapter
Adaptor = Adapter # Backwards-compatibility alias. Adaptor = Adapter # Backwards-compatibility alias.
area = 'Area' area = 'Area'
centroid = 'Centroid' centroid = 'Centroid'
@ -77,7 +77,7 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):
distance = 'Distance' distance = 'Distance'
envelope = 'Envelope' envelope = 'Envelope'
intersection = 'Intersection' intersection = 'Intersection'
length = 'GLength' # OpenGis defines Length, but this conflicts with an SQLite reserved keyword length = 'GLength' # OpenGis defines Length, but this conflicts with an SQLite reserved keyword
num_geom = 'NumGeometries' num_geom = 'NumGeometries'
num_points = 'NumPoints' num_points = 'NumPoints'
point_on_surface = 'PointOnSurface' point_on_surface = 'PointOnSurface'
@ -86,7 +86,7 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):
sym_difference = 'SymDifference' sym_difference = 'SymDifference'
transform = 'Transform' transform = 'Transform'
translate = 'ShiftCoords' translate = 'ShiftCoords'
union = 'GUnion' # OpenGis defines Union, but this conflicts with an SQLite reserved keyword union = 'GUnion' # OpenGis defines Union, but this conflicts with an SQLite reserved keyword
unionagg = 'GUnion' unionagg = 'GUnion'
from_text = 'GeomFromText' from_text = 'GeomFromText'

View File

@ -188,7 +188,7 @@ class GeometryField(Field):
the SRID set for the field. For example, if the input geometry the SRID set for the field. For example, if the input geometry
has no SRID, then that of the field will be returned. has no SRID, then that of the field will be returned.
""" """
gsrid = geom.srid # SRID of given geometry. gsrid = geom.srid # SRID of given geometry.
if gsrid is None or self.srid == -1 or (gsrid == -1 and self.srid != -1): if gsrid is None or self.srid == -1 or (gsrid == -1 and self.srid != -1):
return self.srid return self.srid
else: else:

View File

@ -50,7 +50,7 @@ class GeoQuerySet(QuerySet):
if backend.oracle: if backend.oracle:
s['procedure_fmt'] = '%(geo_col)s,%(tolerance)s' s['procedure_fmt'] = '%(geo_col)s,%(tolerance)s'
s['procedure_args']['tolerance'] = tolerance s['procedure_args']['tolerance'] = tolerance
s['select_field'] = AreaField('sq_m') # Oracle returns area in units of meters. s['select_field'] = AreaField('sq_m') # Oracle returns area in units of meters.
elif backend.postgis or backend.spatialite: elif backend.postgis or backend.spatialite:
if backend.geography: if backend.geography:
# Geography fields support area calculation, returns square meters. # Geography fields support area calculation, returns square meters.
@ -420,7 +420,7 @@ class GeoQuerySet(QuerySet):
custom_sel = '%s(%s, %s)' % (connections[self.db].ops.transform, geo_col, srid) custom_sel = '%s(%s, %s)' % (connections[self.db].ops.transform, geo_col, srid)
# TODO: Should we have this as an alias? # TODO: Should we have this as an alias?
# custom_sel = '(%s(%s, %s)) AS %s' % (SpatialBackend.transform, geo_col, srid, qn(geo_field.name)) # custom_sel = '(%s(%s, %s)) AS %s' % (SpatialBackend.transform, geo_col, srid, qn(geo_field.name))
self.query.transformed_srid = srid # So other GeoQuerySet methods self.query.transformed_srid = srid # So other GeoQuerySet methods
self.query.custom_select[geo_field] = custom_sel self.query.custom_select[geo_field] = custom_sel
return self._clone() return self._clone()

View File

@ -339,9 +339,9 @@ class OGRGeometry(GDALBase):
def wkb(self): def wkb(self):
"Returns the WKB representation of the Geometry." "Returns the WKB representation of the Geometry."
if sys.byteorder == 'little': if sys.byteorder == 'little':
byteorder = 1 # wkbNDR (from ogr_core.h) byteorder = 1 # wkbNDR (from ogr_core.h)
else: else:
byteorder = 0 # wkbXDR byteorder = 0 # wkbXDR
sz = self.wkb_size sz = self.wkb_size
# Creating the unsigned character buffer, and passing it in by reference. # Creating the unsigned character buffer, and passing it in by reference.
buf = (c_ubyte * sz)() buf = (c_ubyte * sz)()
@ -635,7 +635,7 @@ class Polygon(OGRGeometry):
@property @property
def shell(self): def shell(self):
"Returns the shell of this Polygon." "Returns the shell of this Polygon."
return self[0] # First ring is the shell return self[0] # First ring is the shell
exterior_ring = shell exterior_ring = shell
@property @property

View File

@ -9,7 +9,7 @@ from django.contrib.gis.gdal.libgdal import lgdal
from django.contrib.gis.gdal.prototypes.generation import (const_string_output, from django.contrib.gis.gdal.prototypes.generation import (const_string_output,
double_output, geom_output, int_output, srs_output, void_output, voidptr_output) double_output, geom_output, int_output, srs_output, void_output, voidptr_output)
c_int_p = POINTER(c_int) # shortcut type c_int_p = POINTER(c_int) # shortcut type
### Driver Routines ### ### Driver Routines ###
register_all = void_output(lgdal.OGRRegisterAll, [], errcheck=False) register_all = void_output(lgdal.OGRRegisterAll, [], errcheck=False)

View File

@ -59,7 +59,7 @@ import_wkt = void_output(lgdal.OGR_G_ImportFromWkt, [c_void_p, POINTER(c_char_p)
destroy_geom = void_output(lgdal.OGR_G_DestroyGeometry, [c_void_p], errcheck=False) destroy_geom = void_output(lgdal.OGR_G_DestroyGeometry, [c_void_p], errcheck=False)
# Geometry export routines. # Geometry export routines.
to_wkb = void_output(lgdal.OGR_G_ExportToWkb, None, errcheck=True) # special handling for WKB. to_wkb = void_output(lgdal.OGR_G_ExportToWkb, None, errcheck=True) # special handling for WKB.
to_wkt = string_output(lgdal.OGR_G_ExportToWkt, [c_void_p, POINTER(c_char_p)], decoding='ascii') to_wkt = string_output(lgdal.OGR_G_ExportToWkt, [c_void_p, POINTER(c_char_p)], decoding='ascii')
to_gml = string_output(lgdal.OGR_G_ExportToGML, [c_void_p], str_result=True, decoding='ascii') to_gml = string_output(lgdal.OGR_G_ExportToGML, [c_void_p], str_result=True, decoding='ascii')
get_wkbsize = int_output(lgdal.OGR_G_WkbSize, [c_void_p]) get_wkbsize = int_output(lgdal.OGR_G_WkbSize, [c_void_p])

View File

@ -13,19 +13,19 @@ if HAS_GDAL:
ds_list = ( ds_list = (
TestDS('test_point', nfeat=5, nfld=3, geom='POINT', gtype=1, driver='ESRI Shapefile', TestDS('test_point', nfeat=5, nfld=3, geom='POINT', gtype=1, driver='ESRI Shapefile',
fields={'dbl': OFTReal, 'int': OFTInteger, 'str': OFTString}, fields={'dbl': OFTReal, 'int': OFTInteger, 'str': OFTString},
extent=(-1.35011, 0.166623, -0.524093, 0.824508), # Got extent from QGIS extent=(-1.35011, 0.166623, -0.524093, 0.824508), # Got extent from QGIS
srs_wkt='GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]', srs_wkt='GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]',
field_values={'dbl': [float(i) for i in range(1, 6)], 'int': list(range(1, 6)), 'str': [str(i) for i in range(1, 6)]}, field_values={'dbl': [float(i) for i in range(1, 6)], 'int': list(range(1, 6)), 'str': [str(i) for i in range(1, 6)]},
fids=range(5)), fids=range(5)),
TestDS('test_vrt', ext='vrt', nfeat=3, nfld=3, geom='POINT', gtype='Point25D', driver='VRT', TestDS('test_vrt', ext='vrt', nfeat=3, nfld=3, geom='POINT', gtype='Point25D', driver='VRT',
fields={'POINT_X': OFTString, 'POINT_Y': OFTString, 'NUM': OFTString}, # VRT uses CSV, which all types are OFTString. fields={'POINT_X': OFTString, 'POINT_Y': OFTString, 'NUM': OFTString}, # VRT uses CSV, which all types are OFTString.
extent=(1.0, 2.0, 100.0, 523.5), # Min/Max from CSV extent=(1.0, 2.0, 100.0, 523.5), # Min/Max from CSV
field_values={'POINT_X': ['1.0', '5.0', '100.0'], 'POINT_Y': ['2.0', '23.0', '523.5'], 'NUM': ['5', '17', '23']}, field_values={'POINT_X': ['1.0', '5.0', '100.0'], 'POINT_Y': ['2.0', '23.0', '523.5'], 'NUM': ['5', '17', '23']},
fids=range(1, 4)), fids=range(1, 4)),
TestDS('test_poly', nfeat=3, nfld=3, geom='POLYGON', gtype=3, TestDS('test_poly', nfeat=3, nfld=3, geom='POLYGON', gtype=3,
driver='ESRI Shapefile', driver='ESRI Shapefile',
fields={'float': OFTReal, 'int': OFTInteger, 'str': OFTString}, fields={'float': OFTReal, 'int': OFTInteger, 'str': OFTString},
extent=(-1.01513, -0.558245, 0.161876, 0.839637), # Got extent from QGIS extent=(-1.01513, -0.558245, 0.161876, 0.839637), # Got extent from QGIS
srs_wkt='GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]'), srs_wkt='GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]'),
) )

View File

@ -23,7 +23,7 @@ class EnvelopeTest(unittest.TestCase):
"Testing Envelope initilization." "Testing Envelope initilization."
e1 = Envelope((0, 0, 5, 5)) e1 = Envelope((0, 0, 5, 5))
Envelope(0, 0, 5, 5) Envelope(0, 0, 5, 5)
Envelope(0, '0', '5', 5) # Thanks to ww for this Envelope(0, '0', '5', 5) # Thanks to ww for this
Envelope(e1._envelope) Envelope(e1._envelope)
self.assertRaises(OGRException, Envelope, (5, 5, 0, 0)) self.assertRaises(OGRException, Envelope, (5, 5, 0, 0))
self.assertRaises(OGRException, Envelope, 5, 5, 0, 0) self.assertRaises(OGRException, Envelope, 5, 5, 0, 0)

View File

@ -130,7 +130,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin):
OGRGeometry('POINT(0 0)') OGRGeometry('POINT(0 0)')
for p in self.geometries.points: for p in self.geometries.points:
if not hasattr(p, 'z'): # No 3D if not hasattr(p, 'z'): # No 3D
pnt = OGRGeometry(p.wkt) pnt = OGRGeometry(p.wkt)
self.assertEqual(1, pnt.geom_type) self.assertEqual(1, pnt.geom_type)
self.assertEqual('POINT', pnt.geom_name) self.assertEqual('POINT', pnt.geom_name)
@ -141,15 +141,15 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin):
def test03_multipoints(self): def test03_multipoints(self):
"Testing MultiPoint objects." "Testing MultiPoint objects."
for mp in self.geometries.multipoints: for mp in self.geometries.multipoints:
mgeom1 = OGRGeometry(mp.wkt) # First one from WKT mgeom1 = OGRGeometry(mp.wkt) # First one from WKT
self.assertEqual(4, mgeom1.geom_type) self.assertEqual(4, mgeom1.geom_type)
self.assertEqual('MULTIPOINT', mgeom1.geom_name) self.assertEqual('MULTIPOINT', mgeom1.geom_name)
mgeom2 = OGRGeometry('MULTIPOINT') # Creating empty multipoint mgeom2 = OGRGeometry('MULTIPOINT') # Creating empty multipoint
mgeom3 = OGRGeometry('MULTIPOINT') mgeom3 = OGRGeometry('MULTIPOINT')
for g in mgeom1: for g in mgeom1:
mgeom2.add(g) # adding each point from the multipoints mgeom2.add(g) # adding each point from the multipoints
mgeom3.add(g.wkt) # should take WKT as well mgeom3.add(g.wkt) # should take WKT as well
self.assertEqual(mgeom1, mgeom2) # they should equal self.assertEqual(mgeom1, mgeom2) # they should equal
self.assertEqual(mgeom1, mgeom3) self.assertEqual(mgeom1, mgeom3)
self.assertEqual(mp.coords, mgeom2.coords) self.assertEqual(mp.coords, mgeom2.coords)
self.assertEqual(mp.n_p, mgeom2.point_count) self.assertEqual(mp.n_p, mgeom2.point_count)
@ -247,7 +247,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin):
poly.centroid poly.centroid
poly.close_rings() poly.close_rings()
self.assertEqual(10, poly.point_count) # Two closing points should've been added self.assertEqual(10, poly.point_count) # Two closing points should've been added
self.assertEqual(OGRGeometry('POINT(2.5 2.5)'), poly.centroid) self.assertEqual(OGRGeometry('POINT(2.5 2.5)'), poly.centroid)
def test08_multipolygons(self): def test08_multipolygons(self):
@ -309,7 +309,7 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin):
# Changing each ring in the polygon # Changing each ring in the polygon
self.assertEqual(32140, ring.srs.srid) self.assertEqual(32140, ring.srs.srid)
self.assertEqual('NAD83 / Texas South Central', ring.srs.name) self.assertEqual('NAD83 / Texas South Central', ring.srs.name)
ring.srs = str(SpatialReference(4326)) # back to WGS84 ring.srs = str(SpatialReference(4326)) # back to WGS84
self.assertEqual(4326, ring.srs.srid) self.assertEqual(4326, ring.srs.srid)
# Using the `srid` property. # Using the `srid` property.
@ -361,8 +361,8 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin):
d1 = OGRGeometry(self.geometries.diff_geoms[i].wkt) d1 = OGRGeometry(self.geometries.diff_geoms[i].wkt)
d2 = a.difference(b) d2 = a.difference(b)
self.assertEqual(d1, d2) self.assertEqual(d1, d2)
self.assertEqual(d1, a - b) # __sub__ is difference operator self.assertEqual(d1, a - b) # __sub__ is difference operator
a -= b # testing __isub__ a -= b # testing __isub__
self.assertEqual(d1, a) self.assertEqual(d1, a)
def test11_intersection(self): def test11_intersection(self):
@ -374,8 +374,8 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin):
self.assertTrue(a.intersects(b)) self.assertTrue(a.intersects(b))
i2 = a.intersection(b) i2 = a.intersection(b)
self.assertEqual(i1, i2) self.assertEqual(i1, i2)
self.assertEqual(i1, a & b) # __and__ is intersection operator self.assertEqual(i1, a & b) # __and__ is intersection operator
a &= b # testing __iand__ a &= b # testing __iand__
self.assertEqual(i1, a) self.assertEqual(i1, a)
def test12_symdifference(self): def test12_symdifference(self):
@ -386,8 +386,8 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin):
d1 = OGRGeometry(self.geometries.sdiff_geoms[i].wkt) d1 = OGRGeometry(self.geometries.sdiff_geoms[i].wkt)
d2 = a.sym_difference(b) d2 = a.sym_difference(b)
self.assertEqual(d1, d2) self.assertEqual(d1, d2)
self.assertEqual(d1, a ^ b) # __xor__ is symmetric difference operator self.assertEqual(d1, a ^ b) # __xor__ is symmetric difference operator
a ^= b # testing __ixor__ a ^= b # testing __ixor__
self.assertEqual(d1, a) self.assertEqual(d1, a)
def test13_union(self): def test13_union(self):
@ -398,8 +398,8 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin):
u1 = OGRGeometry(self.geometries.union_geoms[i].wkt) u1 = OGRGeometry(self.geometries.union_geoms[i].wkt)
u2 = a.union(b) u2 = a.union(b)
self.assertEqual(u1, u2) self.assertEqual(u1, u2)
self.assertEqual(u1, a | b) # __or__ is union operator self.assertEqual(u1, a | b) # __or__ is union operator
a |= b # testing __ior__ a |= b # testing __ior__
self.assertEqual(u1, a) self.assertEqual(u1, a)
def test14_add(self): def test14_add(self):
@ -418,9 +418,9 @@ class OGRGeomTest(unittest.TestCase, TestDataMixin):
mp3 = OGRGeometry('MultiPolygon') mp3 = OGRGeometry('MultiPolygon')
for poly in mpoly: for poly in mpoly:
mp1.add(poly) # Adding a geometry at a time mp1.add(poly) # Adding a geometry at a time
mp2.add(poly.wkt) # Adding WKT mp2.add(poly.wkt) # Adding WKT
mp3.add(mpoly) # Adding a MultiPolygon's entire contents at once. mp3.add(mpoly) # Adding a MultiPolygon's entire contents at once.
for tmp in (mp1, mp2, mp3): for tmp in (mp1, mp2, mp3):
self.assertEqual(mpoly, tmp) self.assertEqual(mpoly, tmp)

View File

@ -127,8 +127,8 @@ class SpatialRefTest(unittest.TestCase):
for s in srlist: for s in srlist:
srs = SpatialReference(s.wkt) srs = SpatialReference(s.wkt)
for tup in s.attr: for tup in s.attr:
att = tup[0] # Attribute to test att = tup[0] # Attribute to test
exp = tup[1] # Expected result exp = tup[1] # Expected result
self.assertEqual(exp, srs[att]) self.assertEqual(exp, srs[att])
def test11_wellknown(self): def test11_wellknown(self):

View File

@ -30,10 +30,10 @@ class GeoIPTest(unittest.TestCase):
def test01_init(self): def test01_init(self):
"Testing GeoIP initialization." "Testing GeoIP initialization."
g1 = GeoIP() # Everything inferred from GeoIP path g1 = GeoIP() # Everything inferred from GeoIP path
path = settings.GEOIP_PATH path = settings.GEOIP_PATH
g2 = GeoIP(path, 0) # Passing in data path explicitly. g2 = GeoIP(path, 0) # Passing in data path explicitly.
g3 = GeoIP.open(path, 0) # MaxMind Python API syntax. g3 = GeoIP.open(path, 0) # MaxMind Python API syntax.
for g in (g1, g2, g3): for g in (g1, g2, g3):
self.assertEqual(True, bool(g._country)) self.assertEqual(True, bool(g._country))

View File

@ -47,7 +47,7 @@ class LineString(GEOSGeometry):
raise TypeError('Dimension mismatch.') raise TypeError('Dimension mismatch.')
numpy_coords = False numpy_coords = False
elif numpy and isinstance(coords, numpy.ndarray): elif numpy and isinstance(coords, numpy.ndarray):
shape = coords.shape # Using numpy's shape. shape = coords.shape # Using numpy's shape.
if len(shape) != 2: if len(shape) != 2:
raise TypeError('Too many dimensions.') raise TypeError('Too many dimensions.')
self._checkdim(shape[1]) self._checkdim(shape[1])
@ -91,8 +91,8 @@ class LineString(GEOSGeometry):
_get_single_internal = _get_single_external _get_single_internal = _get_single_external
def _set_list(self, length, items): def _set_list(self, length, items):
ndim = self._cs.dims # ndim = self._cs.dims
hasz = self._cs.hasz # I don't understand why these are different hasz = self._cs.hasz # I don't understand why these are different
# create a new coordinate sequence and populate accordingly # create a new coordinate sequence and populate accordingly
cs = GEOSCoordSeq(capi.create_cs(length, ndim), z=hasz) cs = GEOSCoordSeq(capi.create_cs(length, ndim), z=hasz)
@ -130,7 +130,7 @@ class LineString(GEOSGeometry):
""" """
lst = [func(i) for i in xrange(len(self))] lst = [func(i) for i in xrange(len(self))]
if numpy: if numpy:
return numpy.array(lst) # ARRRR! return numpy.array(lst) # ARRRR!
else: else:
return lst return lst

View File

@ -58,7 +58,7 @@ def check_minus_one(result, func, cargs):
def check_predicate(result, func, cargs): def check_predicate(result, func, cargs):
"Error checking for unary/binary predicate functions." "Error checking for unary/binary predicate functions."
val = ord(result) # getting the ordinal from the character val = ord(result) # getting the ordinal from the character
if val == 1: if val == 1:
return True return True
elif val == 0: elif val == 0:

View File

@ -21,7 +21,7 @@ def dbl_from_geom(func, num_geom=1):
argtypes = [GEOM_PTR for i in xrange(num_geom)] argtypes = [GEOM_PTR for i in xrange(num_geom)]
argtypes += [POINTER(c_double)] argtypes += [POINTER(c_double)]
func.argtypes = argtypes func.argtypes = argtypes
func.restype = c_int # Status code returned func.restype = c_int # Status code returned
func.errcheck = check_dbl func.errcheck = check_dbl
return func return func

View File

@ -198,7 +198,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
poly = fromstr(ewkt) poly = fromstr(ewkt)
self.assertEqual(srid, poly.srid) self.assertEqual(srid, poly.srid)
self.assertEqual(srid, poly.shell.srid) self.assertEqual(srid, poly.shell.srid)
self.assertEqual(srid, fromstr(poly.ewkt).srid) # Checking export self.assertEqual(srid, fromstr(poly.ewkt).srid) # Checking export
@skipUnless(HAS_GDAL, "GDAL is required.") @skipUnless(HAS_GDAL, "GDAL is required.")
def test_json(self): def test_json(self):
@ -279,7 +279,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
# Now testing the different constructors # Now testing the different constructors
pnt2 = Point(tup_args) # e.g., Point((1, 2)) pnt2 = Point(tup_args) # e.g., Point((1, 2))
pnt3 = Point(*tup_args) # e.g., Point(1, 2) pnt3 = Point(*tup_args) # e.g., Point(1, 2)
self.assertEqual(True, pnt == pnt2) self.assertEqual(True, pnt == pnt2)
self.assertEqual(True, pnt == pnt3) self.assertEqual(True, pnt == pnt3)
@ -295,7 +295,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
pnt.coords = set_tup2 pnt.coords = set_tup2
self.assertEqual(set_tup2, pnt.coords) self.assertEqual(set_tup2, pnt.coords)
prev = pnt # setting the previous geometry prev = pnt # setting the previous geometry
def test_multipoints(self): def test_multipoints(self):
"Testing MultiPoint objects." "Testing MultiPoint objects."
@ -337,11 +337,11 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
# Creating a LineString from a tuple, list, and numpy array # Creating a LineString from a tuple, list, and numpy array
self.assertEqual(ls, LineString(ls.tuple)) # tuple self.assertEqual(ls, LineString(ls.tuple)) # tuple
self.assertEqual(ls, LineString(*ls.tuple)) # as individual arguments self.assertEqual(ls, LineString(*ls.tuple)) # as individual arguments
self.assertEqual(ls, LineString([list(tup) for tup in ls.tuple])) # as list self.assertEqual(ls, LineString([list(tup) for tup in ls.tuple])) # as list
self.assertEqual(ls.wkt, LineString(*tuple(Point(tup) for tup in ls.tuple)).wkt) # Point individual arguments self.assertEqual(ls.wkt, LineString(*tuple(Point(tup) for tup in ls.tuple)).wkt) # Point individual arguments
if numpy: if numpy:
self.assertEqual(ls, LineString(numpy.array(ls.tuple))) # as numpy array self.assertEqual(ls, LineString(numpy.array(ls.tuple))) # as numpy array
def test_multilinestring(self): def test_multilinestring(self):
"Testing MultiLineString objects." "Testing MultiLineString objects."
@ -409,7 +409,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
self.assertEqual(poly.empty, False) self.assertEqual(poly.empty, False)
self.assertEqual(poly.ring, False) self.assertEqual(poly.ring, False)
self.assertEqual(p.n_i, poly.num_interior_rings) self.assertEqual(p.n_i, poly.num_interior_rings)
self.assertEqual(p.n_i + 1, len(poly)) # Testing __len__ self.assertEqual(p.n_i + 1, len(poly)) # Testing __len__
self.assertEqual(p.n_p, poly.num_points) self.assertEqual(p.n_p, poly.num_points)
# Area & Centroid # Area & Centroid
@ -419,7 +419,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
# Testing the geometry equivalence # Testing the geometry equivalence
self.assertEqual(True, poly == fromstr(p.wkt)) self.assertEqual(True, poly == fromstr(p.wkt))
self.assertEqual(False, poly == prev) # Should not be equal to previous geometry self.assertEqual(False, poly == prev) # Should not be equal to previous geometry
self.assertEqual(True, poly != prev) self.assertEqual(True, poly != prev)
# Testing the exterior ring # Testing the exterior ring
@ -428,7 +428,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
self.assertEqual(ring.geom_typeid, 2) self.assertEqual(ring.geom_typeid, 2)
if p.ext_ring_cs: if p.ext_ring_cs:
self.assertEqual(p.ext_ring_cs, ring.tuple) self.assertEqual(p.ext_ring_cs, ring.tuple)
self.assertEqual(p.ext_ring_cs, poly[0].tuple) # Testing __getitem__ self.assertEqual(p.ext_ring_cs, poly[0].tuple) # Testing __getitem__
# Testing __getitem__ and __setitem__ on invalid indices # Testing __getitem__ and __setitem__ on invalid indices
self.assertRaises(GEOSIndexError, poly.__getitem__, len(poly)) self.assertRaises(GEOSIndexError, poly.__getitem__, len(poly))
@ -522,13 +522,13 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
poly = fromstr(p.wkt) poly = fromstr(p.wkt)
cs = poly.exterior_ring.coord_seq cs = poly.exterior_ring.coord_seq
self.assertEqual(p.ext_ring_cs, cs.tuple) # done in the Polygon test too. self.assertEqual(p.ext_ring_cs, cs.tuple) # done in the Polygon test too.
self.assertEqual(len(p.ext_ring_cs), len(cs)) # Making sure __len__ works self.assertEqual(len(p.ext_ring_cs), len(cs)) # Making sure __len__ works
# Checks __getitem__ and __setitem__ # Checks __getitem__ and __setitem__
for i in xrange(len(p.ext_ring_cs)): for i in xrange(len(p.ext_ring_cs)):
c1 = p.ext_ring_cs[i] # Expected value c1 = p.ext_ring_cs[i] # Expected value
c2 = cs[i] # Value from coordseq c2 = cs[i] # Value from coordseq
self.assertEqual(c1, c2) self.assertEqual(c1, c2)
# Constructing the test value to set the coordinate sequence with # Constructing the test value to set the coordinate sequence with
@ -562,8 +562,8 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
self.assertEqual(True, a.intersects(b)) self.assertEqual(True, a.intersects(b))
i2 = a.intersection(b) i2 = a.intersection(b)
self.assertEqual(i1, i2) self.assertEqual(i1, i2)
self.assertEqual(i1, a & b) # __and__ is intersection operator self.assertEqual(i1, a & b) # __and__ is intersection operator
a &= b # testing __iand__ a &= b # testing __iand__
self.assertEqual(i1, a) self.assertEqual(i1, a)
def test_union(self): def test_union(self):
@ -574,8 +574,8 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
u1 = fromstr(self.geometries.union_geoms[i].wkt) u1 = fromstr(self.geometries.union_geoms[i].wkt)
u2 = a.union(b) u2 = a.union(b)
self.assertEqual(u1, u2) self.assertEqual(u1, u2)
self.assertEqual(u1, a | b) # __or__ is union operator self.assertEqual(u1, a | b) # __or__ is union operator
a |= b # testing __ior__ a |= b # testing __ior__
self.assertEqual(u1, a) self.assertEqual(u1, a)
def test_difference(self): def test_difference(self):
@ -586,8 +586,8 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
d1 = fromstr(self.geometries.diff_geoms[i].wkt) d1 = fromstr(self.geometries.diff_geoms[i].wkt)
d2 = a.difference(b) d2 = a.difference(b)
self.assertEqual(d1, d2) self.assertEqual(d1, d2)
self.assertEqual(d1, a - b) # __sub__ is difference operator self.assertEqual(d1, a - b) # __sub__ is difference operator
a -= b # testing __isub__ a -= b # testing __isub__
self.assertEqual(d1, a) self.assertEqual(d1, a)
def test_symdifference(self): def test_symdifference(self):
@ -598,8 +598,8 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
d1 = fromstr(self.geometries.sdiff_geoms[i].wkt) d1 = fromstr(self.geometries.sdiff_geoms[i].wkt)
d2 = a.sym_difference(b) d2 = a.sym_difference(b)
self.assertEqual(d1, d2) self.assertEqual(d1, d2)
self.assertEqual(d1, a ^ b) # __xor__ is symmetric difference operator self.assertEqual(d1, a ^ b) # __xor__ is symmetric difference operator
a ^= b # testing __ixor__ a ^= b # testing __ixor__
self.assertEqual(d1, a) self.assertEqual(d1, a)
def test_buffer(self): def test_buffer(self):
@ -667,7 +667,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
p2 = fromstr(p1.hex) p2 = fromstr(p1.hex)
self.assertEqual(exp_srid, p2.srid) self.assertEqual(exp_srid, p2.srid)
p3 = fromstr(p1.hex, srid=-1) # -1 is intended. p3 = fromstr(p1.hex, srid=-1) # -1 is intended.
self.assertEqual(-1, p3.srid) self.assertEqual(-1, p3.srid)
@skipUnless(HAS_GDAL, "GDAL is required.") @skipUnless(HAS_GDAL, "GDAL is required.")
@ -705,7 +705,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
# Assigning polygon's exterior ring w/the new shell # Assigning polygon's exterior ring w/the new shell
poly.exterior_ring = new_shell poly.exterior_ring = new_shell
str(new_shell) # new shell is still accessible str(new_shell) # new shell is still accessible
self.assertEqual(poly.exterior_ring, new_shell) self.assertEqual(poly.exterior_ring, new_shell)
self.assertEqual(poly[0], new_shell) self.assertEqual(poly[0], new_shell)
@ -718,7 +718,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
new = Point(random.randint(21, 100), random.randint(21, 100)) new = Point(random.randint(21, 100), random.randint(21, 100))
# Testing the assignment # Testing the assignment
mp[i] = new mp[i] = new
str(new) # what was used for the assignment is still accessible str(new) # what was used for the assignment is still accessible
self.assertEqual(mp[i], new) self.assertEqual(mp[i], new)
self.assertEqual(mp[i].wkt, new.wkt) self.assertEqual(mp[i].wkt, new.wkt)
self.assertNotEqual(pnt, mp[i]) self.assertNotEqual(pnt, mp[i])
@ -740,7 +740,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
self.assertNotEqual(mpoly[i], poly) self.assertNotEqual(mpoly[i], poly)
# Testing the assignment # Testing the assignment
mpoly[i] = poly mpoly[i] = poly
str(poly) # Still accessible str(poly) # Still accessible
self.assertEqual(mpoly[i], poly) self.assertEqual(mpoly[i], poly)
self.assertNotEqual(mpoly[i], old_poly) self.assertNotEqual(mpoly[i], old_poly)
@ -821,7 +821,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
# Testing len() and num_geom. # Testing len() and num_geom.
if isinstance(g, Polygon): if isinstance(g, Polygon):
self.assertEqual(1, len(g)) # Has one empty linear ring self.assertEqual(1, len(g)) # Has one empty linear ring
self.assertEqual(1, g.num_geom) self.assertEqual(1, g.num_geom)
self.assertEqual(0, len(g[0])) self.assertEqual(0, len(g[0]))
elif isinstance(g, (Point, LineString)): elif isinstance(g, (Point, LineString)):
@ -1039,7 +1039,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
# A set of test points. # A set of test points.
pnts = [Point(5, 5), Point(7.5, 7.5), Point(2.5, 7.5)] pnts = [Point(5, 5), Point(7.5, 7.5), Point(2.5, 7.5)]
covers = [True, True, False] # No `covers` op for regular GEOS geoms. covers = [True, True, False] # No `covers` op for regular GEOS geoms.
for pnt, c in zip(pnts, covers): for pnt, c in zip(pnts, covers):
# Results should be the same (but faster) # Results should be the same (but faster)
self.assertEqual(mpoly.contains(pnt), prep.contains(pnt)) self.assertEqual(mpoly.contains(pnt), prep.contains(pnt))

View File

@ -223,9 +223,9 @@ class ListMixinTest(unittest.TestCase):
del x[i] del x[i]
pl, ul = self.lists_of_len() pl, ul = self.lists_of_len()
for i in (-1 - self.limit, self.limit): for i in (-1 - self.limit, self.limit):
self.assertRaises(IndexError, setfcn, ul, i) # 'set index %d' % i) self.assertRaises(IndexError, setfcn, ul, i) # 'set index %d' % i)
self.assertRaises(IndexError, getfcn, ul, i) # 'get index %d' % i) self.assertRaises(IndexError, getfcn, ul, i) # 'get index %d' % i)
self.assertRaises(IndexError, delfcn, ul, i) # 'del index %d' % i) self.assertRaises(IndexError, delfcn, ul, i) # 'del index %d' % i)
def test06_list_methods(self): def test06_list_methods(self):
'List methods' 'List methods'

View File

@ -20,9 +20,9 @@ class GoogleMap(object):
"A class for generating Google Maps JavaScript." "A class for generating Google Maps JavaScript."
# String constants # String constants
onunload = mark_safe('onunload="GUnload()"') # Cleans up after Google Maps onunload = mark_safe('onunload="GUnload()"') # Cleans up after Google Maps
vml_css = mark_safe('v\:* {behavior:url(#default#VML);}') # CSS for IE VML vml_css = mark_safe('v\:* {behavior:url(#default#VML);}') # CSS for IE VML
xmlns = mark_safe('xmlns:v="urn:schemas-microsoft-com:vml"') # XML Namespace (for IE VML). xmlns = mark_safe('xmlns:v="urn:schemas-microsoft-com:vml"') # XML Namespace (for IE VML).
def __init__(self, key=None, api_url=None, version=None, def __init__(self, key=None, api_url=None, version=None,
center=None, zoom=None, dom_id='map', center=None, zoom=None, dom_id='map',

View File

@ -33,18 +33,18 @@ class GoogleZoom(object):
# Initializing arrays to hold the parameters for each one of the # Initializing arrays to hold the parameters for each one of the
# zoom levels. # zoom levels.
self._degpp = [] # Degrees per pixel self._degpp = [] # Degrees per pixel
self._radpp = [] # Radians per pixel self._radpp = [] # Radians per pixel
self._npix = [] # 1/2 the number of pixels for a tile at the given zoom level self._npix = [] # 1/2 the number of pixels for a tile at the given zoom level
# Incrementing through the zoom levels and populating the parameter arrays. # Incrementing through the zoom levels and populating the parameter arrays.
z = tilesize # The number of pixels per zoom level. z = tilesize # The number of pixels per zoom level.
for i in xrange(num_zoom): for i in xrange(num_zoom):
# Getting the degrees and radians per pixel, and the 1/2 the number of # Getting the degrees and radians per pixel, and the 1/2 the number of
# for every zoom level. # for every zoom level.
self._degpp.append(z / 360.) # degrees per pixel self._degpp.append(z / 360.) # degrees per pixel
self._radpp.append(z / (2 * pi)) # radians per pixel self._radpp.append(z / (2 * pi)) # radians per pixel
self._npix.append(z / 2) # number of pixels to center of tile self._npix.append(z / 2) # number of pixels to center of tile
# Multiplying `z` by 2 for the next iteration. # Multiplying `z` by 2 for the next iteration.
z *= 2 z *= 2

View File

@ -5,7 +5,7 @@ from unittest import skipUnless
from django.db import connection from django.db import connection
from django.db.models import Q from django.db.models import Q
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.measure import D # alias for Distance from django.contrib.gis.measure import D # alias for Distance
from django.contrib.gis.tests.utils import ( from django.contrib.gis.tests.utils import (
HAS_SPATIAL_DB, mysql, oracle, postgis, spatialite, no_oracle, no_spatialite HAS_SPATIAL_DB, mysql, oracle, postgis, spatialite, no_oracle, no_spatialite
) )
@ -123,7 +123,7 @@ class DistanceTest(TestCase):
if spatialite or oracle: if spatialite or oracle:
dist_qs = [dist1, dist2] dist_qs = [dist1, dist2]
else: else:
dist3 = SouthTexasCityFt.objects.distance(lagrange.ewkt) # Using EWKT string parameter. dist3 = SouthTexasCityFt.objects.distance(lagrange.ewkt) # Using EWKT string parameter.
dist4 = SouthTexasCityFt.objects.distance(lagrange) dist4 = SouthTexasCityFt.objects.distance(lagrange)
dist_qs = [dist1, dist2, dist3, dist4] dist_qs = [dist1, dist2, dist3, dist4]
@ -199,7 +199,7 @@ class DistanceTest(TestCase):
for i, c in enumerate(qs): for i, c in enumerate(qs):
self.assertAlmostEqual(sphere_distances[i], c.distance.m, tol) self.assertAlmostEqual(sphere_distances[i], c.distance.m, tol)
@no_oracle # Oracle already handles geographic distance calculation. @no_oracle # Oracle already handles geographic distance calculation.
def test_distance_transform(self): def test_distance_transform(self):
""" """
Test the `distance` GeoQuerySet method used with `transform` on a geographic field. Test the `distance` GeoQuerySet method used with `transform` on a geographic field.
@ -307,7 +307,7 @@ class DistanceTest(TestCase):
# Cities that are either really close or really far from Wollongong -- # Cities that are either really close or really far from Wollongong --
# and using different units of distance. # and using different units of distance.
wollongong = AustraliaCity.objects.get(name='Wollongong') wollongong = AustraliaCity.objects.get(name='Wollongong')
d1, d2 = D(yd=19500), D(nm=400) # Yards (~17km) & Nautical miles. d1, d2 = D(yd=19500), D(nm=400) # Yards (~17km) & Nautical miles.
# Normal geodetic distance lookup (uses `distance_sphere` on PostGIS. # Normal geodetic distance lookup (uses `distance_sphere` on PostGIS.
gq1 = Q(point__distance_lte=(wollongong.point, d1)) gq1 = Q(point__distance_lte=(wollongong.point, d1))

View File

@ -9,7 +9,7 @@ null_flag = not mysql
@python_2_unicode_compatible @python_2_unicode_compatible
class Country(models.Model): class Country(models.Model):
name = models.CharField(max_length=30) name = models.CharField(max_length=30)
mpoly = models.MultiPolygonField() # SRID, by default, is 4326 mpoly = models.MultiPolygonField() # SRID, by default, is 4326
objects = models.GeoManager() objects = models.GeoManager()
def __str__(self): def __str__(self):
@ -30,13 +30,13 @@ class City(models.Model):
class PennsylvaniaCity(City): class PennsylvaniaCity(City):
county = models.CharField(max_length=30) county = models.CharField(max_length=30)
founded = models.DateTimeField(null=True) founded = models.DateTimeField(null=True)
objects = models.GeoManager() # TODO: This should be implicitly inherited. objects = models.GeoManager() # TODO: This should be implicitly inherited.
@python_2_unicode_compatible @python_2_unicode_compatible
class State(models.Model): class State(models.Model):
name = models.CharField(max_length=30) name = models.CharField(max_length=30)
poly = models.PolygonField(null=null_flag) # Allowing NULL geometries here. poly = models.PolygonField(null=null_flag) # Allowing NULL geometries here.
objects = models.GeoManager() objects = models.GeoManager()
def __str__(self): def __str__(self):
@ -68,5 +68,5 @@ if not spatialite:
return self.name return self.name
class MinusOneSRID(models.Model): class MinusOneSRID(models.Model):
geom = models.PointField(srid=-1) # Minus one SRID. geom = models.PointField(srid=-1) # Minus one SRID.
objects = models.GeoManager() objects = models.GeoManager()

View File

@ -92,5 +92,5 @@ class GeoFeedTest(TestCase):
self.assertChildNodes(item, ['title', 'link', 'description', 'guid', 'geo:lat', 'geo:lon']) self.assertChildNodes(item, ['title', 'link', 'description', 'guid', 'geo:lat', 'geo:lon'])
# Boxes and Polygons aren't allowed in W3C Geo feeds. # Boxes and Polygons aren't allowed in W3C Geo feeds.
self.assertRaises(ValueError, self.client.get, '/feeds/w3cgeo2/') # Box in <channel> self.assertRaises(ValueError, self.client.get, '/feeds/w3cgeo2/') # Box in <channel>
self.assertRaises(ValueError, self.client.get, '/feeds/w3cgeo3/') # Polygons in <entry> self.assertRaises(ValueError, self.client.get, '/feeds/w3cgeo3/') # Polygons in <entry>

View File

@ -59,7 +59,7 @@ class GeoSitemapTest(TestCase):
self.assertEqual(urlset.getAttribute('xmlns:geo'), 'http://www.google.com/geo/schemas/sitemap/1.0') self.assertEqual(urlset.getAttribute('xmlns:geo'), 'http://www.google.com/geo/schemas/sitemap/1.0')
urls = urlset.getElementsByTagName('url') urls = urlset.getElementsByTagName('url')
self.assertEqual(2, len(urls)) # Should only be 2 sitemaps. self.assertEqual(2, len(urls)) # Should only be 2 sitemaps.
for url in urls: for url in urls:
self.assertChildNodes(url, ['loc', 'geo:geo']) self.assertChildNodes(url, ['loc', 'geo:geo'])
# Making sure the 'geo:format' element was properly set. # Making sure the 'geo:format' element was properly set.

View File

@ -84,7 +84,7 @@ class GeoModelTest(TestCase):
# Creating a State object using a built Polygon # Creating a State object using a built Polygon
ply = Polygon(shell, inner) ply = Polygon(shell, inner)
nullstate = State(name='NullState', poly=ply) nullstate = State(name='NullState', poly=ply)
self.assertEqual(4326, nullstate.poly.srid) # SRID auto-set from None self.assertEqual(4326, nullstate.poly.srid) # SRID auto-set from None
nullstate.save() nullstate.save()
ns = State.objects.get(name='NullState') ns = State.objects.get(name='NullState')
@ -111,7 +111,7 @@ class GeoModelTest(TestCase):
"Testing automatic transform for lookups and inserts." "Testing automatic transform for lookups and inserts."
# San Antonio in 'WGS84' (SRID 4326) # San Antonio in 'WGS84' (SRID 4326)
sa_4326 = 'POINT (-98.493183 29.424170)' sa_4326 = 'POINT (-98.493183 29.424170)'
wgs_pnt = fromstr(sa_4326, srid=4326) # Our reference point in WGS84 wgs_pnt = fromstr(sa_4326, srid=4326) # Our reference point in WGS84
# Oracle doesn't have SRID 3084, using 41157. # Oracle doesn't have SRID 3084, using 41157.
if oracle: if oracle:
@ -122,7 +122,7 @@ class GeoModelTest(TestCase):
nad_srid = 41157 nad_srid = 41157
else: else:
# San Antonio in 'NAD83(HARN) / Texas Centric Lambert Conformal' (SRID 3084) # San Antonio in 'NAD83(HARN) / Texas Centric Lambert Conformal' (SRID 3084)
nad_wkt = 'POINT (1645978.362408288754523 6276356.025927528738976)' # Used ogr.py in gdal 1.4.1 for this transform nad_wkt = 'POINT (1645978.362408288754523 6276356.025927528738976)' # Used ogr.py in gdal 1.4.1 for this transform
nad_srid = 3084 nad_srid = 3084
# Constructing & querying with a point from a different SRID. Oracle # Constructing & querying with a point from a different SRID. Oracle
@ -156,7 +156,7 @@ class GeoModelTest(TestCase):
c = City() c = City()
self.assertEqual(c.point, None) self.assertEqual(c.point, None)
@no_spatialite # SpatiaLite does not support abstract geometry columns @no_spatialite # SpatiaLite does not support abstract geometry columns
def test_geometryfield(self): def test_geometryfield(self):
"Testing the general GeometryField." "Testing the general GeometryField."
Feature(name='Point', geom=Point(1, 1)).save() Feature(name='Point', geom=Point(1, 1)).save()
@ -242,8 +242,8 @@ class GeoLookupTest(TestCase):
# Now testing contains on the countries using the points for # Now testing contains on the countries using the points for
# Houston and Wellington. # Houston and Wellington.
tx = Country.objects.get(mpoly__contains=houston.point) # Query w/GEOSGeometry tx = Country.objects.get(mpoly__contains=houston.point) # Query w/GEOSGeometry
nz = Country.objects.get(mpoly__contains=wellington.point.hex) # Query w/EWKBHEX nz = Country.objects.get(mpoly__contains=wellington.point.hex) # Query w/EWKBHEX
self.assertEqual('Texas', tx.name) self.assertEqual('Texas', tx.name)
self.assertEqual('New Zealand', nz.name) self.assertEqual('New Zealand', nz.name)
@ -254,9 +254,9 @@ class GeoLookupTest(TestCase):
# Pueblo and Oklahoma City (even though OK City is within the bounding box of Texas) # Pueblo and Oklahoma City (even though OK City is within the bounding box of Texas)
# are not contained in Texas or New Zealand. # are not contained in Texas or New Zealand.
self.assertEqual(0, len(Country.objects.filter(mpoly__contains=pueblo.point))) # Query w/GEOSGeometry object self.assertEqual(0, len(Country.objects.filter(mpoly__contains=pueblo.point))) # Query w/GEOSGeometry object
self.assertEqual((mysql and 1) or 0, self.assertEqual((mysql and 1) or 0,
len(Country.objects.filter(mpoly__contains=okcity.point.wkt))) # Qeury w/WKT len(Country.objects.filter(mpoly__contains=okcity.point.wkt))) # Qeury w/WKT
# OK City is contained w/in bounding box of Texas. # OK City is contained w/in bounding box of Texas.
if not oracle: if not oracle:
@ -446,7 +446,7 @@ class GeoQuerySetTest(TestCase):
self.assertIsInstance(country.envelope, Polygon) self.assertIsInstance(country.envelope, Polygon)
@no_mysql @no_mysql
@no_spatialite # SpatiaLite does not have an Extent function @no_spatialite # SpatiaLite does not have an Extent function
def test_extent(self): def test_extent(self):
"Testing the `extent` GeoQuerySet method." "Testing the `extent` GeoQuerySet method."
# Reference query: # Reference query:
@ -618,7 +618,7 @@ class GeoQuerySetTest(TestCase):
self.assertEqual(1, c.num_geom) self.assertEqual(1, c.num_geom)
@no_mysql @no_mysql
@no_spatialite # SpatiaLite can only count vertices in LineStrings @no_spatialite # SpatiaLite can only count vertices in LineStrings
def test_num_points(self): def test_num_points(self):
"Testing the `num_points` GeoQuerySet method." "Testing the `num_points` GeoQuerySet method."
for c in Country.objects.num_points(): for c in Country.objects.num_points():
@ -671,7 +671,7 @@ class GeoQuerySetTest(TestCase):
def test_scale(self): def test_scale(self):
"Testing the `scale` GeoQuerySet method." "Testing the `scale` GeoQuerySet method."
xfac, yfac = 2, 3 xfac, yfac = 2, 3
tol = 5 # XXX The low precision tolerance is for SpatiaLite tol = 5 # XXX The low precision tolerance is for SpatiaLite
qs = Country.objects.scale(xfac, yfac, model_att='scaled') qs = Country.objects.scale(xfac, yfac, model_att='scaled')
for c in qs: for c in qs:
for p1, p2 in zip(c.mpoly, c.scaled): for p1, p2 in zip(c.mpoly, c.scaled):
@ -740,7 +740,7 @@ class GeoQuerySetTest(TestCase):
# Pre-transformed points for Houston and Pueblo. # Pre-transformed points for Houston and Pueblo.
htown = fromstr('POINT(1947516.83115183 6322297.06040572)', srid=3084) htown = fromstr('POINT(1947516.83115183 6322297.06040572)', srid=3084)
ptown = fromstr('POINT(992363.390841912 481455.395105533)', srid=2774) ptown = fromstr('POINT(992363.390841912 481455.395105533)', srid=2774)
prec = 3 # Precision is low due to version variations in PROJ and GDAL. prec = 3 # Precision is low due to version variations in PROJ and GDAL.
# Asserting the result of the transform operation with the values in # Asserting the result of the transform operation with the values in
# the pre-transformed points. Oracle does not have the 3084 SRID. # the pre-transformed points. Oracle does not have the 3084 SRID.

View File

@ -48,7 +48,7 @@ class GeographyTest(TestCase):
"Ensuring exceptions are raised for operators & functions invalid on geography fields." "Ensuring exceptions are raised for operators & functions invalid on geography fields."
# Only a subset of the geometry functions & operator are available # Only a subset of the geometry functions & operator are available
# to PostGIS geography types. For more information, visit: # to PostGIS geography types. For more information, visit:
# http://postgis.refractions.net/documentation/manual-1.5/ch08.html#PostGIS_GeographyFunctions # http://postgis.refractions.net/documentation/manual-1.5/ch08.html#PostGIS_GeographyFunctions
z = Zipcode.objects.get(code='77002') z = Zipcode.objects.get(code='77002')
# ST_Within not available. # ST_Within not available.
self.assertRaises(ValueError, City.objects.filter(point__within=z.poly).count) self.assertRaises(ValueError, City.objects.filter(point__within=z.poly).count)
@ -76,7 +76,7 @@ class GeographyTest(TestCase):
# Reference county names, number of polygons, and state names. # Reference county names, number of polygons, and state names.
names = ['Bexar', 'Galveston', 'Harris', 'Honolulu', 'Pueblo'] names = ['Bexar', 'Galveston', 'Harris', 'Honolulu', 'Pueblo']
num_polys = [1, 2, 1, 19, 1] # Number of polygons for each. num_polys = [1, 2, 1, 19, 1] # Number of polygons for each.
st_names = ['Texas', 'Texas', 'Texas', 'Hawaii', 'Colorado'] st_names = ['Texas', 'Texas', 'Texas', 'Hawaii', 'Colorado']
lm = LayerMapping(County, co_shp, co_mapping, source_srs=4269, unique='name') lm = LayerMapping(County, co_shp, co_mapping, source_srs=4269, unique='name')

View File

@ -9,7 +9,7 @@ class State(models.Model):
class County(models.Model): class County(models.Model):
name = models.CharField(max_length=25) name = models.CharField(max_length=25)
state = models.ForeignKey(State) state = models.ForeignKey(State)
mpoly = models.MultiPolygonField(srid=4269) # Multipolygon in NAD83 mpoly = models.MultiPolygonField(srid=4269) # Multipolygon in NAD83
objects = models.GeoManager() objects = models.GeoManager()
@ -58,8 +58,8 @@ class Invalid(models.Model):
# Mapping dictionaries for the models above. # Mapping dictionaries for the models above.
co_mapping = {'name': 'Name', co_mapping = {'name': 'Name',
'state': {'name': 'State'}, # ForeignKey's use another mapping dictionary for the _related_ Model (State in this case). 'state': {'name': 'State'}, # ForeignKey's use another mapping dictionary for the _related_ Model (State in this case).
'mpoly': 'MULTIPOLYGON', # Will convert POLYGON features into MULTIPOLYGONS. 'mpoly': 'MULTIPOLYGON', # Will convert POLYGON features into MULTIPOLYGONS.
} }
cofeat_mapping = {'name': 'Name', cofeat_mapping = {'name': 'Name',

View File

@ -32,7 +32,7 @@ invalid_shp = os.path.join(shp_path, 'invalid', 'emptypoints.shp')
# Dictionaries to hold what's expected in the county shapefile. # Dictionaries to hold what's expected in the county shapefile.
NAMES = ['Bexar', 'Galveston', 'Harris', 'Honolulu', 'Pueblo'] NAMES = ['Bexar', 'Galveston', 'Harris', 'Honolulu', 'Pueblo']
NUMS = [1, 2, 1, 19, 1] # Number of polygons for each. NUMS = [1, 2, 1, 19, 1] # Number of polygons for each.
STATES = ['Texas', 'Texas', 'Texas', 'Hawaii', 'Colorado'] STATES = ['Texas', 'Texas', 'Texas', 'Hawaii', 'Colorado']
@ -129,7 +129,7 @@ class LayerMapTest(TestCase):
# Should only be one record b/c of `unique` keyword. # Should only be one record b/c of `unique` keyword.
c = County.objects.get(name=name) c = County.objects.get(name=name)
self.assertEqual(n, len(c.mpoly)) self.assertEqual(n, len(c.mpoly))
self.assertEqual(st, c.state.name) # Checking ForeignKey mapping. self.assertEqual(st, c.state.name) # Checking ForeignKey mapping.
# Multiple records because `unique` was not set. # Multiple records because `unique` was not set.
if county_feat: if county_feat:
@ -224,7 +224,7 @@ class LayerMapTest(TestCase):
self.assertRaises(TypeError, lm.save, fid_range=bad) self.assertRaises(TypeError, lm.save, fid_range=bad)
# Step keyword should not be allowed w/`fid_range`. # Step keyword should not be allowed w/`fid_range`.
fr = (3, 5) # layer[3:5] fr = (3, 5) # layer[3:5]
self.assertRaises(LayerMapError, lm.save, fid_range=fr, step=10) self.assertRaises(LayerMapError, lm.save, fid_range=fr, step=10)
lm.save(fid_range=fr) lm.save(fid_range=fr)
@ -237,8 +237,8 @@ class LayerMapTest(TestCase):
# Features IDs 5 and beyond for Honolulu County, Hawaii, and # Features IDs 5 and beyond for Honolulu County, Hawaii, and
# FID 0 is for Pueblo County, Colorado. # FID 0 is for Pueblo County, Colorado.
clear_counties() clear_counties()
lm.save(fid_range=slice(5, None), silent=True, strict=True) # layer[5:] lm.save(fid_range=slice(5, None), silent=True, strict=True) # layer[5:]
lm.save(fid_range=slice(None, 1), silent=True, strict=True) # layer[:1] lm.save(fid_range=slice(None, 1), silent=True, strict=True) # layer[:1]
# Only Pueblo & Honolulu counties should be present because of # Only Pueblo & Honolulu counties should be present because of
# the `unique` keyword. Have to set `order_by` on this QuerySet # the `unique` keyword. Have to set `order_by` on this QuerySet

View File

@ -15,7 +15,7 @@ test_srs = ({'srid': 4326,
'proj4_re': r'\+proj=longlat (\+ellps=WGS84 )?\+datum=WGS84 \+no_defs ', 'proj4_re': r'\+proj=longlat (\+ellps=WGS84 )?\+datum=WGS84 \+no_defs ',
'spheroid': 'WGS 84', 'name': 'WGS 84', 'spheroid': 'WGS 84', 'name': 'WGS 84',
'geographic': True, 'projected': False, 'spatialite': True, 'geographic': True, 'projected': False, 'spatialite': True,
'ellipsoid': (6378137.0, 6356752.3, 298.257223563), # From proj's "cs2cs -le" and Wikipedia (semi-minor only) 'ellipsoid': (6378137.0, 6356752.3, 298.257223563), # From proj's "cs2cs -le" and Wikipedia (semi-minor only)
'eprec': (1, 1, 9), 'eprec': (1, 1, 9),
}, },
{'srid': 32140, {'srid': 32140,
@ -27,7 +27,7 @@ test_srs = ({'srid': 4326,
r'(\+datum=NAD83 |\+towgs84=0,0,0,0,0,0,0 )?\+units=m \+no_defs ', r'(\+datum=NAD83 |\+towgs84=0,0,0,0,0,0,0 )?\+units=m \+no_defs ',
'spheroid': 'GRS 1980', 'name': 'NAD83 / Texas South Central', 'spheroid': 'GRS 1980', 'name': 'NAD83 / Texas South Central',
'geographic': False, 'projected': True, 'spatialite': False, 'geographic': False, 'projected': True, 'spatialite': False,
'ellipsoid': (6378137.0, 6356752.31414, 298.257222101), # From proj's "cs2cs -le" and Wikipedia (semi-minor only) 'ellipsoid': (6378137.0, 6356752.31414, 298.257222101), # From proj's "cs2cs -le" and Wikipedia (semi-minor only)
'eprec': (1, 5, 10), 'eprec': (1, 5, 10),
}, },
) )

View File

@ -129,7 +129,7 @@ class LayerMapping(object):
if unique: if unique:
self.check_unique(unique) self.check_unique(unique)
transaction_mode = 'autocommit' # Has to be set to autocommit. transaction_mode = 'autocommit' # Has to be set to autocommit.
self.unique = unique self.unique = unique
else: else:
self.unique = None self.unique = None
@ -286,7 +286,7 @@ class LayerMapping(object):
else: else:
raise TypeError('Unique keyword argument must be set with a tuple, list, or string.') raise TypeError('Unique keyword argument must be set with a tuple, list, or string.')
#### Keyword argument retrieval routines #### # Keyword argument retrieval routines ####
def feature_kwargs(self, feat): def feature_kwargs(self, feat):
""" """
Given an OGR Feature, this will return a dictionary of keyword arguments Given an OGR Feature, this will return a dictionary of keyword arguments
@ -359,7 +359,7 @@ class LayerMapping(object):
# Getting the decimal value as a tuple. # Getting the decimal value as a tuple.
dtup = d.as_tuple() dtup = d.as_tuple()
digits = dtup[1] digits = dtup[1]
d_idx = dtup[2] # index where the decimal is d_idx = dtup[2] # index where the decimal is
# Maximum amount of precision, or digits to the left of the decimal. # Maximum amount of precision, or digits to the left of the decimal.
max_prec = model_field.max_digits - model_field.decimal_places max_prec = model_field.max_digits - model_field.decimal_places

View File

@ -101,7 +101,7 @@ class CookieStorage(BaseStorage):
if self.max_cookie_size: if self.max_cookie_size:
# data is going to be stored eventually by SimpleCookie, which # data is going to be stored eventually by SimpleCookie, which
# adds it's own overhead, which we must account for. # adds it's own overhead, which we must account for.
cookie = SimpleCookie() # create outside the loop cookie = SimpleCookie() # create outside the loop
def stored_length(val): def stored_length(val):
return len(cookie.value_encode(val)[1]) return len(cookie.value_encode(val)[1])

View File

@ -77,7 +77,7 @@ class CookieTest(BaseTests, TestCase):
response = self.get_response() response = self.get_response()
storage.add(constants.INFO, 'test') storage.add(constants.INFO, 'test')
for m in storage: for m in storage:
pass # Iterate through the storage to simulate consumption of messages. pass # Iterate through the storage to simulate consumption of messages.
storage.update(response) storage.update(response)
self.assertEqual(response.cookies['messages'].value, '') self.assertEqual(response.cookies['messages'].value, '')
self.assertEqual(response.cookies['messages']['domain'], '.example.com') self.assertEqual(response.cookies['messages']['domain'], '.example.com')

View File

@ -14,7 +14,7 @@ class SessionManager(models.Manager):
if session_dict: if session_dict:
s.save() s.save()
else: else:
s.delete() # Clear sessions with no data. s.delete() # Clear sessions with no data.
return s return s

View File

@ -388,7 +388,7 @@ class CacheDBSessionTests(SessionTestsMixin, TestCase):
@override_settings(SESSION_CACHE_ALIAS='sessions') @override_settings(SESSION_CACHE_ALIAS='sessions')
def test_non_default_cache(self): def test_non_default_cache(self):
#21000 - CacheDB backend should respect SESSION_CACHE_ALIAS. # 21000 - CacheDB backend should respect SESSION_CACHE_ALIAS.
self.assertRaises(InvalidCacheBackendError, self.backend) self.assertRaises(InvalidCacheBackendError, self.backend)

View File

@ -60,7 +60,7 @@ class BaseMemcachedCache(six.with_metaclass(BaseMemcachedCacheMethods, BaseCache
# in memcache backends, a negative timeout must be passed. # in memcache backends, a negative timeout must be passed.
timeout = -1 timeout = -1
if timeout > 2592000: # 60*60*24*30, 30 days if timeout > 2592000: # 60*60*24*30, 30 days
# See http://code.google.com/p/memcached/wiki/FAQ # See http://code.google.com/p/memcached/wiki/FAQ
# "You can set expire times up to 30 days in the future. After that # "You can set expire times up to 30 days in the future. After that
# memcached interprets it as a date, and will expire the item after # memcached interprets it as a date, and will expire the item after

View File

@ -64,7 +64,7 @@ class FileUploadHandler(object):
""" """
Base class for streaming upload handlers. Base class for streaming upload handlers.
""" """
chunk_size = 64 * 2 ** 10 #: The default chunk size is 64 KB. chunk_size = 64 * 2 ** 10 # : The default chunk size is 64 KB.
def __init__(self, request=None): def __init__(self, request=None):
self.file_name = None self.file_name = None

View File

@ -189,7 +189,7 @@ class BaseHandler(object):
# Allow sys.exit() to actually exit. See tickets #1023 and #4701 # Allow sys.exit() to actually exit. See tickets #1023 and #4701
raise raise
except: # Handle everything else. except: # Handle everything else.
# Get the exception info now, in case another exception is thrown later. # Get the exception info now, in case another exception is thrown later.
signals.got_request_exception.send(sender=self.__class__, request=request) signals.got_request_exception.send(sender=self.__class__, request=request)
response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
@ -199,7 +199,7 @@ class BaseHandler(object):
for middleware_method in self._response_middleware: for middleware_method in self._response_middleware:
response = middleware_method(request, response) response = middleware_method(request, response)
response = self.apply_response_fixes(request, response) response = self.apply_response_fixes(request, response)
except: # Any exception should be gathered and handled except: # Any exception should be gathered and handled
signals.got_request_exception.send(sender=self.__class__, request=request) signals.got_request_exception.send(sender=self.__class__, request=request)
response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) response = self.handle_uncaught_exception(request, resolver, sys.exc_info())

View File

@ -52,7 +52,7 @@ class LimitedStream(object):
elif size < len(self.buffer): elif size < len(self.buffer):
result = self.buffer[:size] result = self.buffer[:size]
self.buffer = self.buffer[size:] self.buffer = self.buffer[size:]
else: # size >= len(self.buffer) else: # size >= len(self.buffer)
result = self.buffer + self._read_limited(size - len(self.buffer)) result = self.buffer + self._read_limited(size - len(self.buffer))
self.buffer = b'' self.buffer = b''
return result return result

View File

@ -121,7 +121,7 @@ def get_commands():
_commands.update(dict((name, app_name) _commands.update(dict((name, app_name)
for name in find_commands(path))) for name in find_commands(path)))
except ImportError: except ImportError:
pass # No management module - ignore this app pass # No management module - ignore this app
return _commands return _commands
@ -379,12 +379,12 @@ class ManagementUtility(object):
options, args = parser.parse_args(self.argv) options, args = parser.parse_args(self.argv)
handle_default_options(options) handle_default_options(options)
except: # Needed because parser.parse_args can raise SystemExit except: # Needed because parser.parse_args can raise SystemExit
pass # Ignore any option errors at this point. pass # Ignore any option errors at this point.
try: try:
subcommand = self.argv[1] subcommand = self.argv[1]
except IndexError: except IndexError:
subcommand = 'help' # Display help if no arguments were given. subcommand = 'help' # Display help if no arguments were given.
if subcommand == 'help': if subcommand == 'help':
if len(args) <= 2: if len(args) <= 2:

View File

@ -66,9 +66,9 @@ class Command(NoArgsCommand):
indexes = connection.introspection.get_indexes(cursor, table_name) indexes = connection.introspection.get_indexes(cursor, table_name)
except NotImplementedError: except NotImplementedError:
indexes = {} indexes = {}
used_column_names = [] # Holds column names used in the table so far used_column_names = [] # Holds column names used in the table so far
for i, row in enumerate(connection.introspection.get_table_description(cursor, table_name)): for i, row in enumerate(connection.introspection.get_table_description(cursor, table_name)):
comment_notes = [] # Holds Field notes, to be displayed in a Python comment. comment_notes = [] # Holds Field notes, to be displayed in a Python comment.
extra_params = OrderedDict() # Holds Field parameters such as 'db_column'. extra_params = OrderedDict() # Holds Field parameters such as 'db_column'.
column_name = row[0] column_name = row[0]
is_relation = i in relations is_relation = i in relations
@ -112,7 +112,7 @@ class Command(NoArgsCommand):
# Add 'null' and 'blank', if the 'null_ok' flag was present in the # Add 'null' and 'blank', if the 'null_ok' flag was present in the
# table description. # table description.
if row[6]: # If it's NULL... if row[6]: # If it's NULL...
if field_type == 'BooleanField(': if field_type == 'BooleanField(':
field_type = 'NullBooleanField(' field_type = 'NullBooleanField('
else: else:

View File

@ -24,9 +24,9 @@ from django.utils import six
from django.utils.translation import get_language from django.utils.translation import get_language
_resolver_cache = {} # Maps URLconf modules to RegexURLResolver instances. _resolver_cache = {} # Maps URLconf modules to RegexURLResolver instances.
_ns_resolver_cache = {} # Maps namespaces to RegexURLResolver instances. _ns_resolver_cache = {} # Maps namespaces to RegexURLResolver instances.
_callable_cache = {} # Maps view and url pattern names to their view functions. _callable_cache = {} # Maps view and url pattern names to their view functions.
# SCRIPT_NAME prefixes for each thread are stored here. If there's no entry for # SCRIPT_NAME prefixes for each thread are stored here. If there's no entry for
# the current thread (which is the only one we ever access), it is assumed to # the current thread (which is the only one we ever access), it is assumed to

View File

@ -86,7 +86,7 @@ class EmailValidator(object):
code = 'invalid' code = 'invalid'
user_regex = re.compile( user_regex = re.compile(
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*$" # dot-atom r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*$" # dot-atom
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"$)', # quoted-string r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"$)', # quoted-string
re.IGNORECASE) re.IGNORECASE)
domain_regex = re.compile( domain_regex = re.compile(
r'(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,})$' # domain r'(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}|[A-Z0-9-]{2,})$' # domain

View File

@ -226,7 +226,7 @@ class DatabaseOperations(BaseDatabaseOperations):
def date_trunc_sql(self, lookup_type, field_name): def date_trunc_sql(self, lookup_type, field_name):
fields = ['year', 'month', 'day', 'hour', 'minute', 'second'] fields = ['year', 'month', 'day', 'hour', 'minute', 'second']
format = ('%%Y-', '%%m', '-%%d', ' %%H:', '%%i', ':%%s') # Use double percents to escape. format = ('%%Y-', '%%m', '-%%d', ' %%H:', '%%i', ':%%s') # Use double percents to escape.
format_def = ('0000-', '01', '-01', ' 00:', '00', ':00') format_def = ('0000-', '01', '-01', ' 00:', '00', ':00')
try: try:
i = fields.index(lookup_type) + 1 i = fields.index(lookup_type) + 1
@ -259,7 +259,7 @@ class DatabaseOperations(BaseDatabaseOperations):
else: else:
params = [] params = []
fields = ['year', 'month', 'day', 'hour', 'minute', 'second'] fields = ['year', 'month', 'day', 'hour', 'minute', 'second']
format = ('%%Y-', '%%m', '-%%d', ' %%H:', '%%i', ':%%s') # Use double percents to escape. format = ('%%Y-', '%%m', '-%%d', ' %%H:', '%%i', ':%%s') # Use double percents to escape.
format_def = ('0000-', '01', '-01', ' 00:', '00', ':00') format_def = ('0000-', '01', '-01', ' 00:', '00', ':00')
try: try:
i = fields.index(lookup_type) + 1 i = fields.index(lookup_type) + 1
@ -300,7 +300,7 @@ class DatabaseOperations(BaseDatabaseOperations):
def quote_name(self, name): def quote_name(self, name):
if name.startswith("`") and name.endswith("`"): if name.startswith("`") and name.endswith("`"):
return name # Quoting once is enough. return name # Quoting once is enough.
return "`%s`" % name return "`%s`" % name
def quote_parameter(self, value): def quote_parameter(self, value):

View File

@ -147,7 +147,7 @@ class DatabaseCreation(BaseDatabaseCreation):
} }
cursor = self.connection.cursor() cursor = self.connection.cursor()
time.sleep(1) # To avoid "database is being accessed by other users" errors. time.sleep(1) # To avoid "database is being accessed by other users" errors.
if self._test_user_create(): if self._test_user_create():
if verbosity >= 1: if verbosity >= 1:
print('Destroying test user...') print('Destroying test user...')

View File

@ -52,8 +52,8 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
cursor.execute("SELECT * FROM %s WHERE ROWNUM < 2" % self.connection.ops.quote_name(table_name)) cursor.execute("SELECT * FROM %s WHERE ROWNUM < 2" % self.connection.ops.quote_name(table_name))
description = [] description = []
for desc in cursor.description: for desc in cursor.description:
name = force_text(desc[0]) # cx_Oracle always returns a 'str' on both Python 2 and 3 name = force_text(desc[0]) # cx_Oracle always returns a 'str' on both Python 2 and 3
name = name % {} # cx_Oracle, for some reason, doubles percent signs. name = name % {} # cx_Oracle, for some reason, doubles percent signs.
description.append(FieldInfo(*(name.lower(),) + desc[1:])) description.append(FieldInfo(*(name.lower(),) + desc[1:]))
return description return description

View File

@ -16,7 +16,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
700: 'FloatField', 700: 'FloatField',
701: 'FloatField', 701: 'FloatField',
869: 'GenericIPAddressField', 869: 'GenericIPAddressField',
1042: 'CharField', # blank-padded 1042: 'CharField', # blank-padded
1043: 'CharField', 1043: 'CharField',
1082: 'DateField', 1082: 'DateField',
1083: 'TimeField', 1083: 'TimeField',

View File

@ -95,7 +95,7 @@ class DatabaseOperations(BaseDatabaseOperations):
def quote_name(self, name): def quote_name(self, name):
if name.startswith('"') and name.endswith('"'): if name.startswith('"') and name.endswith('"'):
return name # Quoting once is enough. return name # Quoting once is enough.
return '"%s"' % name return '"%s"' % name
def quote_parameter(self, value): def quote_parameter(self, value):
@ -175,7 +175,7 @@ class DatabaseOperations(BaseDatabaseOperations):
style.SQL_KEYWORD('IS NOT'), style.SQL_KEYWORD('IS NOT'),
style.SQL_KEYWORD('FROM'), style.SQL_KEYWORD('FROM'),
style.SQL_TABLE(qn(model._meta.db_table)))) style.SQL_TABLE(qn(model._meta.db_table))))
break # Only one AutoField is allowed per model, so don't bother continuing. break # Only one AutoField is allowed per model, so don't bother continuing.
for f in model._meta.many_to_many: for f in model._meta.many_to_many:
if not f.rel.through: if not f.rel.through:
output.append("%s setval(pg_get_serial_sequence('%s','%s'), coalesce(max(%s), 1), max(%s) %s null) %s %s;" % output.append("%s setval(pg_get_serial_sequence('%s','%s'), coalesce(max(%s), 1), max(%s) %s null) %s %s;" %

View File

@ -212,7 +212,7 @@ class DatabaseOperations(BaseDatabaseOperations):
def quote_name(self, name): def quote_name(self, name):
if name.startswith('"') and name.endswith('"'): if name.startswith('"') and name.endswith('"'):
return name # Quoting once is enough. return name # Quoting once is enough.
return '"%s"' % name return '"%s"' % name
def quote_parameter(self, value): def quote_parameter(self, value):

View File

@ -157,7 +157,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
# Skip indexes across multiple fields # Skip indexes across multiple fields
if len(info) != 1: if len(info) != 1:
continue continue
name = info[0][2] # seqno, cid, name name = info[0][2] # seqno, cid, name
indexes[name] = {'primary_key': indexes.get(name, {}).get("primary_key", False), indexes[name] = {'primary_key': indexes.get(name, {}).get("primary_key", False),
'unique': unique} 'unique': unique}
return indexes return indexes

View File

@ -112,21 +112,21 @@ class CursorDebugWrapper(CursorWrapper):
############################################### ###############################################
def typecast_date(s): def typecast_date(s):
return datetime.date(*map(int, s.split('-'))) if s else None # returns None if s is null return datetime.date(*map(int, s.split('-'))) if s else None # returns None if s is null
def typecast_time(s): # does NOT store time zone information def typecast_time(s): # does NOT store time zone information
if not s: if not s:
return None return None
hour, minutes, seconds = s.split(':') hour, minutes, seconds = s.split(':')
if '.' in seconds: # check whether seconds have a fractional part if '.' in seconds: # check whether seconds have a fractional part
seconds, microseconds = seconds.split('.') seconds, microseconds = seconds.split('.')
else: else:
microseconds = '0' microseconds = '0'
return datetime.time(int(hour), int(minutes), int(seconds), int(float('.' + microseconds) * 1000000)) return datetime.time(int(hour), int(minutes), int(seconds), int(float('.' + microseconds) * 1000000))
def typecast_timestamp(s): # does NOT store time zone information def typecast_timestamp(s): # does NOT store time zone information
# "2005-07-29 15:48:00.590358-05" # "2005-07-29 15:48:00.590358-05"
# "2005-07-29 09:56:00-05" # "2005-07-29 09:56:00-05"
if not s: if not s:
@ -147,7 +147,7 @@ def typecast_timestamp(s): # does NOT store time zone information
dates = d.split('-') dates = d.split('-')
times = t.split(':') times = t.split(':')
seconds = times[2] seconds = times[2]
if '.' in seconds: # check whether seconds have a fractional part if '.' in seconds: # check whether seconds have a fractional part
seconds, microseconds = seconds.split('.') seconds, microseconds = seconds.split('.')
else: else:
microseconds = '0' microseconds = '0'

View File

@ -11,7 +11,7 @@ from django.db.models.base import Model # NOQA
from django.db.models.aggregates import * # NOQA from django.db.models.aggregates import * # NOQA
from django.db.models.fields import * # NOQA from django.db.models.fields import * # NOQA
from django.db.models.fields.subclassing import SubfieldBase # NOQA from django.db.models.fields.subclassing import SubfieldBase # NOQA
from django.db.models.fields.files import FileField, ImageField # NOQA from django.db.models.fields.files import FileField, ImageField # NOQA
from django.db.models.fields.related import ( # NOQA from django.db.models.fields.related import ( # NOQA
ForeignKey, ForeignObject, OneToOneField, ManyToManyField, ForeignKey, ForeignObject, OneToOneField, ManyToManyField,
ManyToOneRel, ManyToManyRel, OneToOneRel) ManyToOneRel, ManyToManyRel, OneToOneRel)

Some files were not shown because too many files have changed in this diff Show More