My guess is that you have a python data structure that contains the items and the interest. I would extend this data structure to contain the result of the computation, pass it to the view, render it as you did in PHP. If you choose to compute the "current value" in the view, I would not see anything wrong with it, although it is more likely the current value is needed in other places in the program and therefore it should belong to the data structure.
Massimo On Nov 23, 11:26 am, pftpft <[email protected]> wrote: > I'm new to the MVC structure and am trying to figure out where things > go. > > Let's say I've got a group of items. The index page lists them with a > link to each. On the item page, it runs a detailed calculation and > prints various output. For example, > > Item 1 > Built in 2007. > Initial value $1,000 > 2008 interest: 30 > 2009 interest: 31 > 2010 interest: 32 > Current value: 1,093 > --------------------------- > Item 2 > Purchased in 2000 for $100,000 > Depreciation over 10 years: 40,000 > Current value: $60,000 > --------------------------- > > Currently using PHP, I just use if statements and loops and echo out > to the browser information when its needed. In web2py, where do I put > the calculation function? I'm guessing it shouldn't be in either the > controller or in the view. If I put it in the model, how do I get the > output to the view? Do I have to create a list and append output > lines to it? Which calls the calculation function? The controller or > the view? > > Thanks. Hopefully this makes sense.

