On Friday, April 29, 2016 at 9:05:34 AM UTC-7, 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, > ) > > > Have you instantiated the scheduler elsewhere? I don't think the tables exist until the first time you do, and it's not worth the effort to create your own table def and try to get all the fields to match.
/dps -- 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.