From 99480fb9fe5856e182c978ba83603d89d04a2cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 1 Oct 2012 10:08:37 +0200 Subject: [PATCH] notify new elements with added event --- themis/ocrloader/ocrloader.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/themis/ocrloader/ocrloader.py b/themis/ocrloader/ocrloader.py index d0a04b5..b37355d 100644 --- a/themis/ocrloader/ocrloader.py +++ b/themis/ocrloader/ocrloader.py @@ -10,6 +10,10 @@ from Products.CMFCore.utils import getToolByName from Products.Five.browser import BrowserView from plone.namedfile.file import NamedBlobFile +from zope.event import notify +from zope.lifecycleevent import ObjectAddedEvent, ObjectModifiedEvent + + import transaction import themis.config.utils @@ -133,10 +137,12 @@ class LoadFromOcr(BrowserView): folder.invokeFactory(factory, id=ocr_id, title=ocr_title, fichier=ocr_file, **kwargs) - os.rename(os.path.join(base, filename), os.path.join(base, filename + '.processed')) transaction.commit() + object = getattr(folder, ocr_id) + notify(ObjectAddedEvent(object)) + return 'OK'