Thanks for the response, Anthony. Yes, these are AJAX components. I've been toying with different ways of structuring my app. In one case, I have a top level controller function that passes some db results down to a bunch of views. But some of the views have evolved to have components that also need the db query results, which has triggered a rewrite.
I've renormalized code so that there's no duplicated effort in querying the db, but it raised the question of whether a top-level function could pass a db Storage object down to a lower-level component, rather than having the component's controller function do the query. The latter case has the potential of duplicating queries unless one is careful to partition functionality. I hadn't thought of using the cache. In my case, I'm not sure it'll work since the db is highly dynamic. Sessions won't work either, since I was interested in passing a db Storage object, not just an index. Since I can't figure out how to pass Storage objects, I'm gravitating towards passing indices instead. I figured I would put this all in a thread since it seems like something that might affect other people, too. Thanks again for your thoughts on the subject. On Feb 14, 12:30 pm, Anthony <[email protected]> wrote: > Is this an ajax component? In that case, all the LOAD helper is doing is > setting up the JS code to make an ajax GET request to the component's URL, > so you can't easily pass large amounts of data to the component function. > If you only need the results of the query within the component, you might > be better off doing the query in the component function (i.e., f1() in your > example). Otherwise, maybe cache the results of the query and have the > component function pull it out of the cache (or put it in the session if > the results are unique per user). > > Anthony > > > > > > > > On Monday, February 13, 2012 11:17:50 PM UTC-5, weheh wrote: > > > What, if any, is the proper syntax for passing a db storage object to > > a component? > > > In other words: > > > # controller > > def index(): > > query=... > > return dict(data=db(query).select()) > > > # view > > ... > > {{=LOAD('c1','f1')}} > > > So where in the LOAD statement can I pass in data as a db Storage or > > must it be a dict?

