Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/documents/export.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/documents/export.py	(revision 12265)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/documents/export.py	(revision 12266)
@@ -27,16 +27,17 @@
 
 
-class PDFDocumentExporter(grok.GlobalUtility, ExporterBase):
+class DocumentExporterBase(grok.GlobalUtility, ExporterBase):
     """Exporter for documents.
     """
     grok.implements(ICSVExporter)
-    grok.name('pdfdocuments')
+    grok.baseclass()
+    class_name = None
+    iface = None
+    title = None
 
-    #: Fieldnames considered by this exporter
-    fields = tuple(sorted(iface_names(IPDFDocument))) + (
+    @property
+    def fields(self):
+        return tuple(sorted(iface_names(self.iface))) + (
         'users_with_local_roles',)
-
-    #: The title under which this exporter will be displayed
-    title = _(u'Public PDF Documents')
 
     def mangle_value(self, value, name, context=None):
@@ -48,5 +49,5 @@
             for local_role, user_name, setting in role_map.getPrincipalsAndRoles():
                 value.append({'user_name':user_name,'local_role':local_role})
-        return super(PDFDocumentExporter, self).mangle_value(
+        return super(DocumentExporterBase, self).mangle_value(
             value, name, context)
 
@@ -66,17 +67,24 @@
         If `filepath` is ``None``, a raw string with CSV data is returned.
         """
-        documents = site.get('documents', {})
-        return self.export(documents.values(), filepath)
+        documents = site.get('documents', {}).values()
+        documents = [doc for doc in documents
+                     if doc.class_name == self.class_name]
+        return self.export(documents, filepath)
 
 
-class HTMLDocumentExporter(PDFDocumentExporter):
+class PDFDocumentExporter(DocumentExporterBase):
+    """Exporter for documents.
+    """
+    grok.name('pdfdocuments')
+    iface = IPDFDocument
+    class_name = 'PDFDocument'
+    title = _(u'Public PDF Documents')
+
+
+class HTMLDocumentExporter(DocumentExporterBase):
     """Exporter for documents.
     """
     grok.name('htmldocuments')
-
-    #: Fieldnames considered by this exporter
-    fields = tuple(sorted(iface_names(IHTMLDocument))) + (
-        'users_with_local_roles',)
-
-    #: The title under which this exporter will be displayed
+    iface = IHTMLDocument
+    class_name = 'HTMLDocument'
     title = _(u'Public HTML Documents')
Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_batching.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_batching.py	(revision 12265)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_batching.py	(revision 12266)
@@ -79,8 +79,18 @@
 
     def setup_for_export(self):
-        document = PDFDocument()
-        self.app['documents'][document.document_id] = self.document = document
+        document1 = PDFDocument()
+        document1.document_id = u'DOC1'
+        self.app['documents'].addDocument(document1)
+        self.pdfdocument = document1
         self.outfile = os.path.join(self.workdir, 'myoutput.csv')
-        role_manager = IPrincipalRoleManager(document)
+        role_manager = IPrincipalRoleManager(document1)
+        role_manager.assignRoleToPrincipal(u'johnsrole', u'john')
+
+        document2 = HTMLDocument()
+        document2.document_id = u'DOC2'
+        self.app['documents'].addDocument(document2)
+        self.htmldocument = document2
+        self.outfile = os.path.join(self.workdir, 'myoutput.csv')
+        role_manager = IPrincipalRoleManager(document2)
         role_manager.assignRoleToPrincipal(u'johnsrole', u'john')
         return
Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_export.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_export.py	(revision 12266)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_export.py	(revision 12266)
@@ -0,0 +1,132 @@
+## $Id: test_export.py 12097 2014-11-30 20:49:22Z henrik $
+##
+## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+"""
+Test the document exporter.
+"""
+import os
+import grok
+import datetime
+from cStringIO import StringIO
+from zope.component import queryUtility, getUtility
+from zope.event import notify
+from zope.interface.verify import verifyObject, verifyClass
+from waeup.ikoba.interfaces import (
+    ICSVExporter, IExtFileStore, IFileStoreNameChooser)
+from waeup.ikoba.documents.export import (
+    PDFDocumentExporter, HTMLDocumentExporter)
+from waeup.ikoba.documents.document import PDFDocument, HTMLDocument
+from waeup.ikoba.documents.tests.test_batching import DocumentImportExportSetup
+from waeup.ikoba.testing import FunctionalLayer
+
+
+class PDFDocumentExporterTest(DocumentImportExportSetup):
+
+    layer = FunctionalLayer
+
+    def setUp(self):
+        super(PDFDocumentExporterTest, self).setUp()
+        self.setup_for_export()
+        return
+
+    def test_ifaces(self):
+        # make sure we fullfill interface contracts
+        obj = PDFDocumentExporter()
+        verifyObject(ICSVExporter, obj)
+        verifyClass(ICSVExporter, PDFDocumentExporter)
+        return
+
+    def test_get_as_utility(self):
+        # we can get an document exporter as utility
+        result = queryUtility(ICSVExporter, name="pdfdocuments")
+        self.assertTrue(result is not None)
+        return
+
+    def test_export(self):
+        # we can really export a document
+        exporter = PDFDocumentExporter()
+        exporter.export([self.pdfdocument], self.outfile)
+        result = open(self.outfile, 'rb').read()
+        self.assertTrue(
+            'description,document_id,title,users_with_local_roles\r\n'
+            ',DOC1,,"[{\'user_name\': u\'john\', \'local_role\': u\'johnsrole\'}]"'
+            in result
+            )
+        return
+
+    def test_export_all(self):
+        # we can really export all documents
+        exporter = PDFDocumentExporter()
+        exporter.export_all(self.app, self.outfile)
+        result = open(self.outfile, 'rb').read()
+        self.assertTrue(
+            'description,document_id,title,users_with_local_roles\r\n'
+            ',DOC1,,"[{\'user_name\': u\'john\', \'local_role\': u\'johnsrole\'}]"'
+            in result
+            )
+        return
+
+
+class HTMLDocumentExporterTest(DocumentImportExportSetup):
+
+    layer = FunctionalLayer
+
+    def setUp(self):
+        super(HTMLDocumentExporterTest, self).setUp()
+        self.setup_for_export()
+        return
+
+    def test_ifaces(self):
+        # make sure we fullfill interface contracts
+        obj = HTMLDocumentExporter()
+        verifyObject(ICSVExporter, obj)
+        verifyClass(ICSVExporter, HTMLDocumentExporter)
+        return
+
+    def test_get_as_utility(self):
+        # we can get an document exporter as utility
+        result = queryUtility(ICSVExporter, name="htmldocuments")
+        self.assertTrue(result is not None)
+        return
+
+    def test_export(self):
+        # we can really export a document
+        exporter = HTMLDocumentExporter()
+        exporter.export([self.htmldocument], self.outfile)
+        result = open(self.outfile, 'rb').read()
+        self.assertTrue(
+            'description,document_id,html_multilingual,title,'
+            'users_with_local_roles\r\n,DOC2,'
+            ',,'
+            '"[{\'user_name\': u\'john\', \'local_role\': u\'johnsrole\'}]"\r\n'
+            in result
+            )
+        return
+
+    def test_export_all(self):
+        # we can really export all documents
+        exporter = HTMLDocumentExporter()
+        exporter.export_all(self.app, self.outfile)
+        result = open(self.outfile, 'rb').read()
+        self.assertTrue(
+            'description,document_id,html_multilingual,title,'
+            'users_with_local_roles\r\n,DOC2,'
+            ',,'
+            '"[{\'user_name\': u\'john\', \'local_role\': u\'johnsrole\'}]"\r\n'
+            in result
+            )
+        return
