Skip to content

Commit

Permalink
Removed uses date instances from global.dat for workaround to avoid i…
Browse files Browse the repository at this point in the history
…ncompatible pickle format between python 2 and 3 (python-babel#174)
  • Loading branch information
jun66j5 committed Aug 4, 2015
1 parent 5e9ae09 commit 9b725d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions babel/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ def _is_active(start, end):

result = []
for currency_code, start, end, is_tender in curs:
if start:
start = date_(*start)
if end:
end = date_(*end)
if ((is_tender and tender) or \
(not is_tender and non_tender)) and _is_active(start, end):
if include_details:
Expand Down
6 changes: 2 additions & 4 deletions scripts/import_cldr.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
except ImportError:
from xml.etree import ElementTree

from datetime import date

# Make sure we're using Babel source, and not some previously installed version
sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), '..'))

Expand Down Expand Up @@ -103,12 +101,12 @@ def _parse_currency_date(s):
if not s:
return None
parts = s.split('-', 2)
return date(*map(int, parts + [1] * (3 - len(parts))))
return tuple(map(int, parts + [1] * (3 - len(parts))))


def _currency_sort_key(tup):
code, start, end, tender = tup
return int(not tender), start or date(1, 1, 1)
return int(not tender), start or (1, 1, 1)


def main():
Expand Down

0 comments on commit 9b725d5

Please sign in to comment.