[Zope-Checkins] CVS: Releases/Zope/lib/python/Products/PythonScripts - __init__.py:1.8.2.1

Evan Simpson evan@zope.com
Fri, 14 Dec 2001 14:03:46 -0500


Update of /cvs-repository/Releases/Zope/lib/python/Products/PythonScripts
In directory cvs.zope.org:/tmp/cvs-serv20890

Modified Files:
      Tag: Zope-2_5-branch
	__init__.py 
Log Message:
Merge from trunk


=== Releases/Zope/lib/python/Products/PythonScripts/__init__.py 1.8 => 1.8.2.1 ===
     context.registerHelpTitle('Script (Python)')
     
+# utility stuff
+
+def recompile(self):
+    '''Recompile all Python Scripts'''
+    base = self.this()
+    scripts = base.ZopeFind(base, obj_metatypes=('Script (Python)',))
+    names = []
+    for name, ob in scripts:
+        if ob._v_change:
+            names.append(name)
+            ob._compile()
+            ob._p_changed = 1
+
+    if names:
+        return 'The following Scripts were recompiled:\n' + '\n'.join(names)
+    return 'No Scripts were found that required recompilation.'
+
+_m = {'recompile': recompile}