def __init__(self, request, application): self.unitofwork = UnitOfWork.inst() self.request = request self.response = XResponse() self.app = application self.mimetype = 'html' self.charset = self.response.charset # 识别这个请求是否是只读的 self.read_only = False # for short self.createUrl = self.app.createUrl self.headers = self.response.headers self.setCookies = self.response.set_cookie self.secure_cookies = self.request.secure_cookies self.context = self.request.context self.json = {} self.action = 'index' self.context['controller'] = self self.context['this'] = self self.context['createUrl'] = self.app.createUrl
def afterRender(self): UnitOfWork.reset()