When writing Http Server Tornado, I am having problems accessing an instance variable in my main class, which contains the tornado application object, as well as the start method from a separate RequestHandler object. Consider the following example:
class MyServer(object): def __init__(self): self.ref_object = 0 self.application =
I need to access the ref_object MyServer MyServer in the MyServer post() SomeHandler , and I need to make sure that the ref_object accessed by SomeHandler is the same object if I change it in change_ref_object() .
The incorrect handler is only mentioned as a class when creating the python tornado web server (application), and it is unclear how you can access this SomeHandler instance to change its temporary ref_object when it changed in MyServer .
Mostly it comes to my mind not to understand where SomeHandler instances will exist within MyServer (or, in particular, the MyServer application object).
python tornado
jab
source share