- Timestamp:
- 12 Dec 2014, 15:34:50 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/document.py
r12168 r12200 32 32 from waeup.ikoba.utils.helpers import attrs_to_fields, get_current_principal 33 33 from waeup.ikoba.documents.interfaces import ( 34 IDocument, IDocument, IDocumentsUtils) 34 IDocument, IDocument, IDocumentsUtils, 35 IPDFDocument, IHTMLDocument) 35 36 from waeup.ikoba.documents.utils import generate_document_id 36 37 … … 100 101 101 102 103 class PDFDocument(Document): 104 """This is a document for a single pdf upload file. 105 """ 106 grok.implements(IPDFDocument) 107 grok.provides(IPDFDocument) 108 109 PDFDocument = attrs_to_fields(PDFDocument) 110 111 112 class HTMLDocument(Document): 113 """This is a document to render html-coded text. 114 """ 115 grok.implements(IHTMLDocument) 116 grok.provides(IHTMLDocument) 117 118 HTMLDocument = attrs_to_fields(HTMLDocument) 119 120 102 121 class DocumentFactory(grok.GlobalUtility): 103 122 """A factory for documents. … … 114 133 return implementedBy(Document) 115 134 135 136 class 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 151 class 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 116 166 @grok.subscribe(IDocument, grok.IObjectAddedEvent) 117 167 def handle_document_added(document, event):
Note: See TracChangeset for help on using the changeset viewer.