Skip to content

Commit

Permalink
use new style format() for the template
Browse files Browse the repository at this point in the history
  • Loading branch information
agroszer committed Aug 13, 2015
1 parent 47c194f commit 921c6a6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/zope/exceptions/exceptionformatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ def formatException(self, etype, value, tb):
tb = tb.tb_next
template = (
'...\n'
'%(omitted)d entries omitted, because limit is %(limit)d.\n'
'Set sys.tracebacklimit or %(class)s.limit to a higher'
'{omitted} entries omitted, because limit is {limit}.\n'
'Set sys.tracebacklimit or {klass}.limit to a higher'
' value to see omitted entries\n'
'...')
self._obeyLimit(result, template)
Expand Down Expand Up @@ -219,7 +219,7 @@ def extractStack(self, f=None):

self._obeyLimit(
result,
'...%(omitted)d entries omitted, because limit is %(limit)d...\n')
'...{omitted} entries omitted, because limit is {limit}...\n')
result.reverse()
return result

Expand All @@ -230,9 +230,8 @@ def _obeyLimit(self, result, template):
tocut = len(result) - limit
middle = len(result) // 2
lower = middle - tocut // 2
msg = (template % {'omitted': tocut,
'limit': limit,
'class': self.__class__.__name__})
msg = template.format(
omitted=tocut, limit=limit, klass=self.__class__.__name__)
result[lower:lower + tocut] = [msg]


Expand Down

0 comments on commit 921c6a6

Please sign in to comment.