From c18a351f37dafe392c124ed2fac31e1ed1b240ef Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Wed, 9 May 2012 14:08:21 +0200
Subject: [PATCH] Zope: monkey-patch 'transaction' to provide start time of
 transaction

---
 product/ERP5Type/ZopePatch.py            |  1 +
 product/ERP5Type/patches/_transaction.py | 25 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 product/ERP5Type/patches/_transaction.py

diff --git a/product/ERP5Type/ZopePatch.py b/product/ERP5Type/ZopePatch.py
index 10dab86868..6ea50e2c65 100644
--- a/product/ERP5Type/ZopePatch.py
+++ b/product/ERP5Type/ZopePatch.py
@@ -71,6 +71,7 @@ from Products.ERP5Type.patches import ExternalMethod
 from Products.ERP5Type.patches import User
 from Products.ERP5Type.patches import zopecontenttype
 from Products.ERP5Type.patches import OFSImage
+from Products.ERP5Type.patches import _transaction
 from Products.ERP5Type.patches import default_zpublisher_encoding
 
 # These symbols are required for backward compatibility
diff --git a/product/ERP5Type/patches/_transaction.py b/product/ERP5Type/patches/_transaction.py
new file mode 100644
index 0000000000..243f0961ea
--- /dev/null
+++ b/product/ERP5Type/patches/_transaction.py
@@ -0,0 +1,25 @@
+############################################################################
+#
+# Copyright (c) 2012 Nexedi SA and Contributors.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+############################################################################
+
+# XXX: This file starts with an underscore because by default, on Python 2.6,
+#      imports are relative.
+
+from time import time
+from transaction import _manager
+
+def _new_transaction(txn, synchs):
+    txn.start_time = time()
+    if synchs:
+        synchs.map(lambda s: s.newTransaction(txn))
+
+_manager._new_transaction = _new_transaction
-- 
2.30.9