env(a, import_models=False, c=1, f=1, dir='', extra_request={})

Return web2py execution environment for application (a), controller
(c), function (f). If import_models is True the exec all application
models into the environment.
extra_request allows you to pass along any extra variables to the
request object before your models get executed. This was mainly done
to support web2py_utils.test_runner, however you can use it with any
wrapper scripts that need access to the web2py environment.

On 8 Jun., 05:42, Doug Warren <doug.war...@gmail.com> wrote:
> So I'm writing a plugin to handle scheduling of tasks with a dynamic
> granularity of a second or less, and I went to use PluginManger per
> it's definition in tools.py:
> class PluginManager(dict):
>     """
>     This object stored parameters to configure plugins (if they need
> configuration)
>     In models/db.py instantiate the PluginManager
>
>     plugins=PluginManager()
>
>     then set the parameters required plugins, for example
>
>     plugins.comments.db=db
>
>     (each plugin should have a documented set of required parameters)
>     """
>
> My code:
> plugins = PluginManager()
> db = plugins.plugin_scheduler.db or None
>
> if db is not None:
>     db.define_table(plugins.plugin_scheduler.table_name or
> 'plugin_scheduler_table',
>                 db.Field('execution_time', 'datetime', default=request.now),
>                 db.Field('controller', 'string'),
>                 db.Field('function', 'string')
>                 )
>
> Only problem...
>     def __init__(self,env):
>         self['globals'] = env
>
> What's that env?  Has anyone written a plugin that uses PluginManager?
>  I checked on the official site and none seem to be using it...  If
> it's request.env shouldn't it have a default arg of None?  Am I using
> it as it was expected to be used?

Reply via email to