python - Scope of warnings.simplefilter('error', Image.DecompressionBombWarning) -


i have following skeleton tornado program:

class is(basehandler):    @tornado.gen.coroutine    def get(self):       #render stuff     def post(self):       try:       # load image        except runtimewarning:       # handle exception  class application(tornado.web.application):    def __init__(self):       # current handlers       handlers = [          (r'/',is),       ]        # settings dict application       settings = {          "template_path": "templates",          "static_path": "static"       }       tornado.web.application.__init__(self,handlers,debug=true,**settings)  if __name__ =='__main__':    # right place set warnings?    warnings.simplefilter('error', image.decompressionbombwarning)    app=application()    server=tornado.httpserver.httpserver(app)    server.listen(7000)    tornado.ioloop.ioloop.current().start() 

i'm wondering scope of settings warnings is? have set within class? or have set ok? or should within application init?

warnings.simplefilter affects whole process (when not called inside with warnings.catch_warnings() block), control warnings globally have call once @ startup, you've done.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -