Thanks. It worked. On Tue, 17 Apr 2018, 15:37 Anthony <abasta...@gmail.com> wrote:
> On Tuesday, April 17, 2018 at 1:33:29 AM UTC-4, Maurice Waka wrote: >> >> Sorry, am still experiencing the same issue. >> This module is one of the many that I import to the controller . >> i.e. >> >> controller: >> from gluon import current >> db = current.db >> > > There is nothing in web2py that automatically adds the db object (or any > object created by your own code) to the current object, so you must do > this yourself. The above line should instead be the opposite assignment: > > current.db = db > > In other words, in a model file or controller, you can add objects to > current, and then in a module, you can import current and access those > objects. > > Alternatively, any object in the web2py global environment (including any > created in the model files) can also be accessed via the current.globalenv > dictionary. For example: > > current.globalenv['db'] > > Anthony > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/wBVbeSdbc9o/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.