Index: waeup/trunk/src/waeup/utils/batching.txt
===================================================================
--- waeup/trunk/src/waeup/utils/batching.txt	(revision 4901)
+++ waeup/trunk/src/waeup/utils/batching.txt	(revision 4902)
@@ -226,7 +226,8 @@
 
     >>> processor = CaveProcessor()
-    >>> processor.doImport('newcomers.csv', 
+    >>> result = processor.doImport('newcomers.csv', 
     ...                   ['name', 'dinoports', 'owner', 'taxpayer'],
     ...                    mode='create', user='Bob', logger=logger)
+    >>> result
     (4, 0, '/.../newcomers.finished.csv', None)
 
@@ -263,5 +264,4 @@
 provided a logger during the call:
 
-    >>> #print open('newcomers.csv.create.msg').read()
     >>> print open('stoneville.log').read()
     --------------------
@@ -274,10 +274,17 @@
     --------------------
 
+We cleanup the temporay dir created by doImport():
+
+    >>> import shutil
+    >>> import os
+    >>> shutil.rmtree(os.path.dirname(result[2]))
+
 As we can see, the processing was successful. Otherwise, all problems
 could be read here as we can see, if we do the same operation again:
 
-    >>> processor.doImport('newcomers.csv',
+    >>> result = processor.doImport('newcomers.csv',
     ...                   ['name', 'dinoports', 'owner', 'taxpayer'],
     ...                    mode='create', user='Bob', logger=logger)
+    >>> result
     (4, 4, '/.../newcomers.finished.csv', '/.../newcomers.pending.csv')
 
@@ -286,5 +293,4 @@
 The log file will tell us this in more detail:
 
-    >>> #print open('newcomers.csv.create.msg').read()
     >>> print open('stoneville.log').read()
     --------------------
@@ -303,5 +309,5 @@
 process and an additional column with error messages:
 
-    >>> print open('newcomers.pending.csv').read()
+    >>> print open(result[3]).read()
     owner,name,taxpayer,dinoports,--ERRORS--
     Barney,Barneys Home,1,2,This object already exists. Skipping.
@@ -317,4 +323,7 @@
 ``False`` (which is accepted by the converters).
 
+Clean up:
+
+    >>> shutil.rmtree(os.path.dirname(result[2]))
 
 Updating entries
@@ -324,6 +333,8 @@
 mode:
 
-    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
+    >>> result = processor.doImport('newcomers.csv', ['name',
+    ...                             'dinoports', 'owner'],
     ...                    mode='update', user='Bob')
+    >>> result
     (4, 0, '...', None)
 
@@ -339,8 +350,14 @@
     1
 
+Clean up:
+
+    >>> shutil.rmtree(os.path.dirname(result[2]))
+
+
 We start the processor:
 
-    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
-    ...                    mode='update', user='Bob')
+    >>> result = processor.doImport('newcomers.csv', ['name',
+    ...                    'dinoports', 'owner'], mode='update', user='Bob')
+    >>> result
     (1, 0, '...', None)
 
@@ -351,4 +368,9 @@
 Wilma's number of dinoports raised.
 
+Clean up:
+
+    >>> shutil.rmtree(os.path.dirname(result[2]))
+
+
 If we try to update an unexisting entry, an error occurs:
 
@@ -358,7 +380,14 @@
     ... """)
 
-    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
+    >>> result = processor.doImport('newcomers.csv', ['name',
+    ...                             'dinoports', 'owner'],
     ...                    mode='update', user='Bob')
+    >>> result
     (1, 1, '/.../newcomers.finished.csv', '/.../newcomers.pending.csv')
+
+Clean up:
+
+    >>> shutil.rmtree(os.path.dirname(result[2]))
+
     
 Also invalid values will be spotted:
@@ -369,7 +398,14 @@
     ... """)
 
-    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
+    >>> result = processor.doImport('newcomers.csv', ['name',
+    ...                             'dinoports', 'owner'],
     ...                    mode='update', user='Bob')
+    >>> result
     (1, 1, '...', '...')
+
+Clean up:
+
+    >>> shutil.rmtree(os.path.dirname(result[2]))
+
 
 We can also update only some cols, leaving some out. We skip the
@@ -381,10 +417,16 @@
     ... """)
 
-    >>> processor.doImport('newcomers.csv', ['name', 'owner'],
-    ...                    mode='update', user='Bob')
+    >>> result = processor.doImport('newcomers.csv', ['name', 'owner'],
+    ...                             mode='update', user='Bob')
+    >>> result
     (1, 0, '...', None)
 
     >>> wilma.owner
     u'Barney'
+
+Clean up:
+
+    >>> shutil.rmtree(os.path.dirname(result[2]))
+
 
 We can however, not leave out the 'location field' ('name' in our
@@ -412,6 +454,8 @@
     ... """)
 
-    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
+    >>> result = processor.doImport('newcomers.csv', ['name',
+    ...                             'dinoports', 'owner'],
     ...                    mode='update', user='Bob')
+    >>> result
     (1, 0, '...', None)
 
@@ -419,4 +463,8 @@
     True
 
+Clean up:
+
+    >>> shutil.rmtree(os.path.dirname(result[2]))
+
 Generally, empty strings are considered as ``None``:
 
@@ -426,6 +474,8 @@
     ... """)
 
-    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
+    >>> result = processor.doImport('newcomers.csv', ['name',
+    ...                             'dinoports', 'owner'],
     ...                    mode='update', user='Bob')
+    >>> result
     (1, 0, '...', None)
 
@@ -433,4 +483,9 @@
     True
 
+Clean up:
+
+    >>> shutil.rmtree(os.path.dirname(result[2]))
+
+
 Removing entries
 ----------------
@@ -444,6 +499,8 @@
     ... """)
 
-    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
+    >>> result = processor.doImport('newcomers.csv', ['name',
+    ...                             'dinoports', 'owner'],
     ...                    mode='remove', user='Bob')
+    >>> result
     (1, 0, '...', None)
 
@@ -453,4 +510,8 @@
 Oops! Wilma is gone.
 
+Clean up:
+
+    >>> shutil.rmtree(os.path.dirname(result[2]))
+
 
 Clean up:
@@ -458,4 +519,3 @@
     >>> import os
     >>> os.unlink('newcomers.csv')
-    >>> os.unlink('newcomers.finished.csv')
     >>> os.unlink('stoneville.log')
