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

Shane Hathaway shane@digicool.com
Thu, 9 Aug 2001 13:34:07 -0400


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

Modified Files:
      Tag: NR-branch
	PythonScript.py 
Log Message:
Sync NR-branch with trunk.  Sorry about so many checkin messages...


=== Zope/lib/python/Products/PythonScripts/PythonScript.py 1.33 => 1.33.6.1 ===
         file = REQUEST.form.get('file', '')
         if type(file) is not type(''): file = file.read()
-        if file:
-            self._getOb(id).write(file)
+        if not file:
+            file = open(_default_file).read()
+        self._getOb(id).write(file)
         try: u = self.DestinationURL()
         except: u = REQUEST['URL1']
         if submit==" Add and Edit ": u="%s/%s" % (u,quote(id))
@@ -170,7 +171,7 @@
     def __init__(self, id):
         self.id = id
         self.ZBindings_edit(defaultBindings)
-        self._body = open(_default_file).read()
+        self._makeFunction()
 
     security = AccessControl.ClassSecurityInfo()
 
@@ -461,13 +462,14 @@
                     bup = 1
 
             body = body.rstrip()
+            if body:
+                body = body + '\n'
             if body != self._body:
                 self._body = body
             if bup:
                 self._setupBindings(bindmap)
 
-            if self._p_changed:
-                self._makeFunction()
+            self._makeFunction()
         except:
             LOG(self.meta_type, ERROR, 'write failed', error=sys.exc_info())
             raise