Changeset 12005 for main/waeup.ikoba/trunk/src/waeup/ikoba/documents
- Timestamp:
- 20 Nov 2014, 05:40:52 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/documents
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/container.py
r12004 r12005 30 30 grok.provides(IDocumentsContainer) 31 31 32 def __init__(self):33 super(DocumentsContainer, self).__init__()34 return35 32 36 33 def addDocument(self, document): -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/document.py
r12004 r12005 30 30 from waeup.ikoba.interfaces import IIkobaUtils, IObjectHistory 31 31 from waeup.ikoba.interfaces import MessageFactory as _ 32 from waeup.ikoba.documents.interfaces import IDocument, IDocument33 32 from waeup.ikoba.utils.helpers import attrs_to_fields, get_current_principal 34 33 from waeup.ikoba.utils.logger import Logger 34 from waeup.ikoba.documents.interfaces import IDocument, IDocument 35 from waeup.ikoba.documents.utils import generate_document_id 35 36 36 37 class Document(grok.Container, Logger): … … 51 52 return 52 53 54 #def __init__(self): 55 # super(Document, self).__init__() 56 # timestamp = ("%d" % int(time()*10000))[1:] 57 # self.document_id = "d%s" % timestamp 58 # return 59 53 60 def __init__(self): 54 61 super(Document, self).__init__() 55 timestamp = ("%d" % int(time()*10000))[1:] 56 self.document_id = "d%s" % timestamp 62 # The site doesn't exist in unit tests 63 try: 64 self.document_id = generate_document_id() 65 except AttributeError: 66 self.document_id = u'd123' 57 67 return 58 68 -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/interfaces.py
r12004 r12005 35 35 """ 36 36 37 def addDocument(document): 38 """Add a document. 39 """ 40 37 41 class IDocument(IIkobaObject): 38 42 """A base representation of documents. -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests.py
r12004 r12005 61 61 self.assertEqual(container[document_id], document) 62 62 self.assertRaises(TypeError, container.addDocument, object()) 63 self.assertEqual(document_id, 'd123') 63 64 return 64 65
Note: See TracChangeset for help on using the changeset viewer.