I seem to have resolved it by switching "db = current.db" to "db = current.globalenv['db']"
On Friday, April 29, 2016 at 12:05:34 PM UTC-4, Marty Jones wrote: > > I'm defining some functions in the modules folder that need to access and > insert rows into the db. in the controller, I define "current.db = db" then > in the module I import the db as seen below. > > I define the function below and attempt to import it and queue it up using > Scheduler, but receive "'DAL' object has no attribute 'scheduler_task'". > What am I missing? > > #!/usr/bin/env python > # -*- coding: utf-8 -*- > from gluon import * > from gluon import current > > def insert_task(): > db = current.db > db.scheduler_task.insert(status = 'QUEUED', > application_name = 'my_application/default', > task_name = 'download', > group_name = 'scrape', > function_name = 'download', > args = '[]', > vars = '{}', > enabled = True, > start_time = request.now, > timeout = 500, > ) > > > -- 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.