Index: /waeup/branches/ulif-rewrite/src/waeup/utils/importexport.py
===================================================================
--- /waeup/branches/ulif-rewrite/src/waeup/utils/importexport.py	(revision 4157)
+++ /waeup/branches/ulif-rewrite/src/waeup/utils/importexport.py	(revision 4158)
@@ -8,5 +8,5 @@
 from zope.interface import Interface
 from waeup.interfaces import (IWAeUPObject, IWAeUPExporter, IWAeUPXMLExporter,
-                              IWAeUPXMLImporter)
+                              IWAeUPXMLImporter, IWAeUPCSVImporter)
 
 def readFile(f):
@@ -86,2 +86,46 @@
         return obj
 
+class CSVImporter(grok.Adapter):
+    grok.context(IWAeUPObject)
+    grok.provides(IWAeUPCSVImporter)
+    grok.baseclass() # We don't want this base to be registered really.
+    column_terms = [] # The column terms supported by this importer
+    
+    def __init__(self, context):
+        self.context = context
+    
+    def doImport(self, filepath):
+        pass
+    
+    def getData(self, filepath):
+        result = readFile(open(filepath, 'rb'))
+        return result
+
+    def validate(self, filepath):
+        self.checkHeader(filepath)
+        self.getData(filepath)
+        return True
+
+    def checkHeader(self, filepath):
+        missing = []
+        headerline = ''
+
+        # Extract the header fields...
+        for line in open(filepath, 'rb'):
+            headerline = line
+            if len(headerline.strip()) == 0:
+                continue # Ignore leading empty lines...
+            break # We only want the first line...
+        tmpfile = StringIO(headerline)
+        headerfields = readFile(tmpfile)[0]
+
+        # Find missing header fields...
+        for key in self.column_terms:
+            if key not in headerfields:
+                missing.append(key)
+        if len(missing):
+            raise KeyError(
+                'Validation Error: the follwing '
+                'columns could not be found: %s' % (', '.join(missing))
+                )
+        return
