Changeset 11990 for main


Ignore:
Timestamp:
19 Nov 2014, 10:11:47 (10 years ago)
Author:
Henrik Bettermann
Message:

Assign timestamp id to documents.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/documents
Files:
2 edited

Legend:

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

    r11983 r11990  
    2020"""
    2121import grok
    22 from datetime import datetime
     22from time import time
    2323from grok import index
    2424from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
     
    5353    def __init__(self):
    5454        super(Document, self).__init__()
    55         self.id = None
     55        timestamp = ("%d" % int(time()*10000))[1:]
     56        self.id = "d%s" % timestamp
    5657        return
    5758
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests.py

    r11983 r11990  
    5757        container = DocumentsContainer()
    5858        document = createObject(u'waeup.Document')
    59         document.id = 'my_document'
     59        id = document.id
    6060        container.addDocument(document)
    61         self.assertEqual(container['my_document'], document)
     61        self.assertEqual(container[id], document)
    6262        self.assertRaises(TypeError, container.addDocument, object())
    6363        return
Note: See TracChangeset for help on using the changeset viewer.