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
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
1b2d4766
Commit
1b2d4766
authored
7 years ago
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: support binary data in ZODB History View
It was failing decoding unicode
parent
c0203466
master
erp5-vifib-print-and-hashseed
feat/activities-clean-shutdown
feat/bt_xml_zope2_zope4
feat/coverage
feat/line-report-parrallel
feat/monaco-ruff
feat/py2zope4
feat/restricted_collections
feat/simplemde
feat/simplemde-text-editor
fix/configurator_consistency
fix/enable-xml-rpc
fix/erp5testnode-build-failures
fix/hashseed
fix/testnode_proctitle
fix/trial_balance_empty_gap
for_testrunner_1
py2zope4
tmp/rjs-translations
wip/adapative_folder_mt_index
wip/cmf_activity_runtime_grouped
wip/configurator_trade
wip/copy_reg_NamedAssignment
wip/corporate_cloudooo_fonts
wip/empty_criterion
wip/feat/payment_transaction_group_ERPJS
wip/interpolation_0_rebase
wip/loyalty_with_tml
wip/neo
wip/quick_erp5_test
wip/seleniumserver
wip/stock_browser
wip/testUpgradeInstanceWithOldDataFs_reference_json
zope4py2
zope4py2b
zope4py3
zope4py3-before-arnaud-rebase
zope4py3-bt-protocol1onpy3
zope4py3-rebase-starting-point
zope4py3-tmp
zope4py3-wip
wip/configurator_trade_old
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getZODBHistoryList.py
...ateItem/portal_skins/erp5_core/Base_getZODBHistoryList.py
+9
-1
product/ERP5/tests/testZODBHistory.py
product/ERP5/tests/testZODBHistory.py
+26
-0
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getZODBHistoryList.py
View file @
1b2d4766
...
@@ -8,7 +8,15 @@ if not getSecurityManager().getUser().has_permission('View History', context):
...
@@ -8,7 +8,15 @@ if not getSecurityManager().getUser().has_permission('View History', context):
raise
Unauthorized
()
raise
Unauthorized
()
def
beautifyChange
(
change_dict
):
def
beautifyChange
(
change_dict
):
return
[
"%s:%s"
%
(
k
,
change_dict
[
k
])
for
k
in
sorted
(
change_dict
.
keys
())]
change_list
=
[]
for
property_name
,
property_value
in
sorted
(
change_dict
.
items
()):
if
isinstance
(
property_value
,
basestring
):
try
:
unicode
(
property_value
,
'utf-8'
)
except
UnicodeDecodeError
:
property_value
=
'(binary)'
change_list
.
append
(
'%s:%s'
%
(
property_name
,
property_value
))
return
change_list
try
:
try
:
history_size
=
portal
.
portal_preferences
.
getPreferredHtmlStyleZodbHistorySize
()
history_size
=
portal
.
portal_preferences
.
getPreferredHtmlStyleZodbHistorySize
()
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/tests/testZODBHistory.py
View file @
1b2d4766
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
##############################################################################
##############################################################################
import
unittest
import
unittest
import
os
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
...
@@ -144,6 +145,31 @@ class TestZODBHistory(ERP5TypeTestCase):
...
@@ -144,6 +145,31 @@ class TestZODBHistory(ERP5TypeTestCase):
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
self
.
assertRaises
(
Unauthorized
,
document
.
Base_viewZODBHistory
)
self
.
assertRaises
(
Unauthorized
,
document
.
Base_viewZODBHistory
)
def
test_ZODBHistoryBinaryData
(
self
):
"""
Make sure ZODB History view works with binary content
"""
self
.
loginByUserName
(
'tatuya'
)
document
=
self
.
addOrganisation
(
self
.
id
()).
newContent
(
portal_type
=
'Embedded File'
)
document
.
setFile
(
open
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_data'
,
'images'
,
'erp5_logo.png'
)))
document
.
setTitle
(
"ロゴ"
)
self
.
commit
()
# no encoding error
document
.
Base_viewZODBHistory
()
change
,
=
document
.
Base_getZODBHistoryList
()
self
.
assertIn
(
'data:(binary)'
,
change
.
getProperty
(
'changes'
))
self
.
assertIn
(
'content_type:image/png'
,
change
.
getProperty
(
'changes'
))
self
.
assertIn
(
'title:ロゴ'
,
change
.
getProperty
(
'changes'
))
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
...
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