Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request.is_shell and request.is_scheduler are not set properly #1039

Closed
abastardi opened this issue Aug 10, 2015 · 0 comments
Closed

request.is_shell and request.is_scheduler are not set properly #1039

abastardi opened this issue Aug 10, 2015 · 0 comments
Assignees

Comments

@abastardi
Copy link
Contributor

When the shell or scheduler are being run, these two request attributes are set, but not to the correct value (which should be False rather than None). And when the shell or scheduler are being run, these two attributes are not set at all (which results in None being returned). So, as it stands, request.is_shell and request.is_scheduler always return None.

The problem is that these attributes are set in gluon.main.wsgibase, which is only called for HTTP requests, but not when the shell or a scheduler task are being run.

Fix:

In gluon.main.wsgibase at https://github.com/web2py/web2py/blob/master/gluon/main.py#L373:

                is_shell = True if cmd_opts and cmd_opts.shell else False,
                is_sheduler = True if cmd_opts and cmd_opts.scheduler else False,

Actually, in wsgibase, I think these would always be False, so maybe just set each to False.

In gluon.shell.env at https://github.com/web2py/web2py/blob/master/gluon/shell.py#L131, add:

request.is_shell = global_settings.cmd_options.shell is not None
request.is_scheduler = global_settings.cmd_options.scheduler is not None
@niphlod niphlod self-assigned this Sep 21, 2015
mdipierro added a commit that referenced this issue Sep 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants