Would something like this work:
cmd_options = request.global_settings.cmd_options
if not (cmd_options and cmd_options.scheduler):
request.requires_https()
Should we add a test for the scheduler to requires_https (and maybe add a
global_settings.scheduler, like global_settings.cronjob):
http://code.google.com/p/web2py/source/browse/gluon/globals.py#127?
Anthony
On Thursday, June 21, 2012 2:36:23 PM UTC-4, Massimo Di Pierro wrote:
>
> You have this line in
>
> request.requires_https()
>
> In
>
> myapp/models/db.py", line 10, in <module>
>
> it prevents the scheduler form importing the modules.
>
>
> On Thursday, 21 June 2012 11:15:32 UTC-5, Yarin wrote:
>>
>> I can't get the scheduler to run when I turn on request.requires_https().
>>
>> $ /opt/web-apps/web2py/web2py.py -K myapp
>>
>>
>> Result:
>>
>> starting scheduler for "myapp"...
>>> Currently running 1 scheduler processes
>>> Processes started
>>> Process Process-1:
>>> Traceback (most recent call last):
>>> File "/usr/lib64/python2.6/multiprocessing/process.py", line 232, in
>>> _bootstrap
>>> self.run()
>>> File "/usr/lib64/python2.6/multiprocessing/process.py", line 88, in run
>>> self._target(*self._args, **self._kwargs)
>>> File "/opt/web-apps/web2py/gluon/shell.py", line 189, in run
>>> _env = env(a, c=c, import_models=import_models)
>>> File "/opt/web-apps/web2py/gluon/shell.py", line 131, in env
>>> run_models_in(environment)
>>> File "/opt/web-apps/web2py/gluon/compileapp.py", line 513, in
>>> run_models_in
>>> restricted(code, environment, layer=model)
>>> File "/opt/web-apps/web2py/gluon/restricted.py", line 205, in
>>> restricted
>>> exec ccode in environment
>>> File "applications/myapp/models/db.py", line 10, in <module>
>>> request.requires_https()
>>> File "/opt/web-apps/web2py/gluon/globals.py", line 119, in
>>> requires_https
>>> redirect(URL(scheme='https', args=self.args, vars=self.vars))
>>> File "/opt/web-apps/web2py/gluon/http.py", line 128, in redirect
>>> Location=location)
>>> HTTP: 303 SEE OTHER
>>
>>
>> LAMP/mod_wsgi environment. Anyone deal with this already?
>>
>>
>>
--