chiark / gitweb /
backend.py: Make FlatFileRecord._format include the trailing newline.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 23 May 2014 14:58:24 +0000 (15:58 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 24 May 2014 21:58:52 +0000 (22:58 +0100)
This makes things more convenient for callers, in general.

backend.py

index 8c4d4d1070b8a87d425234e94d7aa9d08a4a4887..1967cda5dd76b2440331fd5358fe49e9d3b049dc 100644 (file)
@@ -136,7 +136,7 @@ class FlatFileRecord (BasicRecord):
           raise U.ExpectedError, \
                 (500, "New `%s' field contains %s" % (k, what))
       fields[v] = val
           raise U.ExpectedError, \
                 (500, "New `%s' field contains %s" % (k, what))
       fields[v] = val
-    return me._delim.join(fields)
+    return me._delim.join(fields) + '\n'
 
 class FlatFileBackend (object):
   """
 
 class FlatFileBackend (object):
   """
@@ -208,7 +208,6 @@ class FlatFileBackend (object):
                 f_out.write(line)
               else:
                 f_out.write(rec._format())
                 f_out.write(line)
               else:
                 f_out.write(rec._format())
-                f_out.write('\n')
 
         ## Update the permissions on the new file.  Don't try to fix the
         ## ownership (we shouldn't be running as root) or the group (the
 
         ## Update the permissions on the new file.  Don't try to fix the
         ## ownership (we shouldn't be running as root) or the group (the