[Zope-Checkins] CVS: Releases/Zope/lib/python/Products/PythonScripts - PythonScript.py:1.39

Evan Simpson evan@zope.com
Thu, 7 Feb 2002 11:18:35 -0500


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

Modified Files:
	PythonScript.py 
Log Message:
Merge fix from 2.5 branch


=== Releases/Zope/lib/python/Products/PythonScripts/PythonScript.py 1.38 => 1.39 ===
 # This should only be incremented to force recompilation.
 Script_magic = 3
+_log_complaint = (
+    'Some of your Scripts have stale code cached.  Since Zope cannot'
+    ' use this code, startup will be slightly slower until these Scripts'
+    ' are edited. You can automatically recompile all Scripts that have'
+    ' this problem by visiting /manage_addProduct/PythonScripts/recompile'
+    ' of your server in a browser.')
 
 manage_addPythonScriptForm = DTMLFile('www/pyScriptAdd', globals())
 _default_file = os.path.join(package_home(globals()),
@@ -189,9 +195,14 @@
         Script.__setstate__(self, state)
         if (getattr(self, 'Python_magic', None) != Python_magic or
             getattr(self, 'Script_magic', None) != Script_magic):
-            LOG(self.meta_type, PROBLEM,
-                'Object "%s" needs to be recompiled.' % self.id)
+            global _log_complaint
+            if _log_complaint:
+                LOG(self.meta_type, INFO, _log_complaint)    
+                _log_complaint = 0
             # Changes here won't get saved, unless this Script is edited.
+            body = self._body.rstrip()
+            if body:
+                self._body = body + '\n'
             self._compile()
             self._v_change = 1
         elif self._code is None: