Yedidyah Bar David has uploaded a new change for review.

Change subject: core: filetransaction: Always add a newline
......................................................................

core: filetransaction: Always add a newline

Always add newline when the content is a list or tuple.
Without this change, files that have an empty last line, and are edited
by reading them with read().splitlines(), changing some lines, and then
writing them with filetransaction, loose their empty last line.

Change-Id: I97f0feef1c003250c9f7453245f68398c64051cd
Signed-off-by: Yedidyah Bar David <[email protected]>
---
M src/otopi/filetransaction.py
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/otopi refs/changes/90/18690/1

diff --git a/src/otopi/filetransaction.py b/src/otopi/filetransaction.py
index 3a0b6b4..6b7d7da 100644
--- a/src/otopi/filetransaction.py
+++ b/src/otopi/filetransaction.py
@@ -142,11 +142,11 @@
         self._name = name
 
         if isinstance(content, list) or isinstance(content, tuple):
-            self._content = '\n'.join(content)
+            self._content = '\n'.join(content) + '\n'
         else:
             self._content = str(content)
-        if not self._content.endswith('\n'):
-            self._content += '\n'
+            if not self._content.endswith('\n'):
+                self._content += '\n'
 
         self._mode = mode
         self._dmode = dmode


-- 
To view, visit http://gerrit.ovirt.org/18690
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I97f0feef1c003250c9f7453245f68398c64051cd
Gerrit-PatchSet: 1
Gerrit-Project: otopi
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to