[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Add helper function to iterate long files linewise



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv12032/mixminion

Modified Files:
	Common.py 
Log Message:
Add helper function to iterate long files linewise

Index: Common.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Common.py,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- Common.py	7 Feb 2005 06:18:40 -0000	1.144
+++ Common.py	3 May 2005 03:30:07 -0000	1.145
@@ -563,6 +563,13 @@
         if self.f:
             LOG.error("Atomic file not closed/discarded: %s",self.tmpname)
 
+def iterFileLines(f):
+    #XXXXXX DOCDOC TESTTEST XXXX008
+    if xreadlines is not None:
+        return xreadlines.xreadlines(f)
+    else:
+        return iter(f)
+
 def readFile(fn, binary=0):
     """Return the contents of the file named <fn>."""
     f = open(fn, ['r', 'rb'][binary])