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
Carlos Ramos Carreño
erp5
Commits
0cfb1586
Commit
0cfb1586
authored
Jan 13, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
More python3 support
See merge request
nexedi/erp5!1863
parents
2e8ef0bb
7fc1e3b0
Changes
42
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
213 additions
and
191 deletions
+213
-191
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_resetGroupingReference.py
...nting/AccountingTransactionLine_resetGroupingReference.py
+3
-3
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_resetGroupingReference.xml
...ting/AccountingTransactionLine_resetGroupingReference.xml
+1
-1
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_setGroupingReference.py
...nting/AccountingTransactionModule_setGroupingReference.py
+1
-1
bt5/erp5_accounting/TestTemplateItem/portal_components/test.erp5.testAccounting.py
...emplateItem/portal_components/test.erp5.testAccounting.py
+1
-1
bt5/erp5_big_file/DocumentTemplateItem/portal_components/document.erp5.BigFile.py
...ntTemplateItem/portal_components/document.erp5.BigFile.py
+4
-0
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
...mplateItem/portal_components/test.erp5.testERP5Catalog.py
+8
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testXForwardedFor.py
...lateItem/portal_components/test.erp5.testXForwardedFor.py
+1
-1
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testEditorField.py
...mplateItem/portal_components/test.erp5.testEditorField.py
+1
-1
bt5/erp5_csv_style/SkinTemplateItem/portal_skins/erp5_csv_style/Listbox_exportCsv.py
...lateItem/portal_skins/erp5_csv_style/Listbox_exportCsv.py
+2
-1
bt5/erp5_forum_tutorial/SkinTemplateItem/portal_skins/erp5_forum/ListBox_asStandardHTML.zpt
...teItem/portal_skins/erp5_forum/ListBox_asStandardHTML.zpt
+2
-2
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
...portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
+3
-2
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_renderMessage.py
...em/portal_skins/erp5_hal_json_style/Base_renderMessage.py
+2
-1
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+36
-33
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Workflow_statusModify.py
...portal_skins/erp5_hal_json_style/Workflow_statusModify.py
+2
-1
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+65
-59
bt5/erp5_mobile/SkinTemplateItem/portal_skins/erp5_mobile_ui/ListBox_asHTML.zpt
...mplateItem/portal_skins/erp5_mobile_ui/ListBox_asHTML.zpt
+3
-3
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/field_ods_macro.zpt
...plateItem/portal_skins/erp5_ods_style/field_ods_macro.zpt
+2
-2
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_line_ods_macro.zpt
...em/portal_skins/erp5_ods_style/listbox_line_ods_macro.zpt
+3
-3
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.zpt
...ateItem/portal_skins/erp5_ods_style/listbox_ods_macro.zpt
+1
-1
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/style_macros.zpt
...TemplateItem/portal_skins/erp5_ods_style/style_macros.zpt
+1
-1
bt5/erp5_odt_style/SkinTemplateItem/portal_skins/erp5_odt_style/listbox_odt_macro.zpt
...ateItem/portal_skins/erp5_odt_style/listbox_odt_macro.zpt
+2
-2
bt5/erp5_officejs_ui_test/SkinTemplateItem/portal_skins/erp5_officejs_ui_test/Zuite_CommonTemplateForOnlyOffice.zpt
...p5_officejs_ui_test/Zuite_CommonTemplateForOnlyOffice.zpt
+0
-28
bt5/erp5_sql_browser/SkinTemplateItem/portal_skins/erp5_sql_browser/ZMySQLDAConnection_getQueryResultAsJSON.py
...p5_sql_browser/ZMySQLDAConnection_getQueryResultAsJSON.py
+2
-1
bt5/erp5_tiosafe_core/DocumentTemplateItem/portal_components/document.erp5.WebServiceRequest.py
...Item/portal_components/document.erp5.WebServiceRequest.py
+4
-0
product/ERP5/bin/zopewsgi.py
product/ERP5/bin/zopewsgi.py
+2
-7
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_renderActionList.zpt
...ortal_skins/erp5_access_tab/ERP5Site_renderActionList.zpt
+1
-1
product/ERP5Form/www/ListBox_asHTML.zpt
product/ERP5Form/www/ListBox_asHTML.zpt
+2
-2
product/ERP5OOo/tests/utils.py
product/ERP5OOo/tests/utils.py
+7
-3
product/ERP5Type/Utils.py
product/ERP5Type/Utils.py
+4
-0
product/ERP5Type/__init__.py
product/ERP5Type/__init__.py
+1
-1
product/ERP5Type/dynamic/portal_type_class.py
product/ERP5Type/dynamic/portal_type_class.py
+2
-3
product/ERP5Type/patches/DateTimePatch.py
product/ERP5Type/patches/DateTimePatch.py
+11
-9
product/ERP5Type/patches/Restricted.py
product/ERP5Type/patches/Restricted.py
+3
-0
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+1
-1
product/Formulator/Widget.py
product/Formulator/Widget.py
+1
-2
product/Formulator/tests/testForm.py
product/Formulator/tests/testForm.py
+15
-6
product/Localizer/utils.py
product/Localizer/utils.py
+2
-1
product/PortalTransforms/transforms/python.py
product/PortalTransforms/transforms/python.py
+1
-1
product/PortalTransforms/transforms/text_pre_to_html.py
product/PortalTransforms/transforms/text_pre_to_html.py
+1
-1
product/PortalTransforms/transforms/text_to_html.py
product/PortalTransforms/transforms/text_to_html.py
+1
-1
product/ZSQLCatalog/ZSQLCatalog.py
product/ZSQLCatalog/ZSQLCatalog.py
+5
-2
product/Zelenium/zuite.py
product/Zelenium/zuite.py
+3
-1
No files found.
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_resetGroupingReference.py
View file @
0cfb1586
"""Resets grouping reference on this line and all related lines.
"""Resets grouping reference on this line and all related lines.
This runs by default asynchronous
ly, but can be call with `async
=False` to
This runs by default asynchronous
hronously, but can be call with `asynchronous
=False` to
run synchronously and returns the list of ungrouped lines. With `async=True`,
run synchronously and returns the list of ungrouped lines. With `async
hronous
=True`,
the returned list is always empty.
the returned list is always empty.
"""
"""
...
@@ -13,7 +13,7 @@ if not context.getGroupingReference():
...
@@ -13,7 +13,7 @@ if not context.getGroupingReference():
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
resetGroupingReference
=
portal
.
ERP5Site_resetAccountingTransactionLineGroupingReference
resetGroupingReference
=
portal
.
ERP5Site_resetAccountingTransactionLineGroupingReference
if
async
:
if
async
hronous
:
resetGroupingReference
=
portal
.
portal_simulation
.
activate
(
resetGroupingReference
=
portal
.
portal_simulation
.
activate
(
activity
=
'SQLQueue'
,
activity
=
'SQLQueue'
,
after_tag
=
'accounting_grouping_reference'
after_tag
=
'accounting_grouping_reference'
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_resetGroupingReference.xml
View file @
0cfb1586
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
async=True
</string>
</value>
<value>
<string>
async
hronous
=True
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_setGroupingReference.py
View file @
0cfb1586
...
@@ -121,7 +121,7 @@ else:
...
@@ -121,7 +121,7 @@ else:
if
line
.
getGroupingReference
():
if
line
.
getGroupingReference
():
# Call AccountingTransactionLine_resetGroupingReference synchronously
# Call AccountingTransactionLine_resetGroupingReference synchronously
# to know the number of ungrouped lines.
# to know the number of ungrouped lines.
ungrouped_line_list
.
extend
(
line
.
AccountingTransactionLine_resetGroupingReference
(
async
=
False
))
ungrouped_line_list
.
extend
(
line
.
AccountingTransactionLine_resetGroupingReference
(
async
hronous
=
False
))
portal_status_message
=
Base_translateString
(
'${ungrouped_line_count} lines ungrouped.'
,
portal_status_message
=
Base_translateString
(
'${ungrouped_line_count} lines ungrouped.'
,
mapping
=
dict
(
ungrouped_line_count
=
len
(
ungrouped_line_list
)))
mapping
=
dict
(
ungrouped_line_count
=
len
(
ungrouped_line_list
)))
...
...
bt5/erp5_accounting/TestTemplateItem/portal_components/test.erp5.testAccounting.py
View file @
0cfb1586
...
@@ -3907,7 +3907,7 @@ class TestTransactions(AccountingTestCase):
...
@@ -3907,7 +3907,7 @@ class TestTransactions(AccountingTestCase):
# reset from the payment line, the invoice line from the same group will be
# reset from the payment line, the invoice line from the same group will be
# ungrouped
# ungrouped
payment_line
.
AccountingTransactionLine_resetGroupingReference
(
async
=
False
)
payment_line
.
AccountingTransactionLine_resetGroupingReference
(
async
hronous
=
False
)
self
.
assertFalse
(
payment_line
.
getGroupingReference
())
self
.
assertFalse
(
payment_line
.
getGroupingReference
())
self
.
assertFalse
(
payment_line
.
getGroupingDate
())
self
.
assertFalse
(
payment_line
.
getGroupingDate
())
self
.
assertFalse
(
invoice_line
.
getGroupingReference
())
self
.
assertFalse
(
invoice_line
.
getGroupingReference
())
...
...
bt5/erp5_big_file/DocumentTemplateItem/portal_components/document.erp5.BigFile.py
View file @
0cfb1586
...
@@ -27,6 +27,10 @@ from mimetools import choose_boundary
...
@@ -27,6 +27,10 @@ from mimetools import choose_boundary
from
Products.CMFCore.utils
import
_setCacheHeaders
,
_ViewEmulator
from
Products.CMFCore.utils
import
_setCacheHeaders
,
_ViewEmulator
from
DateTime
import
DateTime
from
DateTime
import
DateTime
import
re
import
re
import
six
if
six
.
PY3
:
long
=
int
# pylint:disable=redefined-builtin
class
BigFile
(
File
):
class
BigFile
(
File
):
"""
"""
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
View file @
0cfb1586
...
@@ -33,6 +33,7 @@ from random import randint
...
@@ -33,6 +33,7 @@ from random import randint
import
sys
import
sys
import
threading
import
threading
import
traceback
import
traceback
import
unittest
import
six
import
six
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
...
@@ -48,6 +49,9 @@ from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery, SimpleQuery
...
@@ -48,6 +49,9 @@ from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery, SimpleQuery
from
Testing
import
ZopeTestCase
from
Testing
import
ZopeTestCase
from
zLOG
import
LOG
from
zLOG
import
LOG
if
six
.
PY3
:
long
=
int
# pylint:disable=redefined-builtin
def
format_stack
(
thread
=
None
):
def
format_stack
(
thread
=
None
):
frame_dict
=
sys
.
_current_frames
()
frame_dict
=
sys
.
_current_frames
()
if
thread
is
not
None
:
if
thread
is
not
None
:
...
@@ -588,7 +592,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
...
@@ -588,7 +592,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
uid_dict
=
{}
uid_dict
=
{}
for
_
in
xrange
(
UID_BUFFER_SIZE
*
3
):
for
_
in
xrange
(
UID_BUFFER_SIZE
*
3
):
uid
=
portal_catalog
.
newUid
()
uid
=
portal_catalog
.
newUid
()
self
.
assert
True
(
isinstance
(
uid
,
long
)
)
self
.
assert
IsInstance
(
uid
,
long
)
self
.
assertNotIn
(
uid
,
uid_dict
)
self
.
assertNotIn
(
uid
,
uid_dict
)
uid_dict
[
uid
]
=
None
uid_dict
[
uid
]
=
None
...
@@ -1647,6 +1651,9 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
...
@@ -1647,6 +1651,9 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
portal_type
=
'Organisation'
,
**
catalog_kw
)])
portal_type
=
'Organisation'
,
**
catalog_kw
)])
def
test_54_FixIntUid
(
self
):
def
test_54_FixIntUid
(
self
):
if
six
.
PY3
:
return
unittest
.
skipTest
(
"Python3 does not have different types for int and long"
)
portal
=
self
.
getPortal
()
portal
=
self
.
getPortal
()
module
=
portal
.
getDefaultModule
(
'Organisation'
)
module
=
portal
.
getDefaultModule
(
'Organisation'
)
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testXForwardedFor.py
View file @
0cfb1586
...
@@ -34,7 +34,7 @@ import unittest
...
@@ -34,7 +34,7 @@ import unittest
def
get_Z2_log_last_line
():
def
get_Z2_log_last_line
():
z2_log_path
=
os
.
path
.
join
(
log_directory
,
'Z2.log'
)
z2_log_path
=
os
.
path
.
join
(
log_directory
,
'Z2.log'
)
f
=
open
(
z2_log_path
,
'r
b
'
)
f
=
open
(
z2_log_path
,
'r'
)
try
:
try
:
f
.
seek
(
-
256
,
os
.
SEEK_END
)
# Assumes last line is not longer than 256 chars (it should be about 130)
f
.
seek
(
-
256
,
os
.
SEEK_END
)
# Assumes last line is not longer than 256 chars (it should be about 130)
except
IOError
:
# too short
except
IOError
:
# too short
...
...
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testEditorField.py
View file @
0cfb1586
...
@@ -34,7 +34,7 @@ import unittest
...
@@ -34,7 +34,7 @@ import unittest
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
from
Testing
import
ZopeTestCase
from
Testing
import
ZopeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
DocumentTemplate.
DT_Util
import
html_quote
from
DocumentTemplate.
html_quote
import
html_quote
class
TestEditorField
(
ERP5TypeTestCase
,
ZopeTestCase
.
Functional
):
class
TestEditorField
(
ERP5TypeTestCase
,
ZopeTestCase
.
Functional
):
"""
"""
...
...
bt5/erp5_csv_style/SkinTemplateItem/portal_skins/erp5_csv_style/Listbox_exportCsv.py
View file @
0cfb1586
# export_only : allow to disable the uid column and the id of columns
# export_only : allow to disable the uid column and the id of columns
import
six
result
=
''
result
=
''
request
=
context
.
REQUEST
request
=
context
.
REQUEST
...
@@ -9,7 +10,7 @@ listboxline_list = context.get_value('default', render_format='list', REQUEST=re
...
@@ -9,7 +10,7 @@ listboxline_list = context.get_value('default', render_format='list', REQUEST=re
def
encode
(
value
):
def
encode
(
value
):
if
isinstance
(
value
,
bool
):
if
isinstance
(
value
,
bool
):
return
'"%s"'
%
value
return
'"%s"'
%
value
if
isinstance
(
value
,
(
int
,
long
,
float
)):
if
isinstance
(
value
,
six
.
integer_types
+
(
float
,
)):
return
str
(
value
)
return
str
(
value
)
else
:
else
:
if
isinstance
(
value
,
str
):
if
isinstance
(
value
,
str
):
...
...
bt5/erp5_forum_tutorial/SkinTemplateItem/portal_skins/erp5_forum/ListBox_asStandardHTML.zpt
View file @
0cfb1586
...
@@ -238,7 +238,7 @@
...
@@ -238,7 +238,7 @@
error python: value[2]"
error python: value[2]"
class="DataA" align="left"
class="DataA" align="left"
tal:attributes="class python: error and (css + 'Error') or css;
tal:attributes="class python: error and (css + 'Error') or css;
align python: isinstance(original_value,
(float, int, long
)) and 'right' or 'left'">
align python: isinstance(original_value,
modules['six'].integer_types + (float,
)) and 'right' or 'left'">
<input tal:condition="not: repeat/value/index"
<input tal:condition="not: repeat/value/index"
type="hidden" value="1" name="listbox_uid:list"
type="hidden" value="1" name="listbox_uid:list"
tal:attributes="value python: line.getUid() or '';
tal:attributes="value python: line.getUid() or '';
...
@@ -268,7 +268,7 @@
...
@@ -268,7 +268,7 @@
<tal:block tal:repeat="value here/getStatValueList">
<tal:block tal:repeat="value here/getStatValueList">
<td class="Data" align="left"
<td class="Data" align="left"
tal:define="original_value python: value[0]; processed_value python: value[1]"
tal:define="original_value python: value[0]; processed_value python: value[1]"
tal:attributes="align python: isinstance(original_value,
(float, int, long
)) and 'right' or 'left'"
tal:attributes="align python: isinstance(original_value,
modules['six'].integer_types + (float,
)) and 'right' or 'left'"
tal:content="structure processed_value" />
tal:content="structure processed_value" />
</tal:block>
</tal:block>
</tr>
</tr>
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
View file @
0cfb1586
...
@@ -15,16 +15,17 @@ There are runtime values hidden in every dialog form (injected by getHateoas Scr
...
@@ -15,16 +15,17 @@ There are runtime values hidden in every dialog form (injected by getHateoas Scr
from
erp5.component.module.Log
import
log
,
WARNING
from
erp5.component.module.Log
import
log
,
WARNING
from
Products.Formulator.Errors
import
FormValidationError
from
Products.Formulator.Errors
import
FormValidationError
import
json
import
json
import
six
# http://stackoverflow.com/a/13105359
# http://stackoverflow.com/a/13105359
def
byteify
(
value
):
def
byteify
(
value
):
if
isinstance
(
value
,
dict
):
if
isinstance
(
value
,
dict
):
return
{
byteify
(
key
):
byteify
(
value
)
for
key
,
value
in
value
.
iteritems
(
)}
return
{
byteify
(
key
):
byteify
(
value
)
for
key
,
value
in
six
.
iteritems
(
value
)}
elif
isinstance
(
value
,
list
):
elif
isinstance
(
value
,
list
):
return
[
byteify
(
element
)
for
element
in
value
]
return
[
byteify
(
element
)
for
element
in
value
]
elif
isinstance
(
value
,
tuple
):
elif
isinstance
(
value
,
tuple
):
return
tuple
(
byteify
(
element
)
for
element
in
value
)
return
tuple
(
byteify
(
element
)
for
element
in
value
)
elif
isinstance
(
value
,
unicod
e
):
elif
six
.
PY2
and
isinstance
(
value
,
six
.
text_typ
e
):
return
value
.
encode
(
'utf-8'
)
return
value
.
encode
(
'utf-8'
)
else
:
else
:
return
value
return
value
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_renderMessage.py
View file @
0cfb1586
...
@@ -6,8 +6,9 @@ Return JSON with message to be displayed and set according HTTP STATUS for messa
...
@@ -6,8 +6,9 @@ Return JSON with message to be displayed and set according HTTP STATUS for messa
"""
"""
import
json
import
json
from
erp5.component.module.Log
import
WARNING
,
ERROR
from
erp5.component.module.Log
import
WARNING
,
ERROR
import
six
if
isinstance
(
level
,
(
str
,
unicod
e
)):
if
isinstance
(
level
,
(
str
,
six
.
text_typ
e
)):
if
level
.
lower
()
==
"error"
:
if
level
.
lower
()
==
"error"
:
response_code
=
500
response_code
=
500
elif
level
.
lower
().
startswith
(
"warn"
):
elif
level
.
lower
().
startswith
(
"warn"
):
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
0cfb1586
...
@@ -49,7 +49,7 @@ When handling form, we can expect field values to be stored in REQUEST.form in t
...
@@ -49,7 +49,7 @@ When handling form, we can expect field values to be stored in REQUEST.form in t
from
ZTUtils
import
make_query
from
ZTUtils
import
make_query
import
json
import
json
import
urllib
from
six.moves.urllib.parse
import
urlencode
from
base64
import
urlsafe_b64encode
,
urlsafe_b64decode
from
base64
import
urlsafe_b64encode
,
urlsafe_b64decode
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
ZODB.POSException
import
ConflictError
from
ZODB.POSException
import
ConflictError
...
@@ -63,6 +63,8 @@ from Products.ERP5Type.Message import Message
...
@@ -63,6 +63,8 @@ from Products.ERP5Type.Message import Message
from
collections
import
OrderedDict
from
collections
import
OrderedDict
from
Products.ERP5Form.Selection
import
Selection
from
Products.ERP5Form.Selection
import
Selection
from
Products.PythonScripts.standard
import
Object
from
Products.PythonScripts.standard
import
Object
from
Products.ERP5Type.Utils
import
bytes2str
,
str2bytes
import
six
MARKER
=
Object
()
MARKER
=
Object
()
...
@@ -83,7 +85,7 @@ def toBasicTypes(obj):
...
@@ -83,7 +85,7 @@ def toBasicTypes(obj):
"""Ensure that obj contains only basic types."""
"""Ensure that obj contains only basic types."""
if
obj
is
None
:
if
obj
is
None
:
return
obj
return
obj
if
isinstance
(
obj
,
(
bool
,
int
,
float
,
long
,
str
,
unicode
)):
if
isinstance
(
obj
,
(
bool
,
float
,
str
)
+
six
.
integer_types
+
(
six
.
text_type
,
)):
return
obj
return
obj
if
isinstance
(
obj
,
list
):
if
isinstance
(
obj
,
list
):
return
[
toBasicTypes
(
x
)
for
x
in
obj
]
return
[
toBasicTypes
(
x
)
for
x
in
obj
]
...
@@ -124,12 +126,12 @@ def renderHiddenField(form, name, value):
...
@@ -124,12 +126,12 @@ def renderHiddenField(form, name, value):
# http://stackoverflow.com/a/13105359
# http://stackoverflow.com/a/13105359
def
byteify
(
string
):
def
byteify
(
string
):
if
isinstance
(
string
,
dict
):
if
isinstance
(
string
,
dict
):
return
{
byteify
(
key
):
byteify
(
value
)
for
key
,
value
in
s
tring
.
iteritems
(
)}
return
{
byteify
(
key
):
byteify
(
value
)
for
key
,
value
in
s
ix
.
iteritems
(
string
)}
elif
isinstance
(
string
,
list
):
elif
isinstance
(
string
,
list
):
return
[
byteify
(
element
)
for
element
in
string
]
return
[
byteify
(
element
)
for
element
in
string
]
elif
isinstance
(
string
,
tuple
):
elif
isinstance
(
string
,
tuple
):
return
tuple
(
byteify
(
element
)
for
element
in
string
)
return
tuple
(
byteify
(
element
)
for
element
in
string
)
elif
isinstance
(
string
,
unicod
e
):
elif
six
.
PY2
and
isinstance
(
string
,
six
.
text_typ
e
):
return
string
.
encode
(
'utf-8'
)
return
string
.
encode
(
'utf-8'
)
else
:
else
:
return
string
return
string
...
@@ -139,10 +141,11 @@ def ensureUTF8(obj):
...
@@ -139,10 +141,11 @@ def ensureUTF8(obj):
"""Make sure string is UTF-8, by replacing characters that
"""Make sure string is UTF-8, by replacing characters that
cannot be decoded.
cannot be decoded.
"""
"""
if
isinstance
(
obj
,
str
):
if
six
.
PY2
:
return
obj
.
decode
(
'utf-8'
,
'replace'
).
encode
(
'utf-8'
)
if
isinstance
(
obj
,
str
):
elif
isinstance
(
obj
,
unicode
):
return
obj
.
decode
(
'utf-8'
,
'replace'
).
encode
(
'utf-8'
)
return
obj
.
encode
(
'utf-8'
,
'replace'
)
elif
isinstance
(
obj
,
six
.
text_type
):
return
obj
.
encode
(
'utf-8'
,
'replace'
)
return
obj
return
obj
def
ensureSerializable
(
obj
):
def
ensureSerializable
(
obj
):
...
@@ -421,8 +424,8 @@ def getFieldDefault(form, field, key, value=MARKER):
...
@@ -421,8 +424,8 @@ def getFieldDefault(form, field, key, value=MARKER):
if value is MARKER:
if value is MARKER:
# use marker because default value can be intentionally empty string
# use marker because default value can be intentionally empty string
value = field.get_value('default', request=REQUEST, REQUEST=REQUEST)
value = field.get_value('default', request=REQUEST, REQUEST=REQUEST)
if
field.has_value("unicode") and field.get_value("unicode") and isinstance(value, unicod
e):
if
six.PY2 and field.has_value("unicode") and field.get_value("unicode") and isinstance(value, six.text_typ
e):
value =
unicode(value,
form.get_form_encoding())
value =
value.decode(
form.get_form_encoding())
if getattr(value, 'translate', None) is not None:
if getattr(value, 'translate', None) is not None:
return "%s" % value
return "%s" % value
return value
return value
...
@@ -476,7 +479,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
...
@@ -476,7 +479,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
selected_language
=
erp5_ui
.
get_selected_language
()
selected_language
=
erp5_ui
.
get_selected_language
()
result
[
"translate_title_href"
]
=
'%s/manage_messages?%s'
%
(
result
[
"translate_title_href"
]
=
'%s/manage_messages?%s'
%
(
'/'
.
join
(
erp5_ui
.
getPhysicalPath
()[
2
:]),
'/'
.
join
(
erp5_ui
.
getPhysicalPath
()[
2
:]),
url
lib
.
url
encode
({
"regex"
:
"^%s$"
%
field
.
title
(),
urlencode
({
"regex"
:
"^%s$"
%
field
.
title
(),
"lang"
:
selected_language
})
"lang"
:
selected_language
})
)
)
...
@@ -484,7 +487,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
...
@@ -484,7 +487,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
if
field_description
:
if
field_description
:
result
[
"translate_description_href"
]
=
'%s/manage_messages?%s'
%
(
result
[
"translate_description_href"
]
=
'%s/manage_messages?%s'
%
(
'/'
.
join
(
erp5_ui
.
getPhysicalPath
()[
2
:]),
'/'
.
join
(
erp5_ui
.
getPhysicalPath
()[
2
:]),
url
lib
.
url
encode
({
"regex"
:
"^%s$"
%
field_description
,
urlencode
({
"regex"
:
"^%s$"
%
field_description
,
"lang"
:
selected_language
})
"lang"
:
selected_language
})
)
)
...
@@ -666,11 +669,11 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
...
@@ -666,11 +669,11 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
"script_id"
:
script
.
id
,
"script_id"
:
script
.
id
,
"relative_url"
:
getRealRelativeUrl
(
traversed_document
).
replace
(
"/"
,
"%2F"
),
"relative_url"
:
getRealRelativeUrl
(
traversed_document
).
replace
(
"/"
,
"%2F"
),
"view"
:
"Base_viewRelatedObjectList"
,
"view"
:
"Base_viewRelatedObjectList"
,
"extra_param_json"
:
urlsafe_b64encode
(
"extra_param_json"
:
bytes2str
(
urlsafe_b64encode
(
str2bytes
(
json
.
dumps
(
ensureSerializable
({
json
.
dumps
(
ensureSerializable
({
'original_form_id'
:
form
.
id
,
'original_form_id'
:
form
.
id
,
'field_id'
:
field
.
id
'field_id'
:
field
.
id
})))
})))
))
}
}
})
})
...
@@ -719,7 +722,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
...
@@ -719,7 +722,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
or
field
.
get_value
(
"editable_columns"
))]
or
field
.
get_value
(
"editable_columns"
))]
all_column_list
=
[(
name
,
title
)
for
name
,
title
in
field
.
get_value
(
"all_columns"
)]
all_column_list
=
[(
name
,
title
)
for
name
,
title
in
field
.
get_value
(
"all_columns"
)]
catalog_column_list
=
[(
name
,
title
)
catalog_column_list
=
[(
name
,
title
)
for
name
,
title
in
OrderedDict
(
column_list
+
all_column_list
).
items
(
)
for
name
,
title
in
six
.
iteritems
(
OrderedDict
(
column_list
+
all_column_list
)
)
if
sql_catalog
.
isValidColumn
(
name
)]
if
sql_catalog
.
isValidColumn
(
name
)]
# try to get specified searchable columns and fail back to all searchable columns
# try to get specified searchable columns and fail back to all searchable columns
...
@@ -791,10 +794,10 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
...
@@ -791,10 +794,10 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
"relative_url"
:
getRealRelativeUrl
(
traversed_document
).
replace
(
"/"
,
"%2F"
),
"relative_url"
:
getRealRelativeUrl
(
traversed_document
).
replace
(
"/"
,
"%2F"
),
"form_relative_url"
:
"%s/%s"
%
(
form_relative_url
,
field
.
id
),
"form_relative_url"
:
"%s/%s"
%
(
form_relative_url
,
field
.
id
),
"list_method"
:
list_method_name
,
"list_method"
:
list_method_name
,
"default_param_json"
:
urlsafe_b64encode
(
"default_param_json"
:
bytes2str
(
urlsafe_b64encode
(
str2bytes
(
json
.
dumps
(
ensureSerializable
(
list_method_query_dict
))),
json
.
dumps
(
ensureSerializable
(
list_method_query_dict
)))
))
,
"extra_param_json"
:
urlsafe_b64encode
(
"extra_param_json"
:
bytes2str
(
urlsafe_b64encode
(
str2bytes
(
json
.
dumps
(
ensureSerializable
(
extra_param_dict
)))
json
.
dumps
(
ensureSerializable
(
extra_param_dict
)))
))
}
}
# once we imprint `default_params` into query string of 'list method' we
# once we imprint `default_params` into query string of 'list method' we
# don't want them to propagate to the query as well
# don't want them to propagate to the query as well
...
@@ -813,7 +816,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
...
@@ -813,7 +816,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
"script_id": script.id,
"script_id": script.id,
"relative_url": traversed_document.getRelativeUrl().replace("/", "%2F"),
"relative_url": traversed_document.getRelativeUrl().replace("/", "%2F"),
"list_method": list_method_name,
"list_method": list_method_name,
"default_param_json":
urlsafe_b64encode(json.dumps(ensureSerializable(list_method_query_dict
)))
"default_param_json":
bytes2str(urlsafe_b64encode(str2bytes(json.dumps(ensureSerializable(list_method_query_dict))
)))
}
}
list_method_query_dict = {}
list_method_query_dict = {}
"""
"""
...
@@ -1057,12 +1060,12 @@ def renderForm(traversed_document, form, response_dict, key_prefix=None, selecti
...
@@ -1057,12 +1060,12 @@ def renderForm(traversed_document, form, response_dict, key_prefix=None, selecti
"script_id"
:
script
.
id
,
"script_id"
:
script
.
id
,
"relative_url"
:
getRealRelativeUrl
(
traversed_document
).
replace
(
"/"
,
"%2F"
),
"relative_url"
:
getRealRelativeUrl
(
traversed_document
).
replace
(
"/"
,
"%2F"
),
"view"
:
"Base_viewRelatedObjectList"
,
"view"
:
"Base_viewRelatedObjectList"
,
"extra_param_json"
:
urlsafe_b64encode
(
"extra_param_json"
:
bytes2str
(
urlsafe_b64encode
(
str2bytes
(
json
.
dumps
(
ensureSerializable
({
json
.
dumps
(
ensureSerializable
({
'proxy_listbox_id'
:
x
,
'proxy_listbox_id'
:
x
,
'original_form_id'
:
extra_param_json
[
'original_form_id'
],
'original_form_id'
:
extra_param_json
[
'original_form_id'
],
'field_id'
:
extra_param_json
[
'field_id'
]
'field_id'
:
extra_param_json
[
'field_id'
]
})))
})))
))
})
for
x
,
y
in
proxy_form_id_list
],
})
for
x
,
y
in
proxy_form_id_list
],
"first_item"
:
1
,
"first_item"
:
1
,
"required"
:
0
,
"required"
:
0
,
...
@@ -1080,12 +1083,12 @@ def renderForm(traversed_document, form, response_dict, key_prefix=None, selecti
...
@@ -1080,12 +1083,12 @@ def renderForm(traversed_document, form, response_dict, key_prefix=None, selecti
"script_id"
:
script
.
id
,
"script_id"
:
script
.
id
,
"relative_url"
:
getRealRelativeUrl
(
traversed_document
).
replace
(
"/"
,
"%2F"
),
"relative_url"
:
getRealRelativeUrl
(
traversed_document
).
replace
(
"/"
,
"%2F"
),
"view"
:
"Base_viewRelatedObjectList"
,
"view"
:
"Base_viewRelatedObjectList"
,
"extra_param_json"
:
urlsafe_b64encode
(
"extra_param_json"
:
bytes2str
(
urlsafe_b64encode
(
str2bytes
(
json
.
dumps
(
ensureSerializable
({
json
.
dumps
(
ensureSerializable
({
'proxy_listbox_id'
:
REQUEST
.
get
(
'proxy_listbox_id'
,
None
),
'proxy_listbox_id'
:
REQUEST
.
get
(
'proxy_listbox_id'
,
None
),
'original_form_id'
:
extra_param_json
[
'original_form_id'
],
'original_form_id'
:
extra_param_json
[
'original_form_id'
],
'field_id'
:
extra_param_json
[
'field_id'
]
'field_id'
:
extra_param_json
[
'field_id'
]
})))
})))
))
}
}
# Go through all groups ("left", "bottom", "hidden" etc.) and add fields from
# Go through all groups ("left", "bottom", "hidden" etc.) and add fields from
...
@@ -1283,7 +1286,7 @@ def renderFormDefinition(form, response_dict):
...
@@ -1283,7 +1286,7 @@ def renderFormDefinition(form, response_dict):
def
statusLevelToString
(
level
):
def
statusLevelToString
(
level
):
"""Transform any level format to lowercase string representation"""
"""Transform any level format to lowercase string representation"""
if
isinstance
(
level
,
(
str
,
unicod
e
)):
if
isinstance
(
level
,
(
str
,
six
.
text_typ
e
)):
if
level
.
lower
()
==
"error"
:
if
level
.
lower
()
==
"error"
:
return
"error"
return
"error"
elif
level
.
lower
().
startswith
(
"warn"
):
elif
level
.
lower
().
startswith
(
"warn"
):
...
@@ -1584,7 +1587,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -1584,7 +1587,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
"script_id"
:
script
.
id
,
# this script (ERP5Document_getHateoas)
"script_id"
:
script
.
id
,
# this script (ERP5Document_getHateoas)
"relative_url"
:
getRealRelativeUrl
(
traversed_document
).
replace
(
"/"
,
"%2F"
),
"relative_url"
:
getRealRelativeUrl
(
traversed_document
).
replace
(
"/"
,
"%2F"
),
"view"
:
erp5_action_list
[
-
1
][
'name'
],
"view"
:
erp5_action_list
[
-
1
][
'name'
],
"extra_param_json"
:
urlsafe_b64encode
(
json
.
dumps
(
ensureSerializable
(
extra_param_json
)))
"extra_param_json"
:
bytes2str
(
urlsafe_b64encode
(
str2bytes
(
json
.
dumps
(
ensureSerializable
(
extra_param_json
))
)))
}
}
if
erp5_action_list
:
if
erp5_action_list
:
...
@@ -1738,7 +1741,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -1738,7 +1741,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
# Those parameter will be send back during the listbox submission
# Those parameter will be send back during the listbox submission
# to ensure fetching the same lines
# to ensure fetching the same lines
listbox_query_param_json
=
urlsafe_b64encode
(
json
.
dumps
(
ensureSerializable
({
listbox_query_param_json
=
bytes2str
(
urlsafe_b64encode
(
str2bytes
(
json
.
dumps
(
ensureSerializable
({
'form_relative_url'
:
form_relative_url
,
'form_relative_url'
:
form_relative_url
,
'list_method'
:
list_method
,
'list_method'
:
list_method
,
'default_param_json'
:
default_param_json
,
'default_param_json'
:
default_param_json
,
...
@@ -1751,7 +1754,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -1751,7 +1754,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
'relative_url'
:
relative_url
,
'relative_url'
:
relative_url
,
'group_by'
:
group_by
,
'group_by'
:
group_by
,
'sort_on'
:
sort_on
'sort_on'
:
sort_on
})))
})))
))
# set 'here' for field rendering which contain TALES expressions
# set 'here' for field rendering which contain TALES expressions
REQUEST
.
set
(
'here'
,
traversed_document
)
REQUEST
.
set
(
'here'
,
traversed_document
)
...
@@ -1925,7 +1928,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -1925,7 +1928,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
column_list = [(name, title) for name, title in source_field.get_value("
columns
") if name in select_list]
column_list = [(name, title) for name, title in source_field.get_value("
columns
") if name in select_list]
all_column_list = [(name, title) for name, title in source_field.get_value("
all_columns
") if name in select_list]
all_column_list = [(name, title) for name, title in source_field.get_value("
all_columns
") if name in select_list]
selection_kw['columns'] = [(name, title)
selection_kw['columns'] = [(name, title)
for name, title in
OrderedDict(column_list + all_column_list).items(
)]
for name, title in
six.iteritems(OrderedDict(column_list + all_column_list)
)]
else:
else:
selection_kw['columns'] = []
selection_kw['columns'] = []
...
@@ -2197,8 +2200,8 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -2197,8 +2200,8 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
"script_id"
:
script
.
id
,
"script_id"
:
script
.
id
,
"relative_url"
:
url_parameter_dict
[
'view_kw'
][
'jio_key'
].
replace
(
"/"
,
"%2F"
),
"relative_url"
:
url_parameter_dict
[
'view_kw'
][
'jio_key'
].
replace
(
"/"
,
"%2F"
),
"view"
:
url_parameter_dict
[
'view_kw'
][
'view'
],
"view"
:
url_parameter_dict
[
'view_kw'
][
'view'
],
"extra_param_json"
:
urlsafe_b64encode
(
"extra_param_json"
:
bytes2str
(
urlsafe_b64encode
(
str2bytes
(
json
.
dumps
(
ensureSerializable
(
extra_url_param_dict
)))
json
.
dumps
(
ensureSerializable
(
extra_url_param_dict
)))
))
}
}
# endfor select
# endfor select
...
@@ -2415,8 +2418,8 @@ if mode == 'url_generator':
...
@@ -2415,8 +2418,8 @@ if mode == 'url_generator':
keep_items_json
=
None
keep_items_json
=
None
else
:
else
:
generator_key
=
'traverse_generator_action'
generator_key
=
'traverse_generator_action'
keep_items_json
=
urlsafe_b64encode
(
keep_items_json
=
bytes2str
(
urlsafe_b64encode
(
str2bytes
(
json
.
dumps
(
ensureSerializable
(
keep_items
)))
json
.
dumps
(
ensureSerializable
(
keep_items
)))
))
return
url_template_dict
[
generator_key
]
%
{
return
url_template_dict
[
generator_key
]
%
{
"root_url"
:
site_root
.
absolute_url
(),
"root_url"
:
site_root
.
absolute_url
(),
"script_id"
:
'ERP5Document_getHateoas'
,
"script_id"
:
'ERP5Document_getHateoas'
,
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Workflow_statusModify.py
View file @
0cfb1586
...
@@ -3,6 +3,7 @@ from Products.Formulator.Errors import FormValidationError
...
@@ -3,6 +3,7 @@ from Products.Formulator.Errors import FormValidationError
from
Products.ERP5Type.Core.Workflow
import
ValidationFailed
from
Products.ERP5Type.Core.Workflow
import
ValidationFailed
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
from
erp5.component.module.Log
import
WARNING
from
erp5.component.module.Log
import
WARNING
import
six
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
request
=
REQUEST
or
context
.
REQUEST
request
=
REQUEST
or
context
.
REQUEST
...
@@ -43,7 +44,7 @@ for f in form.get_fields():
...
@@ -43,7 +44,7 @@ for f in form.get_fields():
listbox
=
request
.
get
(
'listbox'
)
# XXX: hardcoded field name
listbox
=
request
.
get
(
'listbox'
)
# XXX: hardcoded field name
if
listbox
is
not
None
:
if
listbox
is
not
None
:
listbox_line_list
=
[]
listbox_line_list
=
[]
for
key
,
value
in
sorted
(
listbox
.
iteritems
(
)):
for
key
,
value
in
sorted
(
six
.
iteritems
(
listbox
)):
value
[
'listbox_key'
]
=
key
value
[
'listbox_key'
]
=
key
listbox_line_list
.
append
(
value
)
listbox_line_list
.
append
(
value
)
doaction_param_list
[
'listbox'
]
=
tuple
(
listbox_line_list
)
doaction_param_list
[
'listbox'
]
=
tuple
(
listbox_line_list
)
...
...
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
0cfb1586
...
@@ -15,12 +15,13 @@ import DateTime
...
@@ -15,12 +15,13 @@ import DateTime
import
StringIO
import
StringIO
import
json
import
json
import
re
import
re
import
urllib
from
six.moves.urllib.parse
import
quote
,
quote_plus
import
mock
import
mock
from
zope.globalrequest
import
setRequest
# pylint: disable=no-name-in-module, import-error
from
zope.globalrequest
import
setRequest
# pylint: disable=no-name-in-module, import-error
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
from
Products.ERP5Form.Selection
import
Selection
,
DomainSelection
from
Products.ERP5Form.Selection
import
Selection
,
DomainSelection
from
Products.ERP5Type.Utils
import
ensure_list
,
str2unicode
,
unicode2str
def
changeSkin
(
skin_name
):
def
changeSkin
(
skin_name
):
...
@@ -123,7 +124,7 @@ def do_fake_request(request_method, headers=None, data=()):
...
@@ -123,7 +124,7 @@ def do_fake_request(request_method, headers=None, data=()):
if
data
and
request_method
.
upper
()
==
'GET'
:
if
data
and
request_method
.
upper
()
==
'GET'
:
# see: GET http://www.cgi101.com/book/ch3/text.html
# see: GET http://www.cgi101.com/book/ch3/text.html
env
[
'QUERY_STRING'
]
=
'&'
.
join
(
env
[
'QUERY_STRING'
]
=
'&'
.
join
(
'{}={}'
.
format
(
urllib
.
quote_plus
(
key
),
urllib
.
quote
(
value
))
'{}={}'
.
format
(
quote_plus
(
key
),
quote
(
value
))
for
key
,
value
in
data
for
key
,
value
in
data
)
)
...
@@ -132,7 +133,7 @@ def do_fake_request(request_method, headers=None, data=()):
...
@@ -132,7 +133,7 @@ def do_fake_request(request_method, headers=None, data=()):
env
[
'CONTENT_TYPE'
]
=
'application/x-www-form-urlencoded'
env
[
'CONTENT_TYPE'
]
=
'application/x-www-form-urlencoded'
for
key
,
value
in
data
:
for
key
,
value
in
data
:
body_stream
.
write
(
'{}={!s}&'
.
format
(
body_stream
.
write
(
'{}={!s}&'
.
format
(
urllib
.
quote_plus
(
key
),
urllib
.
quote
(
value
)))
quote_plus
(
key
),
quote
(
value
)))
request
=
HTTPRequest
(
body_stream
,
env
,
HTTPResponse
())
request
=
HTTPRequest
(
body_stream
,
env
,
HTTPResponse
())
if
data
and
request_method
.
upper
()
==
'POST'
:
if
data
and
request_method
.
upper
()
==
'POST'
:
...
@@ -346,21 +347,21 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
...
@@ -346,21 +347,21 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'href'
],
"%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
"%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'href'
],
"%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
"%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'href'
],
"%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog"
%
(
"%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'title'
],
"Custom Action No Dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'title'
],
"Custom Action No Dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'name'
],
"custom_action_no_dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'name'
],
"custom_action_no_dialog"
)
...
@@ -374,17 +375,17 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
...
@@ -374,17 +375,17 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'href'
],
"%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document"
%
(
"%s/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'title'
],
"Create a Document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'title'
],
"Create a Document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'name'
],
"create_a_document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'name'
],
"create_a_document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'href'
],
'urn:jio:get:portal_types/%s'
%
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'href'
],
'urn:jio:get:portal_types/%s'
%
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'name'
],
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'name'
],
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'title'
].
encode
(
"UTF-8"
),
document
.
getTitle
())
self
.
assertEqual
(
unicode2str
(
result_dict
[
'title'
]
),
document
.
getTitle
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'title'
],
document
.
getTitle
().
decode
(
"UTF-8"
))
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'title'
],
str2unicode
(
document
.
getTitle
()
))
self
.
assertEqual
(
result_dict
[
'_debug'
],
"root"
)
self
.
assertEqual
(
result_dict
[
'_debug'
],
"root"
)
@
simulate
(
'Base_getRequestUrl'
,
'*args, **kwargs'
,
@
simulate
(
'Base_getRequestUrl'
,
'*args, **kwargs'
,
...
@@ -413,21 +414,21 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
...
@@ -413,21 +414,21 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=embed_action"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=embed_action"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'title'
],
"Embed"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'title'
],
"Embed"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'name'
],
"embed_action"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'name'
],
"embed_action"
)
...
@@ -440,7 +441,7 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
...
@@ -440,7 +441,7 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'title'
],
"Create a Document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'title'
],
"Create a Document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'name'
],
"create_a_document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'name'
],
"create_a_document"
)
...
@@ -457,10 +458,10 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
...
@@ -457,10 +458,10 @@ class TestERP5Document_getHateoas_mode_root(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_links'
][
'traverse'
][
'templated'
],
True
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'traverse'
][
'templated'
],
True
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'traverse'
][
'name'
],
"Traverse"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'traverse'
][
'name'
],
"Traverse"
)
self
.
assertEqual
(
result_dict
[
'title'
].
encode
(
"UTF-8"
),
document
.
getTitle
())
self
.
assertEqual
(
unicode2str
(
result_dict
[
'title'
]
),
document
.
getTitle
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'title'
],
document
.
getTitle
().
decode
(
"UTF-8"
))
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'title'
],
str2unicode
(
document
.
getTitle
()
))
self
.
assertEqual
(
result_dict
[
'default_view'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'default_view'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_debug'
],
"root"
)
self
.
assertEqual
(
result_dict
[
'_debug'
],
"root"
)
...
@@ -502,21 +503,21 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -502,21 +503,21 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'title'
],
"Custom Action No Dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'title'
],
"Custom Action No Dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'name'
],
"custom_action_no_dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'name'
],
"custom_action_no_dialog"
)
...
@@ -529,17 +530,17 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -529,17 +530,17 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'title'
],
"Create a Document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'title'
],
"Create a Document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'name'
],
"create_a_document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'name'
],
"create_a_document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'href'
],
'urn:jio:get:portal_types/%s'
%
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'href'
],
'urn:jio:get:portal_types/%s'
%
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'name'
],
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'name'
],
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'title'
].
encode
(
"UTF-8"
),
document
.
getTitle
())
self
.
assertEqual
(
unicode2str
(
result_dict
[
'title'
]
),
document
.
getTitle
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'title'
],
document
.
getTitle
().
decode
(
"UTF-8"
))
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'title'
],
str2unicode
(
document
.
getTitle
()
))
self
.
assertEqual
(
result_dict
[
'_debug'
],
"traverse"
)
self
.
assertEqual
(
result_dict
[
'_debug'
],
"traverse"
)
@
simulate
(
'Base_getRequestUrl'
,
'*args, **kwargs'
,
@
simulate
(
'Base_getRequestUrl'
,
'*args, **kwargs'
,
...
@@ -595,28 +596,28 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -595,28 +596,28 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog&extra_param_json=eyJmb3JtX2lkIjogIkZvb192aWV3In0="
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog&extra_param_json=eyJmb3JtX2lkIjogIkZvb192aWV3In0="
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'title'
],
"Custom Action No Dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'title'
],
"Custom Action No Dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'name'
],
"custom_action_no_dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'name'
],
"custom_action_no_dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_jio_jump'
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_jio_jump'
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=jump_query"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=jump_query"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_jio_jump'
][
'title'
],
"Queries"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_jio_jump'
][
'title'
],
"Queries"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_jio_jump'
][
'name'
],
"jump_query"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_jio_jump'
][
'name'
],
"jump_query"
)
...
@@ -629,17 +630,17 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -629,17 +630,17 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document&extra_param_json=eyJmb3JtX2lkIjogIkZvb192aWV3In0="
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document&extra_param_json=eyJmb3JtX2lkIjogIkZvb192aWV3In0="
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'title'
],
"Create a Document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'title'
],
"Create a Document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'name'
],
"create_a_document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'name'
],
"create_a_document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'href'
],
'urn:jio:get:portal_types/%s'
%
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'href'
],
'urn:jio:get:portal_types/%s'
%
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'name'
],
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'name'
],
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'title'
].
encode
(
"UTF-8"
),
document
.
getTitle
())
self
.
assertEqual
(
unicode2str
(
result_dict
[
'title'
]
),
document
.
getTitle
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'title'
],
document
.
getTitle
().
decode
(
"UTF-8"
))
self
.
assertEqual
(
result_dict
[
'_links'
][
'traversed_document'
][
'title'
],
str2unicode
(
document
.
getTitle
()
))
self
.
assertEqual
(
result_dict
[
'_debug'
],
"traverse"
)
self
.
assertEqual
(
result_dict
[
'_debug'
],
"traverse"
)
# Check embedded form rendering
# Check embedded form rendering
...
@@ -683,7 +684,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -683,7 +684,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'title'
],
document
.
getTitle
().
decode
(
"UTF-8"
))
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'title'
],
str2unicode
(
document
.
getTitle
()
))
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'self'
][
'href'
],
"%s/%s/Foo_view"
%
(
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'self'
][
'href'
],
"%s/%s/Foo_view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
...
@@ -895,11 +896,11 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -895,11 +896,11 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'title'
].
encode
(
"UTF-8"
),
document
.
getTitle
())
self
.
assertEqual
(
unicode2str
(
result_dict
[
'title'
]
),
document
.
getTitle
())
self
.
assertEqual
(
result_dict
[
'_debug'
],
"traverse"
)
self
.
assertEqual
(
result_dict
[
'_debug'
],
"traverse"
)
# Check embedded form rendering
# Check embedded form rendering
...
@@ -920,7 +921,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -920,7 +921,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'title'
],
document
.
getTitle
().
decode
(
"UTF-8"
))
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'title'
],
str2unicode
(
document
.
getTitle
()
))
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'self'
][
'href'
],
"%s/%s/Foo_view"
%
(
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'self'
][
'href'
],
"%s/%s/Foo_view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
...
@@ -968,28 +969,28 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -968,28 +969,28 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog&extra_param_json=eyJmb3JtX2lkIjogIkJhc2Vfdmlld01ldGFkYXRhIn0="
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog&extra_param_json=eyJmb3JtX2lkIjogIkJhc2Vfdmlld01ldGFkYXRhIn0="
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'title'
],
"Custom Action No Dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'title'
],
"Custom Action No Dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'name'
],
"custom_action_no_dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_workflow'
][
0
][
'name'
],
"custom_action_no_dialog"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_jio_jump'
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_jio_jump'
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=jump_query"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=jump_query"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_jio_jump'
][
'title'
],
"Queries"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_jio_jump'
][
'title'
],
"Queries"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_jio_jump'
][
'name'
],
"jump_query"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_jio_jump'
][
'name'
],
"jump_query"
)
...
@@ -1002,14 +1003,14 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -1002,14 +1003,14 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'href'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document&extra_param_json=eyJmb3JtX2lkIjogIkJhc2Vfdmlld01ldGFkYXRhIn0="
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document&extra_param_json=eyJmb3JtX2lkIjogIkJhc2Vfdmlld01ldGFkYXRhIn0="
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'title'
],
"Create a Document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'title'
],
"Create a Document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'name'
],
"create_a_document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'action_object_new_content_action'
][
'name'
],
"create_a_document"
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'href'
],
'urn:jio:get:portal_types/%s'
%
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'href'
],
'urn:jio:get:portal_types/%s'
%
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'name'
],
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'name'
],
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'title'
].
encode
(
"UTF-8"
),
document
.
getTitle
())
self
.
assertEqual
(
unicode2str
(
result_dict
[
'title'
]
),
document
.
getTitle
())
self
.
assertEqual
(
result_dict
[
'_debug'
],
"traverse"
)
self
.
assertEqual
(
result_dict
[
'_debug'
],
"traverse"
)
# Check embedded form rendering
# Check embedded form rendering
...
@@ -1030,7 +1031,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -1030,7 +1031,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'title'
],
document
.
getTitle
().
decode
(
"UTF-8"
))
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'title'
],
str2unicode
(
document
.
getTitle
()
))
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'self'
][
'href'
],
"%s/Base_viewMetadata"
%
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'_links'
][
'self'
][
'href'
],
"%s/Base_viewMetadata"
%
document
.
getRelativeUrl
())
document
.
getRelativeUrl
())
...
@@ -1198,7 +1199,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -1198,7 +1199,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
_links
']['
traversed_document
']['
href
'], '
urn
:
jio
:
get
:
%
s
' % document.getRelativeUrl())
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
_links
']['
traversed_document
']['
href
'], '
urn
:
jio
:
get
:
%
s
' % document.getRelativeUrl())
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
_links
']['
traversed_document
']['
name
'], document.getRelativeUrl())
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
_links
']['
traversed_document
']['
name
'], document.getRelativeUrl())
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
_links
']['
traversed_document
']['
title
'],
document.getTitle().decode("UTF-8"
))
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
_links
']['
traversed_document
']['
title
'],
str2unicode(document.getTitle()
))
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
_links
']['
form_definition
']['
href
'], '
urn
:
jio
:
get
:
portal_skins
/
erp5_core
/
Base_viewWorkflowHistory
')
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
_links
']['
form_definition
']['
href
'], '
urn
:
jio
:
get
:
portal_skins
/
erp5_core
/
Base_viewWorkflowHistory
')
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
_links
']['
form_definition
']['
name
'], '
Base_viewWorkflowHistory
')
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
_links
']['
form_definition
']['
name
'], '
Base_viewWorkflowHistory
')
...
@@ -1252,14 +1253,14 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -1252,14 +1253,14 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
# self.assertEqual(result_dict['
_links
']['
view
'][0]['
href
'],
# self.assertEqual(result_dict['
_links
']['
view
'][0]['
href
'],
# "%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=consistency" % (
# "%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=consistency" % (
# self.portal.absolute_url(),
# self.portal.absolute_url(),
#
urllib.
quote_plus("portal_skins/erp5_ui_test/Foo_view")))
# quote_plus("portal_skins/erp5_ui_test/Foo_view")))
# self.assertEqual(result_dict['
_links
']['
view
'][0]['
title
'], "Consistency")
# self.assertEqual(result_dict['
_links
']['
view
'][0]['
title
'], "Consistency")
# self.assertEqual(result_dict['
_links
']['
view
'][0]['
name
'], "consistency")
# self.assertEqual(result_dict['
_links
']['
view
'][0]['
name
'], "consistency")
# self.assertEqual(result_dict['
_links
']['
action_object_view
'][0]['
href
'],
# self.assertEqual(result_dict['
_links
']['
action_object_view
'][0]['
href
'],
# "%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=consistency" % (
# "%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=consistency" % (
# self.portal.absolute_url(),
# self.portal.absolute_url(),
#
urllib.
quote_plus("portal_skins/erp5_ui_test/Foo_view")))
# quote_plus("portal_skins/erp5_ui_test/Foo_view")))
# self.assertEqual(result_dict['
_links
']['
action_object_view
'][0]['
title
'], "Consistency")
# self.assertEqual(result_dict['
_links
']['
action_object_view
'][0]['
title
'], "Consistency")
# self.assertEqual(result_dict['
_links
']['
action_object_view
'][0]['
name
'], "consistency")
# self.assertEqual(result_dict['
_links
']['
action_object_view
'][0]['
name
'], "consistency")
...
@@ -1300,7 +1301,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -1300,7 +1301,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
)
)
result_dict = json.loads(result)
result_dict = json.loads(result)
self.assertEqual(
result_dict['
title
'].encode('
UTF
-
8
'
), document.getTitle())
self.assertEqual(
unicode2str(result_dict['
title
']
), document.getTitle())
self.assertEqual(
self.assertEqual(
result_dict['
_embedded
']['
_view
']['
_embedded
']['
form_definition
']['
pt
'],
result_dict['
_embedded
']['
_view
']['
_embedded
']['
form_definition
']['
pt
'],
'
form_view
'
'
form_view
'
...
@@ -2068,7 +2069,7 @@ return url
...
@@ -2068,7 +2069,7 @@ return url
# Test the URL value
# Test the URL value
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'title'
][
'url_value'
][
'command'
],
'raw'
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'title'
][
'url_value'
][
'command'
],
'raw'
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'title'
][
'url_value'
][
'options'
].
keys
(
),
[
u'url'
,
u'reset'
])
self
.
assertEqual
(
ensure_list
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'title'
][
'url_value'
][
'options'
].
keys
()
),
[
u'url'
,
u'reset'
])
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'title'
][
'url_value'
][
'options'
][
'url'
],
'https://officejs.com'
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'title'
][
'url_value'
][
'options'
][
'url'
],
'https://officejs.com'
)
# Test if the value of the column is with right key
# Test if the value of the column is with right key
...
@@ -2164,7 +2165,7 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
...
@@ -2164,7 +2165,7 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
self
.
assertEqual
(
2
,
len
(
result_dict
[
'_embedded'
][
'contents'
]))
self
.
assertEqual
(
2
,
len
(
result_dict
[
'_embedded'
][
'contents'
]))
# Test the listbox_uid parameter
# Test the listbox_uid parameter
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'listbox_uid:list'
][
'key'
],
'listbox_uid:list'
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'listbox_uid:list'
][
'key'
],
'listbox_uid:list'
)
self
.
assertEqual
(
document_list
[
0
].
getReference
(),
result_dict
[
'_embedded'
][
'contents'
][
0
][
'reference'
].
encode
(
'UTF-8'
))
self
.
assertEqual
(
document_list
[
0
].
getReference
(),
unicode2str
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'reference'
]
))
# There is a count method on the listbox
# There is a count method on the listbox
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'count'
],
0
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'count'
],
0
)
...
@@ -2179,10 +2180,10 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
...
@@ -2179,10 +2180,10 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
)
)
result_dict
=
json
.
loads
(
result
)
result_dict
=
json
.
loads
(
result
)
self
.
assertEqual
(
len
(
result_dict
[
'_embedded'
][
'contents'
]),
2
)
self
.
assertEqual
(
len
(
result_dict
[
'_embedded'
][
'contents'
]),
2
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'title'
].
encode
(
'utf-8'
),
document_list
[
0
].
getTitle
())
self
.
assertEqual
(
unicode2str
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'title'
]
),
document_list
[
0
].
getTitle
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'Foo_getLocalTitle'
],
None
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'Foo_getLocalTitle'
],
None
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'getTotalQuantity'
],
0
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
0
][
'getTotalQuantity'
],
0
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
1
][
'title'
].
encode
(
'utf-8'
),
document_list
[
1
].
getTitle
())
self
.
assertEqual
(
unicode2str
(
result_dict
[
'_embedded'
][
'contents'
][
1
][
'title'
]
),
document_list
[
1
].
getTitle
())
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
1
][
'Foo_getLocalTitle'
],
None
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
1
][
'Foo_getLocalTitle'
],
None
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
1
][
'getTotalQuantity'
],
0
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'contents'
][
1
][
'getTotalQuantity'
],
0
)
# No count if not in the listbox context currently
# No count if not in the listbox context currently
...
@@ -2621,21 +2622,21 @@ class TestERP5Document_getHateoas_mode_bulk(ERP5HALJSONStyleSkinsMixin):
...
@@ -2621,21 +2622,21 @@ class TestERP5Document_getHateoas_mode_bulk(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'view'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'view'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_object_view'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_object_view'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_object_view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_object_view'
][
0
][
'title'
],
"View"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_object_view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_object_view'
][
0
][
'name'
],
"view"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_workflow'
][
0
][
'href'
],
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_workflow'
][
0
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog&extra_param_json=eyJmb3JtX2lkIjogIkZvb192aWV3In0="
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=custom_action_no_dialog&extra_param_json=eyJmb3JtX2lkIjogIkZvb192aWV3In0="
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_workflow'
][
0
][
'title'
],
"Custom Action No Dialog"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_workflow'
][
0
][
'title'
],
"Custom Action No Dialog"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_workflow'
][
0
][
'name'
],
"custom_action_no_dialog"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_workflow'
][
0
][
'name'
],
"custom_action_no_dialog"
)
...
@@ -2648,14 +2649,14 @@ class TestERP5Document_getHateoas_mode_bulk(ERP5HALJSONStyleSkinsMixin):
...
@@ -2648,14 +2649,14 @@ class TestERP5Document_getHateoas_mode_bulk(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_object_new_content_action'
][
'href'
],
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_object_new_content_action'
][
'href'
],
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document&extra_param_json=eyJmb3JtX2lkIjogIkZvb192aWV3In0="
%
(
"%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=traverse&relative_url=%s&view=create_a_document&extra_param_json=eyJmb3JtX2lkIjogIkZvb192aWV3In0="
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
urllib
.
quote_plus
(
document
.
getRelativeUrl
())))
quote_plus
(
document
.
getRelativeUrl
())))
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_object_new_content_action'
][
'title'
],
"Create a Document"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_object_new_content_action'
][
'title'
],
"Create a Document"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_object_new_content_action'
][
'name'
],
"create_a_document"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'action_object_new_content_action'
][
'name'
],
"create_a_document"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'type'
][
'href'
],
'urn:jio:get:portal_types/%s'
%
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'type'
][
'href'
],
'urn:jio:get:portal_types/%s'
%
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'type'
][
'name'
],
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_links'
][
'type'
][
'name'
],
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'title'
].
encode
(
"UTF-8"
),
document
.
getTitle
())
self
.
assertEqual
(
unicode2str
(
result_dict
[
'result_list'
][
0
][
'title'
]
),
document
.
getTitle
())
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_debug'
],
"traverse"
)
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_debug'
],
"traverse"
)
# Check embedded form rendering
# Check embedded form rendering
...
@@ -2676,7 +2677,7 @@ class TestERP5Document_getHateoas_mode_bulk(ERP5HALJSONStyleSkinsMixin):
...
@@ -2676,7 +2677,7 @@ class TestERP5Document_getHateoas_mode_bulk(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'href'
],
'urn:jio:get:%s'
%
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'name'
],
document
.
getRelativeUrl
())
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'title'
],
document
.
getTitle
().
decode
(
"UTF-8"
))
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_embedded'
][
'_view'
][
'_links'
][
'traversed_document'
][
'title'
],
str2unicode
(
document
.
getTitle
()
))
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_embedded'
][
'_view'
][
'_links'
][
'self'
][
'href'
],
"%s/%s/Foo_view"
%
(
self
.
assertEqual
(
result_dict
[
'result_list'
][
0
][
'_embedded'
][
'_view'
][
'_links'
][
'self'
][
'href'
],
"%s/%s/Foo_view"
%
(
self
.
portal
.
absolute_url
(),
self
.
portal
.
absolute_url
(),
...
@@ -2738,8 +2739,10 @@ class TestERP5Document_getHateoas_mode_worklist(ERP5HALJSONStyleSkinsMixin):
...
@@ -2738,8 +2739,10 @@ class TestERP5Document_getHateoas_mode_worklist(ERP5HALJSONStyleSkinsMixin):
self
.
assertTrue
(
work_list
[
0
][
'count'
]
>
0
)
self
.
assertTrue
(
work_list
[
0
][
'count'
]
>
0
)
self
.
assertEqual
(
work_list
[
0
][
'name'
],
'Draft To Validate'
)
self
.
assertEqual
(
work_list
[
0
][
'name'
],
'Draft To Validate'
)
self
.
assertNotIn
(
'module'
,
work_list
[
0
])
self
.
assertNotIn
(
'module'
,
work_list
[
0
])
self
.
assertEqual
(
work_list
[
0
][
'href'
],
'urn:jio:allDocs?query=portal_type%3A%28%22Bar%22%20OR%20%22Foo%22%29%20AND%20simulation_state%3A%22draft%22'
)
self
.
assertIn
(
work_list
[
0
][
'href'
],
(
'urn:jio:allDocs?query=portal_type%3A%28%22Bar%22%20OR%20%22Foo%22%29%20AND%20simulation_state%3A%22draft%22'
,
'urn:jio:allDocs?query=simulation_state%3A%22draft%22%20AND%20portal_type%3A%28%22Bar%22%20OR%20%22Foo%22%29'
,
))
self
.
assertEqual
(
result_dict
[
'_debug'
],
"worklist"
)
self
.
assertEqual
(
result_dict
[
'_debug'
],
"worklist"
)
...
@@ -2847,7 +2850,7 @@ if translation_service is not None :\n\
...
@@ -2847,7 +2850,7 @@ if translation_service is not None :\n\
if not encoding:
\
n
\
if not encoding:
\
n
\
return translation_service.translate(catalog, msg, lang=lang, **kw)
\
n
\
return translation_service.translate(catalog, msg, lang=lang, **kw)
\
n
\
msg = translation_service.translate(catalog, msg, lang=lang, **kw)
\
n
\
msg = translation_service.translate(catalog, msg, lang=lang, **kw)
\
n
\
if same_type(msg, u''):
\
n
\
if s
tr==bytes and s
ame_type(msg, u''):
\
n
\
msg = msg.encode(encoding)
\
n
\
msg = msg.encode(encoding)
\
n
\
return msg
\
n
\
return msg
\
n
\
except AttributeError:
\
n
\
except AttributeError:
\
n
\
...
@@ -2911,7 +2914,7 @@ return msg"
...
@@ -2911,7 +2914,7 @@ return msg"
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'href'
],
'urn:jio:get:portal_types/%s'
%
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'href'
],
'urn:jio:get:portal_types/%s'
%
document
.
getPortalType
())
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'name'
],
'Foo_zhongwen'
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'type'
][
'name'
],
'Foo_zhongwen'
)
self
.
assertEqual
(
result_dict
[
'title'
].
encode
(
"UTF-8"
),
document
.
getTitle
())
self
.
assertEqual
(
unicode2str
(
result_dict
[
'title'
]
),
document
.
getTitle
())
self
.
assertEqual
(
result_dict
[
'_debug'
],
"root"
)
self
.
assertEqual
(
result_dict
[
'_debug'
],
"root"
)
@
simulate
(
'Base_getRequestUrl'
,
'*args, **kwargs'
,
@
simulate
(
'Base_getRequestUrl'
,
'*args, **kwargs'
,
...
@@ -2939,7 +2942,10 @@ return msg"
...
@@ -2939,7 +2942,10 @@ return msg"
self
.
assertEqual
(
work_list
[
0
][
'name'
],
'daiyanzhen'
)
self
.
assertEqual
(
work_list
[
0
][
'name'
],
'daiyanzhen'
)
self
.
assertEqual
(
work_list
[
0
][
'count'
],
1
)
self
.
assertEqual
(
work_list
[
0
][
'count'
],
1
)
self
.
assertNotIn
(
'module'
,
work_list
[
0
])
self
.
assertNotIn
(
'module'
,
work_list
[
0
])
self
.
assertEqual
(
work_list
[
0
][
'href'
],
'urn:jio:allDocs?query=portal_type%3A%28%22Bar%22%20OR%20%22Foo%22%29%20AND%20simulation_state%3A%22draft%22'
)
self
.
assertIn
(
work_list
[
0
][
'href'
],
(
'urn:jio:allDocs?query=portal_type%3A%28%22Bar%22%20OR%20%22Foo%22%29%20AND%20simulation_state%3A%22draft%22'
,
'urn:jio:allDocs?query=simulation_state%3A%22draft%22%20AND%20portal_type%3A%28%22Bar%22%20OR%20%22Foo%22%29'
,
))
self
.
assertEqual
(
result_dict
[
'_debug'
],
"worklist"
)
self
.
assertEqual
(
result_dict
[
'_debug'
],
"worklist"
)
...
@@ -3008,7 +3014,7 @@ return msg"
...
@@ -3008,7 +3014,7 @@ return msg"
result_dict
=
json
.
loads
(
result
)
result_dict
=
json
.
loads
(
result
)
# The document title includes 'ö' at the last in this test class, so calling decode("UTF-8")
# The document title includes 'ö' at the last in this test class, so calling decode("UTF-8")
self
.
assertEqual
(
result_dict
[
'_links'
][
'parent'
],
self
.
assertEqual
(
result_dict
[
'_links'
][
'parent'
],
{
"href"
:
"urn:jio:get:%s"
%
document
.
getRelativeUrl
(),
"name"
:
document
.
getTitle
().
decode
(
"UTF-8"
)})
{
"href"
:
"urn:jio:get:%s"
%
document
.
getRelativeUrl
(),
"name"
:
str2unicode
(
document
.
getTitle
()
)})
# make sure traversing the child document does not adding the parent title translation
# make sure traversing the child document does not adding the parent title translation
self
.
assertFalse
(
message_catalog
.
message_exists
(
document_title
))
self
.
assertFalse
(
message_catalog
.
message_exists
(
document_title
))
...
...
bt5/erp5_mobile/SkinTemplateItem/portal_skins/erp5_mobile_ui/ListBox_asHTML.zpt
View file @
0cfb1586
...
@@ -273,9 +273,9 @@
...
@@ -273,9 +273,9 @@
</span>
</span>
<span style="color: green;"> : </span>
<span style="color: green;"> : </span>
<tal:block tal:condition="show_search_line">
<tal:block tal:condition="show_search_line">
<span tal:condition="python: isinstance(original_value,
(float, int, long
))"
<span tal:condition="python: isinstance(original_value,
modules['six'].integer_types + (float,
))"
id="data_short" tal:content="python: original_value" />
id="data_short" tal:content="python: original_value" />
<span tal:condition="python: not isinstance(original_value,
(float, int, long
))"
<span tal:condition="python: not isinstance(original_value,
modules['six'].integer_types + (float,
))"
id="data_short" tal:content="data_short" />
id="data_short" tal:content="data_short" />
</tal:block>
</tal:block>
<tal:block tal:condition="not:show_search_line">
<tal:block tal:condition="not:show_search_line">
...
@@ -302,7 +302,7 @@
...
@@ -302,7 +302,7 @@
<tal:block tal:condition="python: original_value is not None">
<tal:block tal:condition="python: original_value is not None">
<span align="right"
<span align="right"
tal:define="original_value python: valueZ[0]; processed_value python: valueZ[1]"
tal:define="original_value python: valueZ[0]; processed_value python: valueZ[1]"
tal:attributes="align python: isinstance(original_value,
(float, int, long
)) and 'right' or 'left'"
tal:attributes="align python: isinstance(original_value,
modules['six'].integer_types + (float,
)) and 'right' or 'left'"
tal:content="structure processed_value" />
tal:content="structure processed_value" />
</tal:block>
</tal:block>
</div>
</div>
...
...
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/field_ods_macro.zpt
View file @
0cfb1586
...
@@ -100,7 +100,7 @@
...
@@ -100,7 +100,7 @@
-->
-->
<tal:block metal:define-macro="cell_value">
<tal:block metal:define-macro="cell_value">
<tal:block tal:define="is_list python:same_type(value, []) or same_type(value, ());
<tal:block tal:define="is_list python:same_type(value, []) or same_type(value, ());
is_float python: isinstance(value,
(int, long, float
));">
is_float python: isinstance(value,
modules['six'].integer_types + (float,
));">
<tal:block tal:condition="python: is_list">
<tal:block tal:condition="python: is_list">
...
@@ -116,7 +116,7 @@
...
@@ -116,7 +116,7 @@
</tal:block>
</tal:block>
<tal:block tal:condition="python: value is not None and not is_list">
<tal:block tal:condition="python: value is not None and not is_list">
<tal:block tal:condition="is_float">
<tal:block tal:condition="is_float">
<tal:block tal:condition="python: isinstance(value,
(int, long)
)">
<tal:block tal:condition="python: isinstance(value,
modules['six'].integer_types
)">
<table:table-cell tal:define="field python: editable_fields.get(column_id, None)"
<table:table-cell tal:define="field python: editable_fields.get(column_id, None)"
tal:attributes="office:value value;
tal:attributes="office:value value;
table:style-name string:${style_prefix}figure"
table:style-name string:${style_prefix}figure"
...
...
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_line_ods_macro.zpt
View file @
0cfb1586
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
<tal:block tal:condition="not:listboxline/isTitleLine">
<tal:block tal:condition="not:listboxline/isTitleLine">
<table:table-row tal:attributes="table:style-name python: listboxline.isStatLine() and 'listbox_stat_row' or 'listbox_data_row'">
<table:table-row tal:attributes="table:style-name python: listboxline.isStatLine() and 'listbox_stat_row' or 'listbox_data_row'">
<tal:block tal:condition="python: listboxline.isDataLine()">
<tal:block tal:condition="python: listboxline.isDataLine()">
<tal:block tal:repeat="empty_index python:
x
range(0, max_section_depth)">
<tal:block tal:repeat="empty_index python: range(0, max_section_depth)">
<table:table-cell table:style-name='report-column-title'
<table:table-cell table:style-name='report-column-title'
table:number-columns-spanned='1'
table:number-columns-spanned='1'
office:value-type='string'>
office:value-type='string'>
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
</tal:block>
</tal:block>
<tal:block tal:condition="python: listboxline.isStatLine() or listboxline.isSummaryLine()">
<tal:block tal:condition="python: listboxline.isStatLine() or listboxline.isSummaryLine()">
<tal:block tal:repeat="empty_index python:
x
range(0, listboxline.getSectionDepth())">
<tal:block tal:repeat="empty_index python: range(0, listboxline.getSectionDepth())">
<table:table-cell table:style-name='report-column-title'
<table:table-cell table:style-name='report-column-title'
table:number-columns-spanned='1'
table:number-columns-spanned='1'
office:value-type='string'>
office:value-type='string'>
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
office:value-type='string'>
office:value-type='string'>
<text:p tal:content="listboxline/getSectionName"/>
<text:p tal:content="listboxline/getSectionName"/>
</table:table-cell>
</table:table-cell>
<tal:block tal:repeat="empty_index python:
x
range(listboxline.getSectionDepth()+1, max_section_depth)">
<tal:block tal:repeat="empty_index python: range(listboxline.getSectionDepth()+1, max_section_depth)">
<table:table-cell table:style-name='report-column-title'
<table:table-cell table:style-name='report-column-title'
table:number-columns-spanned='1'
table:number-columns-spanned='1'
office:value-type='string'>
office:value-type='string'>
...
...
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.zpt
View file @
0cfb1586
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
<tal:block tal:condition="not:display_header">
<tal:block tal:condition="not:display_header">
<table:table-row table:style-name='listbox_header_row'>
<table:table-row table:style-name='listbox_header_row'>
<tal:block tal:repeat="empty_index python:
x
range(0, max_section_depth)">
<tal:block tal:repeat="empty_index python: range(0, max_section_depth)">
<table:table-cell table:style-name='report-column-title'
<table:table-cell table:style-name='report-column-title'
table:number-columns-spanned='1'
table:number-columns-spanned='1'
office:value-type='string'>
office:value-type='string'>
...
...
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/style_macros.zpt
View file @
0cfb1586
...
@@ -110,7 +110,7 @@
...
@@ -110,7 +110,7 @@
<style:style style:name="date_with_time" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="date_style">
<style:style style:name="date_with_time" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="date_style">
<style:table-cell-properties style:vertical-align='middle' style:repeat-content='false' style:text-align-source='fix' fo:border-right='0.002cm solid #000000' />
<style:table-cell-properties style:vertical-align='middle' style:repeat-content='false' style:text-align-source='fix' fo:border-right='0.002cm solid #000000' />
</style:style>
</style:style>
<tal:block tal:repeat="precision python:
x
range(0,here.Base_getODSMaximumSupportedPrecision())">
<tal:block tal:repeat="precision python: range(0,here.Base_getODSMaximumSupportedPrecision())">
<tal:block tal:define="figure_data_precision_style_name string:figure_data_precision_${precision}">
<tal:block tal:define="figure_data_precision_style_name string:figure_data_precision_${precision}">
<number:number-style style:name="figure_data_precision_X" tal:attributes="style:name figure_data_precision_style_name">
<number:number-style style:name="figure_data_precision_X" tal:attributes="style:name figure_data_precision_style_name">
<number:number number:decimal-places="X" number:min-integer-digits="1" number:grouping="true" tal:attributes="number:decimal-places precision"/>
<number:number number:decimal-places="X" number:min-integer-digits="1" number:grouping="true" tal:attributes="number:decimal-places precision"/>
...
...
bt5/erp5_odt_style/SkinTemplateItem/portal_skins/erp5_odt_style/listbox_odt_macro.zpt
View file @
0cfb1586
...
@@ -118,11 +118,11 @@
...
@@ -118,11 +118,11 @@
column_id python: column_item[0]">
column_id python: column_item[0]">
<tal:block tal:condition="python: column_property is not None">
<tal:block tal:condition="python: column_property is not None">
<table:table-cell table:style-name='listbox-table.A1' office:value-type='string'>
<table:table-cell table:style-name='listbox-table.A1' office:value-type='string'>
<tal:block tal:condition="python:
untranslatable_columns_dict.has_key(column_id)
">
<tal:block tal:condition="python:
column_id in untranslatable_columns_dict
">
<text:p text:style-name='listbox-header'
<text:p text:style-name='listbox-header'
tal:content="python: column_property"/>
tal:content="python: column_property"/>
</tal:block>
</tal:block>
<tal:block tal:condition="python:
not(untranslatable_columns_dict.has_key(column_id))
">
<tal:block tal:condition="python:
column_id not in untranslatable_columns_dict
">
<text:p text:style-name='listbox-header'
<text:p text:style-name='listbox-header'
tal:content="python: here.Base_translateString(column_property)"/>
tal:content="python: here.Base_translateString(column_property)"/>
</tal:block>
</tal:block>
...
...
bt5/erp5_officejs_ui_test/SkinTemplateItem/portal_skins/erp5_officejs_ui_test/Zuite_CommonTemplateForOnlyOffice.zpt
View file @
0cfb1586
...
@@ -139,34 +139,6 @@
...
@@ -139,34 +139,6 @@
<td>2000</td>
<td>2000</td>
<td></td>
<td></td>
</tr>
</tr>
<!-- Second loader while updating the page -->
<!--
<tr>
<td>waitForElementPresent</td>
<td>//h1[@class="ui-title"]//a[contains(@class, "ui-icon-spinner")]</td>
<td></td>
</tr>
<!-- Save Button is disabled -->
<!--
<tr>
<td>verifyElementPresent</td>
<td>//button[@data-i18n="Save"][contains(@class, "ui-disabled")]</td>
<td></td>
</tr>
<tr>
<td>waitForElementNotPresent</td>
<td>//h1[@class="ui-title"]//a[contains(@class, "ui-icon-spinner")]</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//button[@data-i18n="Save"][contains(@class, "ui-icon-check")]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><p></p></td>
</tr>
<-->
</tal:block>
</tal:block>
<tal:block metal:define-macro="click_to_align_center">
<tal:block metal:define-macro="click_to_align_center">
<tr>
<tr>
...
...
bt5/erp5_sql_browser/SkinTemplateItem/portal_skins/erp5_sql_browser/ZMySQLDAConnection_getQueryResultAsJSON.py
View file @
0cfb1586
...
@@ -3,6 +3,7 @@ import datetime
...
@@ -3,6 +3,7 @@ import datetime
import
time
import
time
import
json
import
json
from
DateTime
import
DateTime
from
DateTime
import
DateTime
import
six
response
=
container
.
REQUEST
.
RESPONSE
response
=
container
.
REQUEST
.
RESPONSE
start
=
time
.
time
()
start
=
time
.
time
()
...
@@ -32,7 +33,7 @@ for line in results.tuples():
...
@@ -32,7 +33,7 @@ for line in results.tuples():
v
=
v
.
isoformat
()
v
=
v
.
isoformat
()
elif
isinstance
(
v
,
Decimal
):
elif
isinstance
(
v
,
Decimal
):
v
=
float
(
v
)
v
=
float
(
v
)
elif
isinstance
(
v
,
(
long
,
int
,
float
))
and
not
isSafeInteger
(
v
):
elif
isinstance
(
v
,
six
.
integer_types
+
(
float
,
))
and
not
isSafeInteger
(
v
):
# if numbers are too large to be handled by javascript, we simply return them
# if numbers are too large to be handled by javascript, we simply return them
# as string, this will still not work for pivot table, but at least the spreadsheet
# as string, this will still not work for pivot table, but at least the spreadsheet
# will not display truncated values.
# will not display truncated values.
...
...
bt5/erp5_tiosafe_core/DocumentTemplateItem/portal_components/document.erp5.WebServiceRequest.py
View file @
0cfb1586
...
@@ -40,6 +40,10 @@ from lxml import etree
...
@@ -40,6 +40,10 @@ from lxml import etree
from
zLOG
import
LOG
,
ERROR
,
INFO
from
zLOG
import
LOG
,
ERROR
,
INFO
from
erp5.component.tool.WebServiceTool
import
ConnectionError
from
erp5.component.tool.WebServiceTool
import
ConnectionError
from
Products.ERP5Type.Cache
import
CachingMethod
from
Products.ERP5Type.Cache
import
CachingMethod
import
six
if
six
.
PY3
:
long
=
int
ID_SEPARATOR
=
"-"
ID_SEPARATOR
=
"-"
...
...
product/ERP5/bin/zopewsgi.py
View file @
0cfb1586
...
@@ -11,11 +11,7 @@ import socket
...
@@ -11,11 +11,7 @@ import socket
import
sys
import
sys
from
tempfile
import
TemporaryFile
from
tempfile
import
TemporaryFile
import
time
import
time
from
six.moves.urllib.parse
import
quote
from
six.moves.urllib.parse
import
quote
,
urlsplit
try
:
from
urllib
import
splitport
except
ImportError
:
# six.PY3
from
urllib.parse
import
splitport
from
waitress.server
import
create_server
from
waitress.server
import
create_server
import
ZConfig
import
ZConfig
...
@@ -268,8 +264,7 @@ def runwsgi():
...
@@ -268,8 +264,7 @@ def runwsgi():
new_limit
=
(
cur_limit
[
1
],
cur_limit
[
1
])
new_limit
=
(
cur_limit
[
1
],
cur_limit
[
1
])
resource
.
setrlimit
(
resource
.
RLIMIT_NOFILE
,
new_limit
)
resource
.
setrlimit
(
resource
.
RLIMIT_NOFILE
,
new_limit
)
ip
,
port
=
splitport
(
args
.
address
)
port
=
urlsplit
(
'//'
+
args
.
address
).
port
port
=
int
(
port
)
createServer
(
createServer
(
app_wrapper
(
app_wrapper
(
large_file_threshold
=
args
.
large_file_threshold
,
large_file_threshold
=
args
.
large_file_threshold
,
...
...
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_renderActionList.zpt
View file @
0cfb1586
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
cell_number python: len(module_category_list);
cell_number python: len(module_category_list);
row_number python: (cell_number/max_per_line+1)"
row_number python: (cell_number/max_per_line+1)"
class="access_tab_table">
class="access_tab_table">
<tr tal:repeat="row python:
x
range(row_number)">
<tr tal:repeat="row python: range(row_number)">
<tal:block tal:repeat="module_category python: module_category_list[(row*max_per_line):((row+1)*max_per_line)]">
<tal:block tal:repeat="module_category python: module_category_list[(row*max_per_line):((row+1)*max_per_line)]">
<td>
<td>
<div style="width:25%; min-width:150px; float:left;"
<div style="width:25%; min-width:150px; float:left;"
...
...
product/ERP5Form/www/ListBox_asHTML.zpt
View file @
0cfb1586
...
@@ -330,7 +330,7 @@
...
@@ -330,7 +330,7 @@
error python: value[2]"
error python: value[2]"
class="DataA" align="left"
class="DataA" align="left"
tal:attributes="class python: error and (css + 'Error') or css;
tal:attributes="class python: error and (css + 'Error') or css;
align python: isinstance(original_value,
(float, int, long
)) and 'right' or 'left'">
align python: isinstance(original_value,
modules['six'].integer_types + (float,
)) and 'right' or 'left'">
<input tal:condition="not: repeat/value/index"
<input tal:condition="not: repeat/value/index"
type="hidden" value="1" name="listbox_uid:list"
type="hidden" value="1" name="listbox_uid:list"
tal:attributes="value python: line.getUid() or '';
tal:attributes="value python: line.getUid() or '';
...
@@ -348,7 +348,7 @@
...
@@ -348,7 +348,7 @@
<tal:block tal:repeat="value here/getStatValueList">
<tal:block tal:repeat="value here/getStatValueList">
<td class="Data" align="left"
<td class="Data" align="left"
tal:define="original_value python: value[0]; processed_value python: value[1]"
tal:define="original_value python: value[0]; processed_value python: value[1]"
tal:attributes="align python: isinstance(original_value,
(float, int, long
)) and 'right' or 'left'"
tal:attributes="align python: isinstance(original_value,
modules['six'].integer_types + (float,
)) and 'right' or 'left'"
tal:content="structure processed_value" />
tal:content="structure processed_value" />
</tal:block>
</tal:block>
</tr>
</tr>
...
...
product/ERP5OOo/tests/utils.py
View file @
0cfb1586
...
@@ -38,7 +38,7 @@ import os
...
@@ -38,7 +38,7 @@ import os
import
sys
import
sys
import
tempfile
import
tempfile
import
zipfile
import
zipfile
import
popen2
import
subprocess
from
six.moves
import
urllib
from
six.moves
import
urllib
from
six.moves
import
cStringIO
as
StringIO
from
six.moves
import
cStringIO
as
StringIO
...
@@ -93,8 +93,12 @@ elif odfpy:
...
@@ -93,8 +93,12 @@ elif odfpy:
fd
,
file_name
=
tempfile
.
mkstemp
()
fd
,
file_name
=
tempfile
.
mkstemp
()
os
.
write
(
fd
,
odf_file_content
)
os
.
write
(
fd
,
odf_file_content
)
os
.
close
(
fd
)
os
.
close
(
fd
)
stdout
,
stdin
=
popen2
.
popen4
(
'odflint %s'
%
file_name
)
process
=
subprocess
.
Popen
(
stdin
.
close
()
[
'odflint'
,
file_name
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
)
stdout
,
_
=
process
.
communicate
()
error_list
=
''
error_list
=
''
for
line
in
stdout
:
for
line
in
stdout
:
if
line
.
startswith
(
'Error: '
):
if
line
.
startswith
(
'Error: '
):
...
...
product/ERP5Type/Utils.py
View file @
0cfb1586
...
@@ -567,6 +567,8 @@ def checkPythonSourceCode(source_code_str, portal_type=None):
...
@@ -567,6 +567,8 @@ def checkPythonSourceCode(source_code_str, portal_type=None):
if
str
is
bytes
:
if
str
is
bytes
:
bytes2str
=
str2bytes
=
lambda
s
:
s
bytes2str
=
str2bytes
=
lambda
s
:
s
def
str2unicode
(
s
):
return
s
.
decode
(
'utf-8'
)
def
unicode2str
(
s
):
def
unicode2str
(
s
):
return
s
.
encode
(
'utf-8'
)
return
s
.
encode
(
'utf-8'
)
else
:
else
:
...
@@ -574,6 +576,8 @@ else:
...
@@ -574,6 +576,8 @@ else:
return
s
.
decode
()
return
s
.
decode
()
def
str2bytes
(
s
):
def
str2bytes
(
s
):
return
s
.
encode
()
return
s
.
encode
()
def
str2unicode
(
s
):
return
s
def
unicode2str
(
s
):
def
unicode2str
(
s
):
return
s
return
s
...
...
product/ERP5Type/__init__.py
View file @
0cfb1586
...
@@ -189,7 +189,7 @@ ModuleSecurityInfo('Products.ERP5Type.Utils').declarePublic(
...
@@ -189,7 +189,7 @@ ModuleSecurityInfo('Products.ERP5Type.Utils').declarePublic(
'int2letter'
,
'getMessageIdWithContext'
,
'getTranslationStringWithContext'
,
'int2letter'
,
'getMessageIdWithContext'
,
'getTranslationStringWithContext'
,
'Email_parseAddressHeader'
,
'guessEncodingFromText'
,
'Email_parseAddressHeader'
,
'guessEncodingFromText'
,
'isValidTALESExpression'
,
'isValidTALESExpression'
,
'ensure_list'
,
'bytes2str'
,
'str2bytes'
,
'unicode2str'
,
'ensure_list'
,
'bytes2str'
,
'str2bytes'
,
'
str2unicode'
,
'
unicode2str'
,
)
)
allow_module
(
'Products.ERP5Type.Message'
)
allow_module
(
'Products.ERP5Type.Message'
)
...
...
product/ERP5Type/dynamic/portal_type_class.py
View file @
0cfb1586
...
@@ -61,8 +61,7 @@ ACQUIRE_LOCAL_ROLE_GETTER_DICT = {
...
@@ -61,8 +61,7 @@ ACQUIRE_LOCAL_ROLE_GETTER_DICT = {
for
acquire_local_role
in
(
False
,
True
)
for
acquire_local_role
in
(
False
,
True
)
}
}
if
six
.
PY3
:
StandardError
=
Exception
def
_importFilesystemClass
(
classpath
):
def
_importFilesystemClass
(
classpath
):
try
:
try
:
module_path
,
class_name
=
classpath
.
rsplit
(
'.'
,
1
)
module_path
,
class_name
=
classpath
.
rsplit
(
'.'
,
1
)
...
@@ -74,7 +73,7 @@ def _importFilesystemClass(classpath):
...
@@ -74,7 +73,7 @@ def _importFilesystemClass(classpath):
InitializeClass
(
klass
)
InitializeClass
(
klass
)
return
klass
return
klass
except
StandardError
:
except
Exception
as
e
:
raise
ImportError
(
'Could not import document class '
+
classpath
)
raise
ImportError
(
'Could not import document class '
+
classpath
)
def
_importComponentClass
(
component_package
,
name
):
def
_importComponentClass
(
component_package
,
name
):
...
...
product/ERP5Type/patches/DateTimePatch.py
View file @
0cfb1586
...
@@ -32,6 +32,7 @@ import math
...
@@ -32,6 +32,7 @@ import math
from
DateTime.DateTime
import
_calcSD
,
_calcDependentSecond
,
_calcYMDHMS
,
\
from
DateTime.DateTime
import
_calcSD
,
_calcDependentSecond
,
_calcYMDHMS
,
\
getDefaultDateFormat
,
_correctYear
,
_calcHMS
,
_calcDependentSecond2
,
DateTimeError
,
\
getDefaultDateFormat
,
_correctYear
,
_calcHMS
,
_calcDependentSecond2
,
DateTimeError
,
\
SyntaxError
,
DateError
,
TimeError
,
localtime
,
time
SyntaxError
,
DateError
,
TimeError
,
localtime
,
time
from
Products.ERP5Type
import
IS_ZOPE2
STATE_KEY
=
'str'
STATE_KEY
=
'str'
...
@@ -297,12 +298,13 @@ DateTimeKlass.SyntaxError = SyntaxError
...
@@ -297,12 +298,13 @@ DateTimeKlass.SyntaxError = SyntaxError
DateTimeKlass
.
DateError
=
DateError
DateTimeKlass
.
DateError
=
DateError
DateTimeKlass
.
TimeError
=
TimeError
DateTimeKlass
.
TimeError
=
TimeError
# BBB undo patch from DateTime 2.12 , which patches
if
IS_ZOPE2
:
# BBB Zope2
# copy_reg._reconstructor with a function that appears as
# BBB undo patch from DateTime 2.12 , which patches
# `DateTime.DateTime._dt_reconstructor` in pickles.
# copy_reg._reconstructor with a function that appears as
# See https://github.com/zopefoundation/DateTime/blob/2.12.8/src/DateTime/DateTime.py#L1863-L1874
# `DateTime.DateTime._dt_reconstructor` in pickles.
# This patch is no longer needed once we are using DateTime >= 3 so
# See https://github.com/zopefoundation/DateTime/blob/2.12.8/src/DateTime/DateTime.py#L1863-L1874
# it is not needed on python3 (copy_reg does not exist on python3)
# This patch is no longer needed once we are using DateTime >= 3 so
import
copy_reg
# it is not needed on python3 (copy_reg does not exist on python3)
copy_reg
.
_reconstructor
.
__module__
=
'copy_reg'
import
copy_reg
copy_reg
.
_reconstructor
.
__name__
=
'_reconstructor'
copy_reg
.
_reconstructor
.
__module__
=
'copy_reg'
copy_reg
.
_reconstructor
.
__name__
=
'_reconstructor'
product/ERP5Type/patches/Restricted.py
View file @
0cfb1586
...
@@ -80,6 +80,9 @@ add_builtins(Ellipsis=Ellipsis, NotImplemented=NotImplemented,
...
@@ -80,6 +80,9 @@ add_builtins(Ellipsis=Ellipsis, NotImplemented=NotImplemented,
dict
=
dict
,
list
=
list
)
dict
=
dict
,
list
=
list
)
if
"set"
not
in
safe_builtins
:
# BBB
if
"set"
not
in
safe_builtins
:
# BBB
add_builtins
(
set
=
set
,
frozenset
=
frozenset
,
slice
=
slice
)
add_builtins
(
set
=
set
,
frozenset
=
frozenset
,
slice
=
slice
)
if
"bytes"
not
in
safe_builtins
:
# BBB Zope2
assert
six
.
PY2
add_builtins
(
bytes
=
str
)
add_builtins
(
bin
=
bin
,
classmethod
=
classmethod
,
format
=
format
,
object
=
object
,
add_builtins
(
bin
=
bin
,
classmethod
=
classmethod
,
format
=
format
,
object
=
object
,
property
=
property
,
staticmethod
=
staticmethod
,
property
=
property
,
staticmethod
=
staticmethod
,
...
...
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
0cfb1586
...
@@ -1356,7 +1356,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
...
@@ -1356,7 +1356,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
try
:
try
:
portal_activities
=
self
.
portal
.
portal_activities
portal_activities
=
self
.
portal
.
portal_activities
message_list
=
portal_activities
.
getMessageList
()
message_list
=
portal_activities
.
getMessageList
()
except
StandardError
:
# AttributeError, TransactionFailedError ...
except
Exception
:
# AttributeError, TransactionFailedError ...
pass
pass
else
:
else
:
for
m
in
message_list
:
for
m
in
message_list
:
...
...
product/Formulator/Widget.py
View file @
0cfb1586
...
@@ -4,9 +4,8 @@ from six import unichr
...
@@ -4,9 +4,8 @@ from six import unichr
from
six.moves
import
xrange
from
six.moves
import
xrange
import
string
import
string
from
.DummyField
import
fields
from
.DummyField
import
fields
from
DocumentTemplate.
DT_Util
import
html_quote
from
DocumentTemplate.
html_quote
import
html_quote
from
DateTime
import
DateTime
,
Timezones
from
DateTime
import
DateTime
,
Timezones
from
Products.PythonScripts.standard
import
html_quote
import
types
import
types
from
DocumentTemplate.ustr
import
ustr
from
DocumentTemplate.ustr
import
ustr
from
six.moves.urllib.parse
import
urljoin
from
six.moves.urllib.parse
import
urljoin
...
...
product/Formulator/tests/testForm.py
View file @
0cfb1586
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
unittest
,
re
import
unittest
,
re
from
lxml
import
etree
from
DateTime
import
DateTime
from
DateTime
import
DateTime
import
Zope2
import
Zope2
...
@@ -122,9 +123,12 @@ class FormTestCase(unittest.TestCase):
...
@@ -122,9 +123,12 @@ class FormTestCase(unittest.TestCase):
.
manage_addField
(
'date_time'
,
'Test Field'
,
'DateTimeField'
)
.
manage_addField
(
'date_time'
,
'Test Field'
,
'DateTimeField'
)
field
=
self
.
form
.
date_time
field
=
self
.
form
.
date_time
field
.
_edit
({
'timezone_style'
:
0
})
field
.
_edit
({
'timezone_style'
:
0
})
self
.
assertNotIn
(
'<select size="1" name="subfield_field_date_time_timezone" >'
,
field
.
render
())
parser
=
etree
.
HTMLParser
()
e
=
etree
.
fromstring
(
field
.
render
(),
parser
=
parser
)
self
.
assertFalse
(
e
.
xpath
(
'//select[@size="1"][@name="subfield_field_date_time_timezone"]'
))
field
.
_edit
({
'timezone_style'
:
1
})
field
.
_edit
({
'timezone_style'
:
1
})
self
.
assertIn
(
'<select size="1" name="subfield_field_date_time_timezone" >'
,
field
.
render
())
e
=
etree
.
fromstring
(
field
.
render
(),
parser
=
parser
)
self
.
assertTrue
(
e
.
xpath
(
'//select[@size="1"][@name="subfield_field_date_time_timezone"]'
))
def
test_datetime_css_class_rendering
(
self
):
def
test_datetime_css_class_rendering
(
self
):
...
@@ -181,13 +185,18 @@ class FormTestCase(unittest.TestCase):
...
@@ -181,13 +185,18 @@ class FormTestCase(unittest.TestCase):
.
manage_addField
(
'date_time'
,
'Test Field'
,
'DateTimeField'
)
.
manage_addField
(
'date_time'
,
'Test Field'
,
'DateTimeField'
)
field
=
self
.
form
.
date_time
field
=
self
.
form
.
date_time
field
.
_edit
({
'input_style'
:
'number'
})
field
.
_edit
({
'input_style'
:
'number'
})
self
.
assertIn
(
'<input name="subfield_field_date_time_year" value="" maxlength="4" type="number" size="4" min="0" max="9999" />'
,
field
.
render
())
parser
=
etree
.
HTMLParser
()
e
=
etree
.
fromstring
(
field
.
render
(),
parser
=
parser
)
self
.
assertTrue
(
e
.
xpath
(
'//input[@name="subfield_field_date_time_year"][@value=""][@maxlength="4"][@type="number"][@size="4"][@min="0"][@max="9999"]'
))
field
.
_edit
({
'start_datetime'
:
DateTime
(
'1900/01/01'
),
'end_datetime'
:
None
})
field
.
_edit
({
'start_datetime'
:
DateTime
(
'1900/01/01'
),
'end_datetime'
:
None
})
self
.
assertIn
(
'<input name="subfield_field_date_time_year" value="" maxlength="4" type="number" size="4" min="1900" max="9999" />'
,
field
.
render
())
e
=
etree
.
fromstring
(
field
.
render
(),
parser
=
parser
)
self
.
assertTrue
(
e
.
xpath
(
'//input[@name="subfield_field_date_time_year"][@value=""][@maxlength="4"][@type="number"][@size="4"][@min="1900"][@max="9999"]'
))
field
.
_edit
({
'start_datetime'
:
None
,
'end_datetime'
:
DateTime
(
'2099/12/31'
)})
field
.
_edit
({
'start_datetime'
:
None
,
'end_datetime'
:
DateTime
(
'2099/12/31'
)})
self
.
assertIn
(
'<input name="subfield_field_date_time_year" value="" maxlength="4" type="number" size="4" min="0" max="2099" />'
,
field
.
render
())
e
=
etree
.
fromstring
(
field
.
render
(),
parser
=
parser
)
self
.
assertTrue
(
e
.
xpath
(
'//input[@name="subfield_field_date_time_year"][@value=""][@maxlength="4"][@type="number"][@size="4"][@min="0"][@max="2099"]'
))
field
.
_edit
({
'start_datetime'
:
DateTime
(
'1900/01/01'
),
'end_datetime'
:
DateTime
(
'2099/12/31'
)})
field
.
_edit
({
'start_datetime'
:
DateTime
(
'1900/01/01'
),
'end_datetime'
:
DateTime
(
'2099/12/31'
)})
self
.
assertIn
(
'<input name="subfield_field_date_time_year" value="" maxlength="4" type="number" size="4" min="1900" max="2099" />'
,
field
.
render
())
e
=
etree
.
fromstring
(
field
.
render
(),
parser
=
parser
)
self
.
assertTrue
(
e
.
xpath
(
'//input[@name="subfield_field_date_time_year"][@value=""][@maxlength="4"][@type="number"][@size="4"][@min="1900"][@max="2099"]'
))
def
test_suite
():
def
test_suite
():
...
...
product/Localizer/utils.py
View file @
0cfb1586
...
@@ -26,7 +26,8 @@ from App.Common import package_home
...
@@ -26,7 +26,8 @@ from App.Common import package_home
ph
=
package_home
(
globals
())
ph
=
package_home
(
globals
())
# Initializes a list with the charsets
# Initializes a list with the charsets
charsets
=
[
x
.
strip
()
for
x
in
open
(
ph
+
'/charsets.txt'
).
readlines
()
]
with
open
(
ph
+
'/charsets.txt'
)
as
f
:
charsets
=
[
x
.
strip
()
for
x
in
f
.
readlines
()
]
...
...
product/PortalTransforms/transforms/python.py
View file @
0cfb1586
...
@@ -20,7 +20,7 @@ from six.moves import cStringIO as StringIO
...
@@ -20,7 +20,7 @@ from six.moves import cStringIO as StringIO
from
Products.PortalTransforms.interfaces
import
ITransform
from
Products.PortalTransforms.interfaces
import
ITransform
from
zope.interface
import
implementer
from
zope.interface
import
implementer
from
DocumentTemplate.
DT_Util
import
html_quote
from
DocumentTemplate.
html_quote
import
html_quote
## Python Source Parser #####################################################
## Python Source Parser #####################################################
...
...
product/PortalTransforms/transforms/text_pre_to_html.py
View file @
0cfb1586
from
Products.PortalTransforms.interfaces
import
ITransform
from
Products.PortalTransforms.interfaces
import
ITransform
from
zope.interface
import
implementer
from
zope.interface
import
implementer
from
DocumentTemplate.
DT_Util
import
html_quote
from
DocumentTemplate.
html_quote
import
html_quote
__revision__
=
'$Id: text_pre_to_html.py 3658 2005-02-23 16:29:54Z tiran $'
__revision__
=
'$Id: text_pre_to_html.py 3658 2005-02-23 16:29:54Z tiran $'
...
...
product/PortalTransforms/transforms/text_to_html.py
View file @
0cfb1586
from
Products.PortalTransforms.interfaces
import
ITransform
from
Products.PortalTransforms.interfaces
import
ITransform
from
zope.interface
import
implementer
from
zope.interface
import
implementer
from
DocumentTemplate.
DT_Util
import
html_quote
from
DocumentTemplate.
html_quote
import
html_quote
__revision__
=
'$Id: text_to_html.py 4787 2005-08-19 21:43:41Z dreamcatcher $'
__revision__
=
'$Id: text_to_html.py 4787 2005-08-19 21:43:41Z dreamcatcher $'
...
...
product/ZSQLCatalog/ZSQLCatalog.py
View file @
0cfb1586
...
@@ -25,8 +25,11 @@ from OFS.Folder import Folder
...
@@ -25,8 +25,11 @@ from OFS.Folder import Folder
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
Acquisition
import
Implicit
,
aq_base
from
Acquisition
import
Implicit
,
aq_base
from
Persistence
import
Persistent
from
Persistence
import
Persistent
from
DocumentTemplate.DT_Util
import
InstanceDict
,
TemplateDict
from
DocumentTemplate.DT_Util
import
Eval
,
TemplateDict
from
DocumentTemplate.DT_Util
import
Eval
try
:
from
DocumentTemplate._DocumentTemplate
import
InstanceDict
except
ImportError
:
# BBB
from
DocumentTemplate.DT_Util
import
InstanceDict
from
AccessControl.Permission
import
pname
from
AccessControl.Permission
import
pname
from
AccessControl.Permissions
import
import_export_objects
,
\
from
AccessControl.Permissions
import
import_export_objects
,
\
manage_zcatalog_entries
manage_zcatalog_entries
...
...
product/Zelenium/zuite.py
View file @
0cfb1586
...
@@ -69,7 +69,9 @@ def _makeFile(filename, prefix=None, id=None):
...
@@ -69,7 +69,9 @@ def _makeFile(filename, prefix=None, id=None):
if
id
is
None
:
if
id
is
None
:
id
=
os
.
path
.
split
(
path
)[
1
]
id
=
os
.
path
.
split
(
path
)[
1
]
return
File
(
id
=
id
,
title
=
''
,
file
=
open
(
path
).
read
()
)
with
open
(
path
,
'rb'
)
as
f
:
data
=
f
.
read
()
return
File
(
id
=
id
,
title
=
''
,
file
=
data
)
def
registerFiles
(
directory
,
prefix
):
def
registerFiles
(
directory
,
prefix
):
...
...
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