[Zope3-checkins] CVS: Zope3/src/zodb/code - module.py:1.11
Guido van Rossum
guido@python.org
Thu, 29 May 2003 17:31:34 -0400
Update of /cvs-repository/Zope3/src/zodb/code
In directory cvs.zope.org:/tmp/cvs-serv26272
Modified Files:
module.py
Log Message:
Only add a newline to the source if it doesn't already end in one.
This makes a normal source a fixpoint. The old behavior kept adding a
newline to the source each time it was edited through the web, and
made fssync unnecessarily complicated.
=== Zope3/src/zodb/code/module.py 1.10 => 1.11 ===
--- Zope3/src/zodb/code/module.py:1.10 Thu May 1 15:34:59 2003
+++ Zope3/src/zodb/code/module.py Thu May 29 17:31:33 2003
@@ -135,7 +135,8 @@
def update(self, source):
# Try to prevent compilation errors from files without trailing
# newlines.
- source += "\n"
+ if source and source[-1] != "\n":
+ source += "\n"
self._module._p_changed = True
moddict = self._module.__dict__
old_names = NameFinder(self._module)