optimisation empreinte mémoire.
[Portfolio.git] / event_handlers.py
1 # -*- coding: utf-8 -*-
2 ############################################################
3 # Copyright © 2005-2010 Benoît PIN <benoit.pin@ensmp.fr> #
4 # Plinn - http://plinn.org #
5 # #
6 # This program is free software; you can redistribute it #
7 # and/or modify it under the terms of the Creative Commons #
8 # "Attribution-Noncommercial 2.0 Generic" #
9 # http://creativecommons.org/licenses/by-nc/2.0/ #
10 ############################################################
11 """ Event handlers module
12 """
13
14 import transaction
15 from Products.CMFCore.utils import getToolByName
16
17 def processQueueAdd(ob, event) :
18 pimtool = getToolByName(ob, 'portal_image_manipulation')
19 path = '/'.join(ob.getPhysicalPath())
20
21 def hook(success) :
22 if success:
23 pimtool._queueAdd(path)
24
25 transaction.get().addAfterCommitHook(hook)