summaryrefslogtreecommitdiff
path: root/src/zope/i18n/locales/xmlfactory.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/zope/i18n/locales/xmlfactory.py')
-rw-r--r--src/zope/i18n/locales/xmlfactory.py38
1 files changed, 12 insertions, 26 deletions
diff --git a/src/zope/i18n/locales/xmlfactory.py b/src/zope/i18n/locales/xmlfactory.py
index 5b2dbf5..5dbcee0 100644
--- a/src/zope/i18n/locales/xmlfactory.py
+++ b/src/zope/i18n/locales/xmlfactory.py
@@ -41,7 +41,6 @@ class LocaleFactory(object):
rc = rc + node.data
return rc
-
def _extractVersion(self, identity_node):
"""Extract the Locale's version info based on data from the DOM
tree.
@@ -81,7 +80,6 @@ class LocaleFactory(object):
return LocaleVersion(number, generationDate, notes)
-
def _extractIdentity(self):
"""Extract the Locale's identity object based on info from the DOM
tree.
@@ -119,7 +117,7 @@ class LocaleFactory(object):
# Retrieve the language of the locale
nodes = identity.getElementsByTagName('language')
if nodes != []:
- id.language = nodes[0].getAttribute('type') or None
+ id.language = nodes[0].getAttribute('type') or None
# Retrieve the territory of the locale
nodes = identity.getElementsByTagName('territory')
if nodes != []:
@@ -132,7 +130,6 @@ class LocaleFactory(object):
id.version = self._extractVersion(identity)
return id
-
def _extractTypes(self, names_node):
"""Extract all types from the names_node.
@@ -179,7 +176,6 @@ class LocaleFactory(object):
types[(type, key)] = self._getText(type_node.childNodes)
return types
-
def _extractDisplayNames(self):
"""Extract all display names from the DOM tree.
@@ -285,7 +281,6 @@ class LocaleFactory(object):
displayNames.types = types
return displayNames
-
def _extractMonths(self, months_node, calendar):
"""Extract all month entries from cal_node and store them in calendar.
@@ -385,14 +380,15 @@ class LocaleFactory(object):
defaultMonthContext_node = months_node.getElementsByTagName('default')
if defaultMonthContext_node:
- calendar.defaultMonthContext = defaultMonthContext_node[0].getAttribute('type')
+ calendar.defaultMonthContext = defaultMonthContext_node[0].getAttribute(
+ 'type')
monthContext_nodes = months_node.getElementsByTagName('monthContext')
if not monthContext_nodes:
return
calendar.monthContexts = InheritingDictionary()
- names_node = abbrs_node = None # BBB
+ names_node = abbrs_node = None # BBB
for node in monthContext_nodes:
context_type = node.getAttribute('type')
@@ -441,7 +437,6 @@ class LocaleFactory(object):
calendar.months[type] = (names.get(type, None),
abbrs.get(type, None))
-
def _extractDays(self, days_node, calendar):
"""Extract all day entries from cal_node and store them in
calendar.
@@ -529,14 +524,15 @@ class LocaleFactory(object):
defaultDayContext_node = days_node.getElementsByTagName('default')
if defaultDayContext_node:
- calendar.defaultDayContext = defaultDayContext_node[0].getAttribute('type')
+ calendar.defaultDayContext = defaultDayContext_node[0].getAttribute(
+ 'type')
dayContext_nodes = days_node.getElementsByTagName('dayContext')
if not dayContext_nodes:
return
calendar.dayContexts = InheritingDictionary()
- names_node = abbrs_node = None # BBB
+ names_node = abbrs_node = None # BBB
for node in dayContext_nodes:
context_type = node.getAttribute('type')
@@ -584,7 +580,6 @@ class LocaleFactory(object):
calendar.days[type] = (names.get(type, None),
abbrs.get(type, None))
-
def _extractWeek(self, cal_node, calendar):
"""Extract all week entries from cal_node and store them in
calendar.
@@ -644,7 +639,6 @@ class LocaleFactory(object):
time_args = map(int, node.getAttribute('time').split(':'))
calendar.week['weekendEnd'] = (day, time(*time_args))
-
def _extractEras(self, cal_node, calendar):
"""Extract all era entries from cal_node and store them in
calendar.
@@ -703,8 +697,8 @@ class LocaleFactory(object):
calendar.eras = InheritingDictionary()
for type in abbrs.keys():
- calendar.eras[type] = (names.get(type, None), abbrs.get(type, None))
-
+ calendar.eras[type] = (names.get(type, None),
+ abbrs.get(type, None))
def _extractFormats(self, formats_node, lengthNodeName, formatNodeName):
"""Extract all format entries from formats_node and return a
@@ -772,7 +766,8 @@ class LocaleFactory(object):
format.pattern = self._getText(pattern_node.childNodes)
name_nodes = format_node.getElementsByTagName('displayName')
if name_nodes:
- format.displayName = self._getText(name_nodes[0].childNodes)
+ format.displayName = self._getText(
+ name_nodes[0].childNodes)
length.formats[format.type] = format
lengths[length.type] = length
@@ -925,7 +920,6 @@ class LocaleFactory(object):
return calendars
-
def _extractTimeZones(self, dates_node):
"""Extract all timezone information for the locale from the DOM
tree.
@@ -1009,7 +1003,6 @@ class LocaleFactory(object):
return zones
-
def _extractDates(self):
"""Extract all date information from the DOM tree"""
dates_nodes = self._data.getElementsByTagName('dates')
@@ -1025,7 +1018,6 @@ class LocaleFactory(object):
dates.timezones = timezones
return dates
-
def _extractSymbols(self, numbers_node):
"""Extract all week entries from cal_node and store them in
calendar.
@@ -1081,7 +1073,6 @@ class LocaleFactory(object):
return symbols
-
def _extractNumberFormats(self, numbers_node, numbers):
"""Extract all number formats from the numbers_node and save the data
in numbers.
@@ -1174,7 +1165,6 @@ class LocaleFactory(object):
setattr(numbers, defaultName, default)
setattr(numbers, formatsName, formats)
-
def _extractCurrencies(self, numbers_node):
"""Extract all currency definitions and their information from the
Locale's DOM tree.
@@ -1232,7 +1222,7 @@ class LocaleFactory(object):
if nodes:
currency.symbol = self._getText(nodes[0].childNodes)
currency.symbolChoice = \
- nodes[0].getAttribute('choice') == u"true"
+ nodes[0].getAttribute('choice') == u"true"
nodes = curr_node.getElementsByTagName('displayName')
if nodes:
@@ -1242,7 +1232,6 @@ class LocaleFactory(object):
return currencies
-
def _extractNumbers(self):
"""Extract all number information from the DOM tree"""
numbers_nodes = self._data.getElementsByTagName('numbers')
@@ -1259,7 +1248,6 @@ class LocaleFactory(object):
numbers.currencies = currencies
return numbers
-
def _extractDelimiters(self):
"""Extract all delimiter entries from the DOM tree.
@@ -1315,7 +1303,6 @@ class LocaleFactory(object):
return delimiters
-
def _extractOrientation(self):
"""Extract orientation information.
@@ -1345,7 +1332,6 @@ class LocaleFactory(object):
setattr(orientation, name, value)
return orientation
-
def __call__(self):
"""Create the Locale."""
locale = Locale(self._extractIdentity())