On Wed, 2002-09-25 at 17:17, Tavis Rudd wrote:

> I don't think there's a graceful way around that:  if a module is changed 
> after the appserver starts, but before the application actually imports it.

Well there is a way: you can install a hook which gets called when the 
python "import" statement is called.  At that point, you could stat the
file and set a __MTIME__ variable in the module, which would be checked
later by the file monitor thread.  I haven't implemented this yet,
though.

I've applied your implementation to Webware 0.7 (which is what I
currently run) and it's working well so far.  I didn't have to change
much of your code, just a few small things.  I did add the lines marked
+ below, since if python uses an existing .pyc file, we still want to
monitor the corresponding .py.  Did you not run into this?


                f2 = getattr(mod, '__orig_file__', 0)
                f = getattr(mod, '__file__', 0)


                if f2 and f2 not in monitoredFiles.keys():
                    try:
                        monitoredFiles[f2] = getmtime(f2)
                    except OSError:
                        pass
                elif f and f not in monitoredFiles.keys():
+                   if f[-4:] == '.pyc':
+                       f = f[:-1]
                    try:
                        monitoredFiles[f] = getmtime(f)
                    except OSError:
                        pass


Also, I'm assuming that you modified the PSP code to put the
__orig_file__ into each generated servlet.  This will need to be added
to stock webware, too, for this to work properly.  I don't use cheetah,
so I can't check that.

-- 
Jason D. Hildebrand
[EMAIL PROTECTED]



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to