Objects defined in your models and controllers do not survive from request to request (unless, of course, you store them somewhere, like the session). In your code, the Set object is created when you visit /default/index, but the select happens when you visit /plugin_openplayers/index, which happens in a different request, so the Set object no longer exists. Anthony
On Tuesday, July 19, 2011 5:13:18 PM UTC-4, Manuele wrote: > Hi *: > > I'm trying to implement an essential version of a plugin_openlayers > starting from the job made by Massimo with plugin_gmap but I don't > understand how the db set is passed from a controller to the plugin_* > controller, well even if it seams clear setting the data set in a > storage defined in a model seams not to work and I obtains: > > File > "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/applications/wind2pow2/controllers/plugin_openlayers.py", > > > line 8, in index > rows = plugin_openlayers.set.select() > AttributeError: 'NoneType' object has no attribute 'select' > > so it seams that when I fix the new value in the plugin_openlayers > storage in my controller function it does not change the value in the > storage defined in model. > > I hope to be clear > can you help me please? > > > I leave you here under some example code... > > models/plugin_openlayers.py > > from gluon.storage import Storage > plugin_openlayers=Storage() > ------------------------------------------------ > > controllers/plugin_openlayers.py > > def index(): > width = request.vars.width or 400 > height = request.vars.height or 300 > > rows = plugin_openlayers.set.select() > > return dict(width=width, height=height, rows=rows) > ------------------------------------------------ > > controllers/default.py > > def index(): > site_id = request.vars.item_id > plugin_openlayers.set = db(db.site.id==site_id) > return dict() > ------------------------------------------------ > > thank you very much > > Manuele > >