Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Richard
erp5
Commits
7269f4b6
Commit
7269f4b6
authored
12 years ago
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap zope.testbrowser SubmitControl and ImageControl to get elapsed time.
parent
bbb017b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
erp5/util/testbrowser/browser.py
erp5/util/testbrowser/browser.py
+38
-0
No files found.
erp5/util/testbrowser/browser.py
View file @
7269f4b6
...
@@ -1102,6 +1102,44 @@ class ContextMainForm(MainForm):
...
@@ -1102,6 +1102,44 @@ class ContextMainForm(MainForm):
return
control
return
control
from
zope.testbrowser.browser
import
SubmitControl
class
SubmitControlWithTime
(
SubmitControl
):
"""
Only define to wrap click methods to measure the time spent
"""
__metaclass__
=
measurementMetaClass
(
prefix
=
'click'
)
from
zope.testbrowser.browser
import
ImageControl
class
ImageControlWithTime
(
ImageControl
):
"""
Only define to wrap click methods to measure the time spent
"""
__metaclass__
=
measurementMetaClass
(
prefix
=
'click'
)
import
zope.testbrowser.browser
browser_controlFactory
=
zope
.
testbrowser
.
browser
.
controlFactory
def
controlFactory
(
control
,
*
args
,
**
kwargs
):
"""
Monkey patch controlFactory in zope.testbrowser to get elapsed time on
ImageControl and SubmitControl
"""
try
:
t
=
control
.
type
except
AttributeError
:
# This is a subcontrol
pass
else
:
if
t
in
(
'submit'
,
'submitbutton'
):
return
SubmitControlWithTime
(
control
,
*
args
,
**
kwargs
)
elif
t
==
'image'
:
return
ImageControlWithTime
(
control
,
*
args
,
**
kwargs
)
return
browser_controlFactory
(
control
,
*
args
,
**
kwargs
)
zope
.
testbrowser
.
browser
.
controlFactory
=
controlFactory
from
zope.testbrowser.browser
import
Link
from
zope.testbrowser.browser
import
Link
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment