Index: /waeup/trunk/src/waeup/browser/batchprocessing.txt
===================================================================
--- /waeup/trunk/src/waeup/browser/batchprocessing.txt	(revision 4898)
+++ /waeup/trunk/src/waeup/browser/batchprocessing.txt	(revision 4899)
@@ -15,5 +15,5 @@
     ...     try:
     ...       button = browser.getControl(name=name, index=num)
-    ...       if button.value == value:
+    ...       if button.value.endswith(value):
     ...         return button
     ...     except IndexError:
@@ -408,4 +408,83 @@
 
 
+Pending files
+=============
+
+When an error occurs during an import, two files are generated: a CSV
+file with finished files and a CSV file with pending data. Both are
+stored in the appropriate subdirectories in datacenter. We try to
+create faculties, from which one already exists.
+
+Go to datacenter page:
+
+    >>> browser.open('http://localhost/app/datacenter')
+
+Prepare a CSV file for faculties:
+
+    >>> open('newfaculties.csv', 'wb').write(
+    ... """code,review_state,title,title_prefix
+    ... FAC1,static,Faculty 1,faculty
+    ... FAC4,static,Faculty 4,school
+    ... """)
+
+Upload the file:
+
+    >>> import cStringIO
+    >>> browser.getLink('Upload data').click()
+    >>> filecontents = cStringIO.StringIO(
+    ...   open('newfaculties.csv', 'rb').read())
+    >>> filewidget = browser.getControl(name='uploadfile:file')
+    >>> filewidget.add_file(filecontents, 'text/plain', 'newfaculties.csv')
+    >>> browser.getControl(name='SUBMIT').click()
+
+Step 1: start batch processing:
+
+    >>> browser.getLink('Batch processing').click()
+    >>> button = lookup_submit_value(
+    ...   'select', 'newfaculties_zope.mgr.csv', browser)
+    >>> button.click()
+
+Step 2: select a processor and mode:
+
+    >>> importerselect = browser.getControl(name='importer')
+    >>> importerselect.getControl('Faculty importer').selected = True
+    >>> modeselect = browser.getControl(name='mode')
+    >>> modeselect.getControl(value='create').selected = True
+    >>> browser.getControl('Proceed to step 3...').click()
+
+Step 3: Fix headerlines
+
+As there should be no problem with the headers, we can immediately
+perfom the import:
+
+    >>> browser.getControl('Perform import...').click()
+
+One line could not be imported:
+
+    >>> print browser.contents
+    <!DOCTYPE html PUBLIC...
+    ...
+    ...Processing of 1 rows failed!...
+    ...Successfully processed 1 rows...
+    ...
+
+Now there are two files as a result in datacenter storage's root and
+``finished`` dirs:
+
+    >>> pending_file = dc_path + '/newfaculties_zope.mgr.pending.csv'
+    >>> print open(pending_file).read()
+    title_prefix,--IGNORE--,code,title,--ERRORS--
+    faculty,static,FAC1,Faculty 1,This object already exists. Skipping.
+
+    >>> finished_file = dc_path + '/finished/newfaculties_zope.mgr.finished.csv'
+    >>> print open(finished_file).read()
+    title_prefix,--IGNORE--,code,title
+    school,static,FAC4,Faculty 4
+
+The finished-file contains the dataset we could import, while the
+pending file contains the dataset that failed, appended by an error
+message.
+
+
 Clean up:
 
