[Zope] Python Scripts need to be recompiled ... again.
Andrew Sydelko
sydelko@csociety.purdue.edu
Thu, 09 Aug 2001 11:13:19 -0500
) 2001-08-09T14:38:39 PROBLEM(100) Script (Python) Object "getSmallImages"
) needs to be recompiled.
)
) 1) What causes this need and is there any way to keep them compiled?
)
) 2) If there's no way to keep them compiled, is there a way to
) programmatically check if they need to be compiled and then do so?
Here is what I ran on a "down"ed Zope:
#!/var/www/Zope.12/bin/python # change this to the python that runs zope.
import sys
# change this to include the Zope/lib/python of INSTANCE_HOME
sys.path.insert(0, '/var/www/Zope.12/Zope/lib/python')
import Zope
def recompile_ps(self):
metatype='Script (Python)'
for name,script in self.ZopeFind(self, search_sub=1,
obj_metatypes=[metatype]):
print "recompiling",name
try:
script.ZPythonScript_edit(
script._params,
script._body
)
except:
print "Failed."
return "OK"
appRoot = Zope.DB.open().root()['Application']
recompile_ps(appRoot)
get_transaction().commit()
--andy.