Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
a6ad3081
Commit
a6ad3081
authored
Apr 08, 2010
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LP #142502: Added a knob to the Debug control panel to reset profile data.
Thanks to Vladimir Patukhov for the patch.
parent
ae6112d7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
0 deletions
+40
-0
doc/CHANGES.rst
doc/CHANGES.rst
+3
-0
src/App/ApplicationManager.py
src/App/ApplicationManager.py
+6
-0
src/App/dtml/profile.dtml
src/App/dtml/profile.dtml
+14
-0
src/App/tests/test_ApplicationManager.py
src/App/tests/test_ApplicationManager.py
+17
-0
No files found.
doc/CHANGES.rst
View file @
a6ad3081
...
...
@@ -100,6 +100,9 @@ Restructuring
Features Added
++++++++++++++
- LP #142502: Added a knob to the Debug control panel for resetting
profile data. Thanks to Vladimir Patukhov for the patch.
- LP #143232: Added option to '
zope
.
conf
' to specify an additional directory
to be searched for '
App
.
Extensions
' lookups. Thanks to Rodrigo Senra for
the patch.
...
...
src/App/ApplicationManager.py
View file @
a6ad3081
...
...
@@ -39,6 +39,7 @@ from OFS.SimpleItem import SimpleItem
from
Product
import
ProductFolder
from
Products.PageTemplates.PageTemplateFile
import
PageTemplateFile
from
zExceptions
import
Redirect
from
ZPublisher
import
Publish
LOG
=
getLogger
(
'ApplicationManager'
)
...
...
@@ -252,6 +253,11 @@ class DebugManager(Item, Implicit):
sys
.
stdout
=
stdout
return
output
.
getvalue
()
def
manage_profile_reset
(
self
):
""" Reset profile data
"""
Publish
.
_pstat
=
sys
.
_ps_
=
None
def
manage_getSysPath
(
self
):
return
list
(
sys
.
path
)
...
...
src/App/dtml/profile.dtml
View file @
a6ad3081
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<dtml-if "REQUEST.get('reset')">
<dtml-call "manage_profile_reset()">
<br />
<div class="form-text">
Profiling data was reset.
</div>
<dtml-else>
<dtml-let sort="REQUEST.get('sort', 'time')"
limit="REQUEST.get('limit', 100)"
mode="REQUEST.get('mode', 'stats')"
...
...
@@ -50,6 +60,8 @@ Python profiler documentation</a>.
</td>
<td>
<input type="submit" name="submit" value="Update">
<input type="submit" name="reset" value="Reset data">
</td>
</tr>
</table>
...
...
@@ -71,4 +83,6 @@ used to dump a profile report when the process restarts or exits.
</dtml-if>
</dtml-let>
</dtml-if>
<dtml-var manage_page_footer>
src/App/tests/test_ApplicationManager.py
View file @
a6ad3081
...
...
@@ -239,6 +239,23 @@ class DebugManagerTests(unittest.TestCase):
#def test_dbconnections(self): XXX -- TOO UGLY TO TEST
#def test_manage_profile_stats(self): XXX -- TOO UGLY TO TEST
def
test_manage_profile_reset
(
self
):
import
sys
from
ZPublisher
import
Publish
_old_sys__ps_
=
getattr
(
sys
,
'_ps_'
,
self
)
_old_Publish_pstat
=
getattr
(
Publish
,
'_pstat'
,
self
)
sys
.
_ps_
=
Publish
.
_pstat
=
object
()
try
:
dm
=
self
.
_makeOne
(
'test'
)
dm
.
manage_profile_reset
()
finally
:
if
_old_sys__ps_
is
not
self
:
sys
.
_ps_
=
_old_sys__ps_
if
_old_Publish_pstat
is
not
self
:
Publish
.
_pstat
=
_old_Publish_pstat
self
.
failUnless
(
sys
.
_ps_
is
None
)
self
.
failUnless
(
Publish
.
_pstat
is
None
)
def
test_manage_getSysPath
(
self
):
import
sys
dm
=
self
.
_makeOne
(
'test'
)
...
...
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