Skip to content

Commit

Permalink
Minor pep8 for long lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritsvanrees committed Jan 13, 2014
1 parent 43455ed commit 5efa988
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/zope/tal/talgettext.py
Expand Up @@ -133,13 +133,16 @@ def translate(self, msgid, domain=None, mapping=None, default=None,
idx = msgids.index(msgid)
existing_msgid = msgids[idx]
if msgid.default != existing_msgid.default:
references = '\n'.join([location[0]+':'+str(location[1]) for location in domain[msgid]])
# Note: a lot of encode calls here are needed so Python 3 does not break.
references = '\n'.join([location[0]+':'+str(location[1])
for location in domain[msgid]])
# Note: a lot of encode calls here are needed so
# Python 3 does not break.
print(("Warning: msgid '%s' in %s already exists "
"with a different default (bad: %s, should be: %s)\n"
"The references for the existent value are:\n%s\n" %
(msgid.encode('utf-8'),
self.file.encode('utf-8') + ':'.encode('utf-8') + str(position).encode('utf-8'),
self.file.encode('utf-8') + ':'.encode('utf-8')
+ str(position).encode('utf-8'),
msgid.default.encode('utf-8'),
existing_msgid.default.encode('utf-8'),
references.encode('utf-8'))),
Expand Down
12 changes: 8 additions & 4 deletions src/zope/tal/tests/test_talgettext.py
Expand Up @@ -69,11 +69,15 @@ def test_translate_existing(self):
# UnicodeDecodeError, which is what we test here.
engine.file = 'psc_release_listing.pt'
# position is position in file.
engine.translate('foo', 'domain', default=u'Read more\u2026', position=7)
engine.translate('foo', 'domain',
default=u'Read more\u2026', position=7)
# Adding the same key with the same default is fine.
engine.translate('foo', 'domain', default=u'Read more\u2026', position=13)
# Adding the same key with a different default is bad and triggers a warning.
engine.translate('foo', 'domain', default='Read still more…', position=42)
engine.translate('foo', 'domain',
default=u'Read more\u2026', position=13)
# Adding the same key with a different default is bad and
# triggers a warning.
engine.translate('foo', 'domain',
default='Read still more…', position=42)

def test_dynamic_msgids(self):
sample_source = """
Expand Down

0 comments on commit 5efa988

Please sign in to comment.