I'm using the web2py ajax function with an eval target. The question is where certain code should live? Here's the scenario.
The view calls a function x() that creates a DIV(...,_id='y') with an ajax call to update the contents of itself and another DIV (...,_id='z'). The contents of the DIV(..._id='z') were originally determined by a sub-function w() in the controller and then passed to the view when the controller returned its dict. In the interest of staying DRY, I want the ajax function to call the same subroutine w() that the controller called in order to compute the new contents of DIV ( ...,_id='z'). So, where does subroutine w() live? If it lives in the controller, then the ajax call doesn't see it. If it lives in the view, then the controller can't see it. So the obvious place is the model, but then it tends to drag a lot of other view stuff into the model along with it, which I don't really like from a code architecture viewpoint. Also, I'm wary of putting too much functionality in the model folder because of the alphabetic dependency. So, where is the best place to put the subfunction that determines the contents of DIVs. I think the controller is the right place for it and I'm surprised it doesn't work. Am I doing something wrong, and if so, what and where am I going wrong? Should I be putting that stuff in the controller and accessing it via a URL(r=request,...) or something like that?
-- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

