jacek99/corepost — Issue #3: @route + way of accessing corepost class instance attributes
Author: kaosat-dev
Created: 2012-02-14 15:19:52+00:00
State: open

Hi Jacek!

I am currently giving Corepost a try (great set of features !), and the problem is , I see no way of passing additional data to a CorePost class instance so that it can be reused in the routed methods: ie for example, this fails:

class HomeApp(CorePost):
def __init__(self,*args,**kwargs):
CorePost.__init__(self, *args, **kwargs)
self.thing = "a test"

@route("/",Http.GET)
def root(self,request,**kwargs):
print (self.thing)
return request.path

Inside the decorated method, "self" points to a RequestRouter instance , so is there any workaround /change to the decorators that can keep the "self" inside the method referring to the CorePost /CorePost subclass instance ?