Skip to content
Browse files

Define NullHandler class for python2.6

  • Loading branch information...
1 parent e6a4022 commit 45ed197fa2abb0b8d8b0650daa45ea62d15a5d17 Salem Harrache committed Jun 4, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 kalamar/site.py
View
10 kalamar/site.py
@@ -88,11 +88,13 @@ class Site(object):
def __init__(self):
self.access_points = {}
self.logger = logging.getLogger("dyko")
- # TODO: NullHandler does not exist in python 2.6..
try:
- self.logger.addHandler(logging.NullHandler())
- except:
- pass
+ from logging import NullHandler
+ except ImportError:
+ class NullHandler(logging.Handler):
+ def emit(self, record):
+ pass
+ self.logger.addHandler(NullHandler())
def register(self, name, access_point):
"""Add an access point to this site.

0 comments on commit 45ed197

Please sign in to comment.
Something went wrong with that request. Please try again.