[Zope-Checkins] CVS: Zope3/lib/python/Zope/TAL - TALDefs.py:1.31
Barry Warsaw
barry@wooz.org
Mon, 17 Jun 2002 20:13:32 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/TAL
In directory cvs.zope.org:/tmp/cvs-serv23017/lib/python/Zope/TAL
Modified Files:
TALDefs.py
Log Message:
TALError.setFile(): Allow for setting the file name in which the error
occurred.
TALError.__str__(): If the filename is set, include it in the string
representation of the exception. This is a big aid in debugging.
=== Zope3/lib/python/Zope/TAL/TALDefs.py 1.30 => 1.31 ===
self.lineno = position[0]
self.offset = position[1]
+ self.filename = None
+
+ def setFile(self, filename):
+ self.filename = filename
def __str__(self):
result = self.msg
@@ -73,6 +77,8 @@
result = result + ", at line %d" % self.lineno
if self.offset is not None:
result = result + ", column %d" % (self.offset + 1)
+ if self.filename is not None:
+ result = result + ', in file %s' % self.filename
return result
class METALError(TALError):