Ignore:
Timestamp:
12 Dec 2014, 15:34:50 (10 years ago)
Author:
Henrik Bettermann
Message:

We need documents which can be accessed or downloaded from product pages. These documents can provide general information of registration processes or pdf forms to be filled offline and later uploaded by customers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/document.py

    r12168 r12200  
    3232from waeup.ikoba.utils.helpers import attrs_to_fields, get_current_principal
    3333from waeup.ikoba.documents.interfaces import (
    34     IDocument, IDocument, IDocumentsUtils)
     34    IDocument, IDocument, IDocumentsUtils,
     35    IPDFDocument, IHTMLDocument)
    3536from waeup.ikoba.documents.utils import generate_document_id
    3637
     
    100101
    101102
     103class PDFDocument(Document):
     104    """This is a  document for a single pdf upload file.
     105    """
     106    grok.implements(IPDFDocument)
     107    grok.provides(IPDFDocument)
     108
     109PDFDocument = attrs_to_fields(PDFDocument)
     110
     111
     112class HTMLDocument(Document):
     113    """This is a  document to render html-coded text.
     114    """
     115    grok.implements(IHTMLDocument)
     116    grok.provides(IHTMLDocument)
     117
     118HTMLDocument = attrs_to_fields(HTMLDocument)
     119
     120
    102121class DocumentFactory(grok.GlobalUtility):
    103122    """A factory for documents.
     
    114133        return implementedBy(Document)
    115134
     135
     136class PDFDocumentFactory(grok.GlobalUtility):
     137    """A factory for documents.
     138    """
     139    grok.implements(IFactory)
     140    grok.name(u'waeup.PDFDocument')
     141    title = u"Create a new PDF document.",
     142    description = u"This factory instantiates new PDF documents."
     143
     144    def __call__(self, *args, **kw):
     145        return PDFDocument(*args, **kw)
     146
     147    def getInterfaces(self):
     148        return implementedBy(PDFDocument)
     149
     150
     151class HTMLDocumentFactory(grok.GlobalUtility):
     152    """A factory for HTML documents.
     153    """
     154    grok.implements(IFactory)
     155    grok.name(u'waeup.HTMLDocument')
     156    title = u"Create a new HTML document.",
     157    description = u"This factory instantiates new HTML documents."
     158
     159    def __call__(self, *args, **kw):
     160        return HTMLDocument(*args, **kw)
     161
     162    def getInterfaces(self):
     163        return implementedBy(HTMLDocument)
     164
     165
    116166@grok.subscribe(IDocument, grok.IObjectAddedEvent)
    117167def handle_document_added(document, event):
Note: See TracChangeset for help on using the changeset viewer.