[Twisted-web] WG: Woven: Problem with Controler

Uwe Schmitt twisted-web@twistedmatrix.com
Wed, 4 Feb 2004 14:09:42 +0100


 Hi,
 
 trying to implement a website I want to implement a controler,
 but setting the model inside the controler does not work.
 The (reduced) code is as follows:
 
 
 -------- START -------------------------------------------------
 
 from twisted.web.woven import page, controller
 
 class MyController(controller.Controller):
 	def handle(self,request):
 
 		self.model.setSubmodel(request,'name', "uwe")
 		self.model.notify()
 
 class MyPage(page.Page):
 
 	appRoot = True
 	template="""
 		<html controller="machine" model="/state"  >
 		<body>
 		<p model="name" view="Text" />
 		</body>
 		</html>"""
 
 	def wcfactory_machine(self, request, node, model):
 		return MyController(model)
 
 	def wmfactory_state(self, req): 
 		return self
 
 resource = MyPage()
 
 -------- END  -------------------------------------------------
 
 When I request the resource, woven says:
 
    "Node had 'model=name' attribute, but the submodel was not found"
 
 Any hints ?
 
 Greetings, Uwe