From a256ed95efcef39ea2908ea0cf860be4dc81dbda Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Wed, 31 Aug 2011 14:51:53 +0000
Subject: [PATCH] No  need to  define our  own  counter before  expiring Form 
 instance as  it's already available in zope.testbrowser

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@46029 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 erp5/util/test_browser/browser.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/erp5/util/test_browser/browser.py b/erp5/util/test_browser/browser.py
index 17cfaf8671..2de5d348c0 100644
--- a/erp5/util/test_browser/browser.py
+++ b/erp5/util/test_browser/browser.py
@@ -158,7 +158,6 @@ class Browser(ExtendedTestBrowser):
     """
     # Meaningful to re-create the MainForm class every time the page
     # has been changed
-    self._main_form_counter = -1
     self._main_form = None
 
     assert base_url[-1] == '/'
@@ -259,11 +258,9 @@ class Browser(ExtendedTestBrowser):
     """
     # If the page has not changed, no need to re-create a class, so
     # just return the main_form instance
-    if self._main_form_counter == self._counter and self._main_form:
+    if self._main_form and self._counter == self._main_form._browser_counter:
       return self._main_form
 
-    self._main_form_counter = self._counter
-
     main_form = None
     for form in self.mech_browser.forms():
       if form.attrs.get('id') == 'main_form':
-- 
2.30.9