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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
erp5
Commits
e87d3fa3
Commit
e87d3fa3
authored
Dec 18, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Zope-friendly subclasses for pprofile.
parent
443da0e4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
233 additions
and
2 deletions
+233
-2
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.pprofile.py
...TemplateItem/portal_components/extension.erp5.pprofile.py
+82
-0
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.pprofile.xml
...emplateItem/portal_components/extension.erp5.pprofile.xml
+148
-0
bt5/erp5_administration/bt/revision
bt5/erp5_administration/bt/revision
+1
-1
bt5/erp5_administration/bt/template_extension_id_list
bt5/erp5_administration/bt/template_extension_id_list
+2
-1
No files found.
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.pprofile.py
0 → 100644
View file @
e87d3fa3
import
pprofile
from
email.mime.multipart
import
MIMEMultipart
from
email.mime.text
import
MIMEText
from
email.mime.application
import
MIMEApplication
from
email.encoders
import
encode_quopri
from
cStringIO
import
StringIO
import
os
_allsep
=
os
.
sep
+
(
os
.
altsep
or
''
)
def
_relpath
(
name
):
return
os
.
path
.
normpath
(
os
.
path
.
splitdrive
(
name
)[
1
]).
lstrip
(
_allsep
)
class
ZopeBase
(
object
):
__allow_access_to_unprotected_subobjects__
=
1
def
_getFilename
(
self
,
filename
,
f_globals
):
if
'Script (Python)'
in
filename
:
try
:
script
=
f_globals
[
'script'
]
except
KeyError
:
pass
else
:
filename
=
script
.
id
return
filename
def
asMIMEString
(
self
):
"""
Return a mime-multipart representation of both callgrind profiling
statistics and all involved source code.
Avoids relying on a tempfile, as a zipfile/tarfile would require.
To unpack resulting file, see "unpack a MIME message" in
http://docs.python.org/2/library/email-examples.html
"""
result
=
MIMEMultipart
()
out
=
StringIO
()
self
.
callgrind
(
out
,
relative_path
=
True
)
profile
=
MIMEApplication
(
out
.
getvalue
(),
'x-kcachegrind'
,
encode_quopri
)
profile
.
add_header
(
'Content-Disposition'
,
'attachment'
,
filename
=
'cachegrind.out.pprofile'
,
)
result
.
attach
(
profile
)
for
name
,
lines
in
self
.
iterSource
():
lines
=
''
.
join
(
lines
)
if
lines
:
pyfile
=
MIMEText
(
lines
,
'x-python'
)
pyfile
.
add_header
(
'Content-Disposition'
,
'attachment'
,
filename
=
_relpath
(
name
),
)
result
.
attach
(
pyfile
)
return
result
.
as_string
(),
result
[
'content-type'
]
class
ZopeProfiler
(
ZopeBase
,
pprofile
.
Profile
):
pass
class
ZopeStatisticalProfile
(
ZopeBase
,
pprofile
.
StatisticalProfile
):
pass
class
ZopeStatisticalThread
(
pprofile
.
StatisticalThread
):
__allow_access_to_unprotected_subobjects__
=
1
def
getProfiler
(
verbose
=
False
,
**
kw
):
"""
Get a Zope-friendly pprofile.Profile instance.
"""
return
ZopeProfiler
(
**
kw
)
def
getStatisticalProfilerAndThread
(
**
kw
):
"""
Get Zope-friendly pprofile.StatisticalProfile and pprofile.StatisticalThread
instances. Arguments are forwarded to StatisticalThread.__init__ .
"""
profiler
=
ZopeStatisticalProfile
()
return
profiler
,
ZopeStatisticalThread
(
profiler
=
profiler
,
**
kw
)
bt5/erp5_administration/ExtensionTemplateItem/portal_components/extension.erp5.pprofile.xml
0 → 100644
View file @
e87d3fa3
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Extension Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
pprofile
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Zope-friendlyness layer for pprofile
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
extension.erp5.pprofile
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Extension Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
vincent.pelletier
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1387376214.83
</float>
<string>
GMT+1
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
bt5/erp5_administration/bt/revision
View file @
e87d3fa3
157
\ No newline at end of file
158
\ No newline at end of file
bt5/erp5_administration/bt/template_extension_id_list
View file @
e87d3fa3
extension.erp5.ERP5Administration
extension.erp5.Security
extension.erp5.pprofile
\ No newline at end of file
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