dataflake.org

Home Documentation Software Old Stuff

TypeErrors in SimpleLog (Resolved)

Request LDAP User Folder -- bug report -- by Wichert Akkerman
Posted on Mar 2, 2006 8:49 am
Subscribe

Enter your email address to receive mail on every change to this issue.

Entries (Latest first)


  Resolve by Jens Vagelpohl on Mar 2, 2006 9:28 am
  Thanks Wichert. This is checked in, and I also just rolled 2.7-beta if you'd like to give it a try:

http://www.dataflake.org/software/ldapuserfolder/ldapuserfolder_2.7-beta

 

  Initial Request by Wichert Akkerman on Mar 2, 2006 8:49 am
  I am seeing exceptions throw by the log statement in LDAPUserFolder._lookupuserbyattr. The cause seems to be that the useattr contains a %s which will break the string formatting in log(). The patch below tries to make make the logging more robust against this error.

Index: SimpleLog.py
===================================================================
--- SimpleLog.py (revision 1280)
+++ SimpleLog.py (working copy)
@@ -48,7 +48,13 @@
if exc_info == (None, None, None):
exc_info = None

- zLOG.LOG(self.name, real_level, msg % args, error=exc_info)
+ try:
+ if args:
+ zLOG.LOG(self.name, real_level, msg % args, error=exc_info)
+ else:
+ zLOG.LOG(self.name, real_level, msg, error=exc_info)
+ except TypeError:
+ zLOG.LOG(self.name, real_level, "%s (%s)" % (msg, repr(args)), error=exc_info)

def debug(self, msg, *args, **kw):
self.log(zLOG.DEBUG, msg, *args, **kw)