poe.occurrences = [(os.path.basename(source), num)]
poe.msgid = msgid
serts[msgid] = poe
- except Exception, exc:
- print "Error in oils_i18n_gettext line %d of SQL source file: %s" % (num, exc)
+ except Exception as exc:
+ print("Error in oils_i18n_gettext line %d of SQL source file: %s" % (num, exc))
for poe in serts.values():
self.pot.append(poe)
# Avoid generating duplicate entries by keeping track of msgids
msgids = dict()
- try:
+ try:
bundle = simplejson.load(codecs.open(source, encoding='utf-8', mode='r'))
- except ValueError:
- print("Reading Dojo resource file %s" % (source))
+ except ValueError:
+ print("Reading Dojo resource file %s" % (source))
raise
for key, value in bundle.iteritems():
lineno = self.locator.getLineNumber()
if name == 'class':
self.classid = attributes['id']
- if attributes.has_key('reporter:label'):
+ if 'reporter:label' in attributes:
if name == 'class':
entity = "%s.%s.label" % (name, self.classid)
elif name == 'field':
entity = "%s.%s.%s.label" % (name, self.classid, \
attributes['field'])
label = attributes['reporter:label']
- if not self.entities.has_key(label):
+ if label not in self.entities:
self.entities[label] = [(str(entity), lineno)]
else:
self.entities[label].append((str(entity), lineno))
if name == 'desc' and self.en_us_flag is True:
lineno = self.locator.getLineNumber()
event = "%d.%s" % (int(self.numcode), self.textcode)
- if self.events.has_key(self.desc):
+ if self.desc in self.events:
self.events[self.desc].append([str(event), lineno])
else:
self.events[self.desc] = [[str(event), lineno]]
if (re.compile(r'indicateur\s*-\s*Non').search(raw_ind.contents[0])):
return None
if (not raw_ind.ul):
- print "No %d indicator for %s, although not not defined either..." % (position, field.tag)
+ print("No %d indicator for %s, although not not defined either..." % (position, field.tag))
return None
ind_values = raw_ind.ul.findAll('li')
for value in ind_values:
repeatable = 'false'
subfield.small.extract()
else:
- print "%s has no small or span tags?" % (field.tag)
+ print("%s has no small or span tags?" % (field.tag))
subfield_text = re.compile(r'\n').sub(' ', ''.join(subfield.findAll(text=True)))
matches = re.compile(r'^\$(\w)\s*-\s*(.+)$', re.S).search(subfield_text)
if (not matches):
- print "No subfield match for field: " + field.tag
+ print("No subfield match for field: " + field.tag)
return None
field.subfields.append(Subfield(matches.group(1).replace('\n', ' ').rstrip(), repeatable, matches.group(2).replace('\n', ' ').rstrip()))
# Get description
desc = tag.parent.findNextSibling('p')
if (not desc):
- print "No description for %s" % (tag_num)
+ print("No description for %s" % (tag_num))
else:
if (str(desc.__class__) == 'BeautifulSoup.Tag'):
try:
description += u''.join(desc.findAll(text=True))
except:
- print "Bad description for: " + tag_num
- print u' '.join(desc.findAll(text=True))
+ print("Bad description for: " + tag_num)
+ print(u' '.join(desc.findAll(text=True)))
else:
description += desc.string
description = description.replace('\n', ' ').rstrip()
if (not re.compile(r'^040010-1\d\d\d-f.html').search(filename)):
continue
- print filename
+ print(filename)
devnull = codecs.open('/dev/null', encoding='utf-8', mode='w')
file = subprocess.Popen(
('tidy', '-asxml', '-n', '-q', '-utf8', filename),
merged = merge_events(options.master, options.localization)
if options.outfile:
- outfile = open(options.outfile, 'w')
+ outfile = open(options.outfile, 'wb')
if options.pretty:
outfile.write(merged.toprettyxml(encoding='utf-8'))
else:
outfile.write(merged.toxml(encoding='utf-8'))
else:
if options.pretty:
- print merged.toprettyxml(encoding='utf-8')
+ print(merged.toprettyxml(encoding='utf-8'))
else:
- print merged.toxml(encoding='utf-8')
+ print(merged.toxml(encoding='utf-8'))
if __name__ == '__main__':
main()