On Feb26, 7:35pm, AchipA <attila.cs...@gmail.com> wrote:
> On Feb 26, 5:23 am, Iceberg <iceb...@21cn.com> wrote:
>
> > I don't really understand how cron patch works but, since the global
> > crontype equals to "Soft" by default, is there some reason causing the
> > win distrib to detect itself as running in cgi or wsgi mode and
> > therefore the soft cron mode?
>
> Not really detecting - when you start via web2py.py it sets hard cron,
> no special checks anywhere (that's why -H doesn't make sense). As you
> yourself  noted, global import variables can be tricky/ugly and
> apparently do not work the same way when compiled or py2exe-d.
> Probably will have to introduce a file-based scheme (which is in the
> works anyway to prevent multi-process race conditions), but it's not
> that easy as workarounds for GAE will be needed..
>
>
> > When I import
> > this module and change it (indirectly), I still do not sure what is
> > its value when another part of code import this module again. It just
> > smells bad. :-/
>
> Agreed, I do intend of changing this in the future.

Before that future comes, how about this dirty hack? I do not fully
test it due to not know how to build another windows distribution by
my own. So I just guess it might work.

Create this function in applications/myapp/controller/default.py:
  def test():
    import sys
    return {'':sys.argv[0]}
And visit it.

If you are running web2py from the source code, you get the output as
"web2py.py".
If you are running web2py from the windows distrib, you get the output
as "web2py".

So we can try this after the definition of crontype in cron.py:

crontype='Soft'
if sys.argv[0]=='web2py': # Likely running in a windows distribution
  crontype='Hard' # Force it to hardcron. Somehow necessary. :-/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to