[Zope] forcing all pythonscripts to recompile.

Steve Alexander steve@cat-box.net
Tue, 31 Jul 2001 09:26:22 +0100


Anthony Baxter wrote:
 >>>> "Norman Khine" wrote
 >>>>
 >> you need to open the actual script and save it. i don't think
 >> there is a simpler way, although, you may write a python script,
 >> which will open the files and then save it, but you are on your
 >> own here;^)
 >>
 >
 > Given that this is dozens of scripts, and that you can't even use
 > 'Find' to find them all (since 'Find' won't traverse into ZClasses)
 >  this is a pretty unpleasant task. It also means that the Last
 > Changed date on all scripts  will be reset to today - not good if
 > you use the last changed at all when using the mgmt interface.

I've used the following external method to recompile all my PythonScripts.

def recompile_ps(self):
   metatype='Script (Python)'
   for name,script in self.ZopeFind(self, search_sub=1,
         obj_metatypes=[metatype]):
     print "recompiling",name
     script.ZPythonScript_edit(
           script._params,
           script._body
           )
   return "OK"

--
Steve Alexander
Software Engineer
Cat-Box limited