Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
137
Merge Requests
137
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
4a551dca
Commit
4a551dca
authored
Jul 26, 2024
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: unicode() => six.text_type().
parent
bf486a45
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
129 additions
and
93 deletions
+129
-93
bt5/cloudooo_web/SkinTemplateItem/portal_skins/cloudooo_erp5_ingestion/Document_getPropertyDictFromContent.py
...ooo_erp5_ingestion/Document_getPropertyDictFromContent.py
+3
-1
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getAgedBalanceReportSectionList.py
...ntingTransactionModule_getAgedBalanceReportSectionList.py
+8
-4
bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_aggregateFrenchAccountingTransactionFile.py
...sactionModule_aggregateFrenchAccountingTransactionFile.py
+5
-1
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getSummaryAsHTML.py
...plateItem/portal_skins/erp5_base/Base_getSummaryAsHTML.py
+2
-1
bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/Budget_getBudgetConsumptionReportData.py
...kins/erp5_budget/Budget_getBudgetConsumptionReportData.py
+6
-5
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
...mplateItem/portal_components/test.erp5.testERP5Catalog.py
+1
-1
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsBook.py
...ortal_skins/erp5_corporate_identity/WebPage_viewAsBook.py
+2
-2
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsContract.py
...l_skins/erp5_corporate_identity/WebPage_viewAsContract.py
+2
-1
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsLeaflet.py
...al_skins/erp5_corporate_identity/WebPage_viewAsLeaflet.py
+6
-4
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsRelease.py
...al_skins/erp5_corporate_identity/WebPage_viewAsRelease.py
+6
-4
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getHeadOfTextContent.py
...eItem/portal_skins/erp5_crm/Event_getHeadOfTextContent.py
+2
-1
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.SubversionClient.py
...ateItem/portal_components/module.erp5.SubversionClient.py
+4
-3
bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion/Document_getPropertyDictFromContent.py
...ins/erp5_ingestion/Document_getPropertyDictFromContent.py
+3
-2
bt5/erp5_interface_post/SkinTemplateItem/portal_skins/erp5_interface_post/Event_createPostMessage.py
...rtal_skins/erp5_interface_post/Event_createPostMessage.py
+4
-0
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/ERP5Site_getTicketWorkflowStateInfoDict.py
...upport_request/ERP5Site_getTicketWorkflowStateInfoDict.py
+3
-2
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/ERP5Site_getTicketWorkflowWorklistInfoDict.py
...ort_request/ERP5Site_getTicketWorkflowWorklistInfoDict.py
+2
-2
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/SupportRequestModule_getWorklistAsJson.py
...support_request/SupportRequestModule_getWorklistAsJson.py
+2
-1
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getODTDataDict.py
..._skins/erp5_payroll/PaySheetTransaction_getODTDataDict.py
+1
-1
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/PaySheetTransaction_getOtherInformationsDataDict.py
...0n_fr/PaySheetTransaction_getOtherInformationsDataDict.py
+1
-1
bt5/erp5_syncml/DocumentTemplateItem/portal_components/document.erp5.SyncMLSubscription.py
...tem/portal_components/document.erp5.SyncMLSubscription.py
+1
-1
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.CrawlableMixin.py
...mplateItem/portal_components/mixin.erp5.CrawlableMixin.py
+4
-4
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.DownloadableMixin.py
...ateItem/portal_components/mixin.erp5.DownloadableMixin.py
+1
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.py
...l_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.py
+2
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.py
...mplateItem/portal_skins/erp5_core/Base_translateString.py
+3
-1
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_getPythonSourceCodeMessageList.py
...5_core/BusinessTemplate_getPythonSourceCodeMessageList.py
+2
-2
product/ERP5Catalog/CatalogTool.py
product/ERP5Catalog/CatalogTool.py
+1
-1
product/ERP5Form/ListBox.py
product/ERP5Form/ListBox.py
+15
-12
product/ERP5Form/PDFTemplate.py
product/ERP5Form/PDFTemplate.py
+7
-8
product/ERP5Form/Selection.py
product/ERP5Form/Selection.py
+6
-6
product/ERP5OOo/tests/testIngestion.py
product/ERP5OOo/tests/testIngestion.py
+8
-4
product/ERP5Type/Accessor/TypeDefinition.py
product/ERP5Type/Accessor/TypeDefinition.py
+1
-1
product/ERP5Type/Message.py
product/ERP5Type/Message.py
+12
-10
product/Formulator/Widget.py
product/Formulator/Widget.py
+1
-1
product/MailTemplates/BaseMailTemplate.py
product/MailTemplates/BaseMailTemplate.py
+1
-1
product/PortalTransforms/transforms/safe_html.py
product/PortalTransforms/transforms/safe_html.py
+1
-1
No files found.
bt5/cloudooo_web/SkinTemplateItem/portal_skins/cloudooo_erp5_ingestion/Document_getPropertyDictFromContent.py
View file @
4a551dca
...
@@ -8,6 +8,7 @@ to use re) that would analyze text content of the doc
...
@@ -8,6 +8,7 @@ to use re) that would analyze text content of the doc
and return a dictionary of properties.
and return a dictionary of properties.
"""
"""
#Proxify to allow discover of metadata when publishing document
#Proxify to allow discover of metadata when publishing document
import
six
information
=
context
.
getContentInformation
()
information
=
context
.
getContentInformation
()
...
@@ -16,7 +17,8 @@ property_id_list = context.propertyIds()
...
@@ -16,7 +17,8 @@ property_id_list = context.propertyIds()
for
k
,
v
in
information
.
items
():
for
k
,
v
in
information
.
items
():
key
=
k
.
lower
()
key
=
k
.
lower
()
if
v
:
if
v
:
if
isinstance
(
v
,
unicode
):
v
=
v
.
encode
(
'utf-8'
)
if
six
.
PY2
and
isinstance
(
v
,
six
.
text_type
):
v
=
v
.
encode
(
'utf-8'
)
if
key
in
property_id_list
:
if
key
in
property_id_list
:
if
key
==
'reference'
:
if
key
==
'reference'
:
pass
# XXX - We can not trust reference on getContentInformation
pass
# XXX - We can not trust reference on getContentInformation
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getAgedBalanceReportSectionList.py
View file @
4a551dca
import
six
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Form.Report
import
ReportSection
from
Products.ERP5Form.Report
import
ReportSection
def
translate
(
*
args
,
**
kw
):
return
six
.
text_type
(
translateString
(
*
args
,
**
kw
))
request
=
container
.
REQUEST
request
=
container
.
REQUEST
section_category
=
request
[
'section_category'
]
section_category
=
request
[
'section_category'
]
section_category_strict
=
request
[
'section_category_strict'
]
section_category_strict
=
request
[
'section_category_strict'
]
...
@@ -30,16 +34,16 @@ previous_period = 0
...
@@ -30,16 +34,16 @@ previous_period = 0
for
idx
,
period
in
enumerate
(
period_list
):
for
idx
,
period
in
enumerate
(
period_list
):
if
idx
!=
0
:
if
idx
!=
0
:
previous_period
=
period_list
[
idx
-
1
]
previous_period
=
period_list
[
idx
-
1
]
selection_columns
.
append
((
'period_%s'
%
idx
,
unicode
(
translateString
(
selection_columns
.
append
((
'period_%s'
%
idx
,
translate
(
'Period ${period_number} (from ${from} to ${to} days)'
,
'Period ${period_number} (from ${from} to ${to} days)'
,
mapping
=
{
'period_number'
:
1
+
idx
,
mapping
=
{
'period_number'
:
1
+
idx
,
'from'
:
previous_period
,
'from'
:
previous_period
,
'to'
:
period
}
)))
)
'to'
:
period
}
)))
editable_columns
.
append
((
'period_%s'
%
idx
,
''
))
editable_columns
.
append
((
'period_%s'
%
idx
,
''
))
selection_columns
.
append
((
'period_%s'
%
(
idx
+
1
),
selection_columns
.
append
((
'period_%s'
%
(
idx
+
1
),
unicode
(
translateString
(
'Older (more than ${day_count} days)'
,
translate
(
'Older (more than ${day_count} days)'
,
mapping
=
{
'day_count'
:
period_list
[
-
1
]})))
)
mapping
=
{
'day_count'
:
period_list
[
-
1
]})))
editable_columns
.
append
((
'period_%s'
%
(
idx
+
1
),
''
))
editable_columns
.
append
((
'period_%s'
%
(
idx
+
1
),
''
))
selection_params
=
dict
(
section_category
=
section_category
,
selection_params
=
dict
(
section_category
=
section_category
,
...
...
bt5/erp5_accounting_l10n_fr/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr/AccountingTransactionModule_aggregateFrenchAccountingTransactionFile.py
View file @
4a551dca
# coding: utf-8
# coding: utf-8
import
unicodedata
import
unicodedata
import
six
from
io
import
BytesIO
from
io
import
BytesIO
import
zipfile
import
zipfile
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
...
@@ -42,9 +43,12 @@ attachment_list = (
...
@@ -42,9 +43,12 @@ attachment_list = (
'content'
:
zipbuffer
.
getvalue
(),
'content'
:
zipbuffer
.
getvalue
(),
'name'
:
zipfilename
,
},
)
'name'
:
zipfilename
,
},
)
subject
=
six
.
text_type
(
translateString
(
'French Accounting Transaction File'
))
portal
.
ERP5Site_notifyReportComplete
(
portal
.
ERP5Site_notifyReportComplete
(
user_name
=
user_name
,
user_name
=
user_name
,
subject
=
unicode
(
translateString
(
'French Accounting Transaction File'
))
,
subject
=
subject
,
message
=
''
,
message
=
''
,
attachment_list
=
attachment_list
)
attachment_list
=
attachment_list
)
...
...
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base_getSummaryAsHTML.py
View file @
4a551dca
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
Generate a HTML Summary of an object.
Generate a HTML Summary of an object.
Use "No ZODB" approach if possible.
Use "No ZODB" approach if possible.
"""
"""
import
six
request
=
context
.
REQUEST
request
=
context
.
REQUEST
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
is_temp_object
=
context
.
isTempObject
()
is_temp_object
=
context
.
isTempObject
()
...
@@ -40,7 +41,7 @@ else:
...
@@ -40,7 +41,7 @@ else:
modification_date
=
context
.
modification_date
modification_date
=
context
.
modification_date
document_web_section_list
=
web_site
.
getWebSectionValueList
(
context
)
document_web_section_list
=
web_site
.
getWebSectionValueList
(
context
)
inline_popup
=
context
.
Document_getPopupInfo
(
web_site
,
document_web_section_list
)
inline_popup
=
context
.
Document_getPopupInfo
(
web_site
,
document_web_section_list
)
if
isinstance
(
inline_popup
,
unicod
e
):
if
six
.
PY2
and
isinstance
(
inline_popup
,
six
.
text_typ
e
):
inline_popup
=
inline_popup
.
encode
(
'utf-8'
)
inline_popup
=
inline_popup
.
encode
(
'utf-8'
)
found
=
context
.
Base_showFoundText
()
found
=
context
.
Base_showFoundText
()
portal_type
=
context
.
getTranslatedPortalType
()
portal_type
=
context
.
getTranslatedPortalType
()
...
...
bt5/erp5_budget/SkinTemplateItem/portal_skins/erp5_budget/Budget_getBudgetConsumptionReportData.py
View file @
4a551dca
import
six
from
pprint
import
pformat
from
pprint
import
pformat
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
request
=
portal
.
REQUEST
request
=
portal
.
REQUEST
...
@@ -89,7 +90,7 @@ for budget in budget_list:
...
@@ -89,7 +90,7 @@ for budget in budget_list:
conversion_ratio
=
1
conversion_ratio
=
1
line_list
.
append
(
dict
(
is_budget
=
True
,
line_list
.
append
(
dict
(
is_budget
=
True
,
title
=
budget
.
getTitle
().
decode
(
'utf8'
),
title
=
six
.
text_type
(
budget
.
getTitle
()
),
target_currency_title
=
target_currency_title
,
target_currency_title
=
target_currency_title
,
conversion_ratio
=
conversion_ratio
,
conversion_ratio
=
conversion_ratio
,
resource_title
=
budget
.
getResource
()
and
resource_title
=
budget
.
getResource
()
and
...
@@ -149,9 +150,9 @@ for budget in budget_list:
...
@@ -149,9 +150,9 @@ for budget in budget_list:
# we use BudgetLine_asCellRange to get cell names, and have a default value
# we use BudgetLine_asCellRange to get cell names, and have a default value
# for "virtual level 2"
# for "virtual level 2"
title
=
budget_line
.
getTitle
().
decode
(
'utf8'
)
title
=
six
.
text_type
(
budget_line
.
getTitle
()
)
cell_name_dict
=
{
budget_line
.
getResource
(
base
=
1
):
cell_name_dict
=
{
budget_line
.
getResource
(
base
=
1
):
budget_line
.
getTitle
().
decode
(
'utf8'
)}
six
.
text_type
(
budget_line
.
getTitle
()
)}
cell_style_dict
=
{
budget_line
.
getResource
(
base
=
1
):
'Level2'
}
cell_style_dict
=
{
budget_line
.
getResource
(
base
=
1
):
'Level2'
}
cell_depth_dict
=
{
budget_line
.
getResource
(
base
=
1
):
0
}
cell_depth_dict
=
{
budget_line
.
getResource
(
base
=
1
):
0
}
...
@@ -168,7 +169,7 @@ for budget in budget_list:
...
@@ -168,7 +169,7 @@ for budget in budget_list:
for
cell_range_list
in
budget_line_as_cell_range_matrixbox
:
for
cell_range_list
in
budget_line_as_cell_range_matrixbox
:
for
category
,
title
in
cell_range_list
:
for
category
,
title
in
cell_range_list
:
cell_name_dict
[
category
]
=
title
.
decode
(
'utf8'
).
replace
(
u'
\
xA0
'
,
''
)
cell_name_dict
[
category
]
=
six
.
text_type
(
title
).
replace
(
u'
\
xA0
'
,
''
)
if
category
in
level_2_variation_category_list
:
if
category
in
level_2_variation_category_list
:
depth
=
-
min_depth
+
(
title
.
count
(
'
\
xA0
'
)
/
4
)
or
title
.
count
(
'/'
)
depth
=
-
min_depth
+
(
title
.
count
(
'
\
xA0
'
)
/
4
)
or
title
.
count
(
'/'
)
cell_depth_dict
[
category
]
=
depth
cell_depth_dict
[
category
]
=
depth
...
@@ -323,7 +324,7 @@ for budget in budget_list:
...
@@ -323,7 +324,7 @@ for budget in budget_list:
if
total_level_1_current_budget
:
if
total_level_1_current_budget
:
consumed_ratio
=
total_level_1_consumed_budget
/
total_level_1_current_budget
consumed_ratio
=
total_level_1_consumed_budget
/
total_level_1_current_budget
line_list
.
append
(
dict
(
is_level_1
=
True
,
line_list
.
append
(
dict
(
is_level_1
=
True
,
title
=
budget_line
.
getTitle
().
decode
(
'utf8'
),
title
=
six
.
text_type
(
budget_line
.
getTitle
()
),
initial_budget
=
total_level_1_initial_budget
,
initial_budget
=
total_level_1_initial_budget
,
current_budget
=
total_level_1_current_budget
,
current_budget
=
total_level_1_current_budget
,
engaged_budget
=
total_level_1_engaged_budget
,
engaged_budget
=
total_level_1_engaged_budget
,
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
View file @
4a551dca
...
@@ -644,7 +644,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
...
@@ -644,7 +644,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
self
.
assertEqual
([
'5'
],
folder_object_list
)
self
.
assertEqual
([
'5'
],
folder_object_list
)
if
six
.
PY2
:
if
six
.
PY2
:
folder_object_list
=
[
x
.
getObject
().
getId
()
for
x
in
folder_object_list
=
[
x
.
getObject
().
getId
()
for
x
in
person_module
.
searchFolder
(
title
=
unicod
e
(
title
,
'utf-8'
))]
person_module
.
searchFolder
(
title
=
six
.
text_typ
e
(
title
,
'utf-8'
))]
self
.
assertEqual
([
'5'
],
folder_object_list
)
self
.
assertEqual
([
'5'
],
folder_object_list
)
def
test_Collation
(
self
):
def
test_Collation
(
self
):
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsBook.py
View file @
4a551dca
...
@@ -33,6 +33,7 @@ MAIN FILE: generate book in different output formats
...
@@ -33,6 +33,7 @@ MAIN FILE: generate book in different output formats
# display_svg format for svg images (svg, png*)
# display_svg format for svg images (svg, png*)
import
re
import
re
import
six
from
Products.PythonScripts.standard
import
html_quote
from
Products.PythonScripts.standard
import
html_quote
from
base64
import
b64encode
from
base64
import
b64encode
...
@@ -83,8 +84,7 @@ book_version = html_quote(override_document_version) if override_document_versio
...
@@ -83,8 +84,7 @@ book_version = html_quote(override_document_version) if override_document_versio
book_description
=
html_quote
(
override_document_description
)
if
override_document_description
else
book
.
getDescription
()
book_description
=
html_quote
(
override_document_description
)
if
override_document_description
else
book
.
getDescription
()
book_title
=
html_quote
(
override_document_title
)
if
override_document_title
else
book
.
getTitle
()
book_title
=
html_quote
(
override_document_title
)
if
override_document_title
else
book
.
getTitle
()
# unicode
if
six
.
PY2
and
isinstance
(
book_content
,
six
.
text_type
):
if
isinstance
(
book_content
,
unicode
):
book_content
=
book_content
.
encode
(
"UTF-8"
)
book_content
=
book_content
.
encode
(
"UTF-8"
)
# backcompat
# backcompat
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsContract.py
View file @
4a551dca
import
re
import
re
import
six
from
base64
import
b64encode
from
base64
import
b64encode
...
@@ -35,7 +36,7 @@ contract_version = context.getVersion() or "001"
...
@@ -35,7 +36,7 @@ contract_version = context.getVersion() or "001"
contract_description
=
context
.
getDescription
()
contract_description
=
context
.
getDescription
()
contract_title
=
context
.
getTitle
()
contract_title
=
context
.
getTitle
()
if
isinstance
(
contract_content
,
unicod
e
):
if
six
.
PY2
and
isinstance
(
contract_content
,
six
.
text_typ
e
):
contract_content
=
contract_content
.
encode
(
"UTF-8"
)
contract_content
=
contract_content
.
encode
(
"UTF-8"
)
contract_history_section_list
=
re
.
findall
(
'<section.+?>.+?</section>'
,
contract_content
,
re
.
S
)
contract_history_section_list
=
re
.
findall
(
'<section.+?>.+?</section>'
,
contract_content
,
re
.
S
)
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsLeaflet.py
View file @
4a551dca
...
@@ -22,6 +22,7 @@ MAIN FILE: render two pager in different output formats
...
@@ -22,6 +22,7 @@ MAIN FILE: render two pager in different output formats
# document_save: save file in document module (default None)
# document_save: save file in document module (default None)
import
re
import
re
import
six
from
Products.PythonScripts.standard
import
html_quote
from
Products.PythonScripts.standard
import
html_quote
from
base64
import
b64encode
from
base64
import
b64encode
...
@@ -146,10 +147,11 @@ if leaflet_display_side:
...
@@ -146,10 +147,11 @@ if leaflet_display_side:
)
)
#leaflet_content = leaflet_legalese.decode() + leaflet_content.decode()
#leaflet_content = leaflet_legalese.decode() + leaflet_content.decode()
if
isinstance
(
leaflet_legalese
,
unicode
):
if
six
.
PY2
:
leaflet_legalese
=
leaflet_legalese
.
encode
(
"UTF-8"
)
if
isinstance
(
leaflet_legalese
,
six
.
text_type
):
if
isinstance
(
leaflet_content
,
unicode
):
leaflet_legalese
=
leaflet_legalese
.
encode
(
"UTF-8"
)
leaflet_content
=
leaflet_content
.
encode
(
"UTF-8"
)
if
isinstance
(
leaflet_content
,
six
.
text_type
):
leaflet_content
=
leaflet_content
.
encode
(
"UTF-8"
)
leaflet_content
=
leaflet_legalese
+
leaflet_content
leaflet_content
=
leaflet_legalese
+
leaflet_content
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsRelease.py
View file @
4a551dca
...
@@ -21,6 +21,7 @@ MAIN FILE: render press release in different output formats
...
@@ -21,6 +21,7 @@ MAIN FILE: render press release in different output formats
# document_save: save file in document module (default None)
# document_save: save file in document module (default None)
import
re
import
re
import
six
from
base64
import
b64encode
from
base64
import
b64encode
blank
=
''
blank
=
''
...
@@ -137,10 +138,11 @@ if release_display_about:
...
@@ -137,10 +138,11 @@ if release_display_about:
release_relative_url
=
release_relative_url
,
release_relative_url
=
release_relative_url
,
)
)
#release_content = release_content.decode() + release_about.decode()
#release_content = release_content.decode() + release_about.decode()
if
isinstance
(
release_content
,
unicode
):
if
six
.
PY2
:
release_content
=
release_content
.
encode
(
"UTF-8"
)
if
isinstance
(
release_content
,
six
.
text_type
):
if
isinstance
(
release_about
,
unicode
):
release_content
=
release_content
.
encode
(
"UTF-8"
)
release_about
=
release_about
.
encode
(
"UTF-8"
)
if
isinstance
(
release_about
,
six
.
text_type
):
release_about
=
release_about
.
encode
(
"UTF-8"
)
release_content
=
release_content
+
release_about
release_content
=
release_content
+
release_about
...
...
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Event_getHeadOfTextContent.py
View file @
4a551dca
import
six
text
=
context
.
asText
()
text
=
context
.
asText
()
LENGTH
=
25
LENGTH
=
25
#TODO: Think about the display length of multibyte characters.
#TODO: Think about the display length of multibyte characters.
try
:
try
:
return
unicod
e
(
text
,
'utf-8'
)[:
LENGTH
].
encode
(
'utf-8'
)
return
six
.
text_typ
e
(
text
,
'utf-8'
)[:
LENGTH
].
encode
(
'utf-8'
)
except
UnicodeDecodeError
:
except
UnicodeDecodeError
:
return
text
[:
LENGTH
]
return
text
[:
LENGTH
]
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.SubversionClient.py
View file @
4a551dca
...
@@ -41,6 +41,7 @@ from AccessControl import ClassSecurityInfo
...
@@ -41,6 +41,7 @@ from AccessControl import ClassSecurityInfo
from
AccessControl.SecurityInfo
import
ModuleSecurityInfo
from
AccessControl.SecurityInfo
import
ModuleSecurityInfo
from
tempfile
import
mkdtemp
from
tempfile
import
mkdtemp
import
shutil
import
shutil
import
six
class
getTransactionalDirectory
(
str
):
class
getTransactionalDirectory
(
str
):
...
@@ -137,9 +138,9 @@ try:
...
@@ -137,9 +138,9 @@ try:
self
.
client
.
setException
(
SubversionLoginError
(
realm
))
self
.
client
.
setException
(
SubversionLoginError
(
realm
))
return
False
,
''
,
''
,
False
return
False
,
''
,
''
,
False
# BBB. support older versions of pysvn <= 1.6.3
# BBB. support older versions of pysvn <= 1.6.3
if
isinstance
(
user
,
unicod
e
):
if
six
.
PY2
and
isinstance
(
user
,
six
.
text_typ
e
):
user
=
user
.
encode
(
'utf-8'
)
user
=
user
.
encode
(
'utf-8'
)
if
isinstance
(
password
,
unicod
e
):
if
six
.
PY2
and
isinstance
(
password
,
six
.
text_typ
e
):
password
=
password
.
encode
(
'utf-8'
)
password
=
password
.
encode
(
'utf-8'
)
return
True
,
user
,
password
,
False
return
True
,
user
,
password
,
False
...
@@ -175,7 +176,7 @@ try:
...
@@ -175,7 +176,7 @@ try:
def
__call__
(
self
,
instance
):
def
__call__
(
self
,
instance
):
value
=
getattr
(
instance
.
_obj
,
self
.
_key
)
value
=
getattr
(
instance
.
_obj
,
self
.
_key
)
if
isinstance
(
value
,
unicod
e
):
if
six
.
PY2
and
isinstance
(
value
,
six
.
text_typ
e
):
value
=
value
.
encode
(
'utf-8'
)
value
=
value
.
encode
(
'utf-8'
)
#elif isinstance(value, pysvn.Entry):
#elif isinstance(value, pysvn.Entry):
elif
str
(
type
(
value
))
==
"<type 'entry'>"
:
elif
str
(
type
(
value
))
==
"<type 'entry'>"
:
...
...
bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion/Document_getPropertyDictFromContent.py
View file @
4a551dca
...
@@ -7,6 +7,7 @@ To use, write your own method (probably External Method, since it is most likely
...
@@ -7,6 +7,7 @@ To use, write your own method (probably External Method, since it is most likely
to use re) that would analyze text content of the doc
to use re) that would analyze text content of the doc
and return a dictionary of properties.
and return a dictionary of properties.
"""
"""
import
six
information
=
context
.
getContentInformation
()
information
=
context
.
getContentInformation
()
result
=
{}
result
=
{}
...
@@ -14,7 +15,7 @@ property_id_list = context.propertyIds()
...
@@ -14,7 +15,7 @@ property_id_list = context.propertyIds()
for
k
,
v
in
information
.
items
():
for
k
,
v
in
information
.
items
():
key
=
k
.
lower
()
key
=
k
.
lower
()
if
v
:
if
v
:
if
isinstance
(
v
,
unicod
e
):
v
=
v
.
encode
(
'utf-8'
)
if
six
.
PY2
and
isinstance
(
v
,
six
.
text_typ
e
):
v
=
v
.
encode
(
'utf-8'
)
if
key
in
property_id_list
:
if
key
in
property_id_list
:
if
key
==
'reference'
:
if
key
==
'reference'
:
pass
# XXX - We can not trust reference on getContentInformation
pass
# XXX - We can not trust reference on getContentInformation
...
@@ -26,7 +27,7 @@ for k, v in information.items():
...
@@ -26,7 +27,7 @@ for k, v in information.items():
result
[
'contributor'
]
=
p
.
getRelativeUrl
()
result
[
'contributor'
]
=
p
.
getRelativeUrl
()
elif
key
==
'keywords'
:
elif
key
==
'keywords'
:
if
isinstance
(
v
,
(
list
,
tuple
)):
if
isinstance
(
v
,
(
list
,
tuple
)):
v
=
[
isinstance
(
x
,
unicode
)
and
x
.
encode
(
'utf-8'
)
or
x
for
x
in
v
]
v
=
[
x
.
encode
(
'utf-8'
)
if
six
.
PY2
and
isinstance
(
x
,
six
.
text_type
)
else
x
for
x
in
v
]
else
:
else
:
v
=
v
.
split
()
v
=
v
.
split
()
result
[
'subject_list'
]
=
v
result
[
'subject_list'
]
=
v
...
...
bt5/erp5_interface_post/SkinTemplateItem/portal_skins/erp5_interface_post/Event_createPostMessage.py
View file @
4a551dca
import
six
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
post_message_post_module
=
portal
.
getDefaultModuleValue
(
post_portal_type
,
None
)
post_message_post_module
=
portal
.
getDefaultModuleValue
(
post_portal_type
,
None
)
if
isinstance
(
post_message_data
,
six
.
text_type
):
post_message_data
=
post_message_data
.
encode
()
message_post
=
post_message_post_module
.
newContent
(
message_post
=
post_message_post_module
.
newContent
(
portal_type
=
post_portal_type
,
portal_type
=
post_portal_type
,
title
=
"Post Message for %s"
%
context
.
getTitle
(),
title
=
"Post Message for %s"
%
context
.
getTitle
(),
...
...
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/ERP5Site_getTicketWorkflowStateInfoDict.py
View file @
4a551dca
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
This script has proxy role, as only manager can access workflow configuration.
This script has proxy role, as only manager can access workflow configuration.
"""
"""
import
six
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
...
@@ -11,9 +12,9 @@ workflow = portal.portal_workflow.ticket_workflow
...
@@ -11,9 +12,9 @@ workflow = portal.portal_workflow.ticket_workflow
for
state
in
workflow
.
getStateValueList
():
for
state
in
workflow
.
getStateValueList
():
state_title
=
state
.
title_or_id
()
state_title
=
state
.
title_or_id
()
state_title
=
unicod
e
(
translateString
(
state_title
=
six
.
text_typ
e
(
translateString
(
'%s [state in %s]'
%
(
state_title
,
workflow
.
getId
()),
'%s [state in %s]'
%
(
state_title
,
workflow
.
getId
()),
default
=
unicod
e
(
translateString
(
state_title
))))
default
=
six
.
text_typ
e
(
translateString
(
state_title
))))
info
[
state
.
getReference
()]
=
state_title
info
[
state
.
getReference
()]
=
state_title
return
info
return
info
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/ERP5Site_getTicketWorkflowWorklistInfoDict.py
View file @
4a551dca
...
@@ -28,9 +28,9 @@ for worklist in workflow.getWorklistValueList():
...
@@ -28,9 +28,9 @@ for worklist in workflow.getWorklistValueList():
# so that it looks good in the module view.
# so that it looks good in the module view.
key
=
'translated_%s_title'
%
key
key
=
'translated_%s_title'
%
key
state_title
=
workflow
.
getStateValueByReference
(
value
[
0
]).
title_or_id
()
state_title
=
workflow
.
getStateValueByReference
(
value
[
0
]).
title_or_id
()
value
=
unicod
e
(
translateString
(
value
=
six
.
text_typ
e
(
translateString
(
'%s [state in %s]'
%
(
state_title
,
workflow
.
getId
()),
'%s [state in %s]'
%
(
state_title
,
workflow
.
getId
()),
default
=
unicod
e
(
translateString
(
state_title
))))
default
=
six
.
text_typ
e
(
translateString
(
state_title
))))
if
isinstance
(
value
,
(
tuple
,
list
)):
if
isinstance
(
value
,
(
tuple
,
list
)):
query_list
.
extend
([{
query_list
.
extend
([{
...
...
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/SupportRequestModule_getWorklistAsJson.py
View file @
4a551dca
# return worklists from ticket workflow in JSON format
# return worklists from ticket workflow in JSON format
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
import
json
import
json
import
six
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
worklist_query_dict
=
portal
.
ERP5Site_getTicketWorkflowWorklistInfoDict
(
worklist_query_dict
=
portal
.
ERP5Site_getTicketWorkflowWorklistInfoDict
(
...
@@ -11,7 +12,7 @@ worklist_query_dict = portal.ERP5Site_getTicketWorkflowWorklistInfoDict(
...
@@ -11,7 +12,7 @@ worklist_query_dict = portal.ERP5Site_getTicketWorkflowWorklistInfoDict(
# extend this information with the query from our helper script.
# extend this information with the query from our helper script.
worklist_action_list
=
[
worklist_action_list
=
[
{
{
'action_name'
:
unicod
e
(
translateString
(
action
[
'name'
].
rsplit
(
' ('
,
1
)[
0
])),
# Action name include the count, but we display it separatly.
'action_name'
:
six
.
text_typ
e
(
translateString
(
action
[
'name'
].
rsplit
(
' ('
,
1
)[
0
])),
# Action name include the count, but we display it separatly.
'action_count'
:
action
[
'count'
],
'action_count'
:
action
[
'count'
],
'query'
:
worklist_query_dict
[
action
[
'worklist_id'
]],
'query'
:
worklist_query_dict
[
action
[
'worklist_id'
]],
}
}
...
...
bt5/erp5_payroll/SkinTemplateItem/portal_skins/erp5_payroll/PaySheetTransaction_getODTDataDict.py
View file @
4a551dca
...
@@ -115,7 +115,7 @@ def unicodeDict(d):
...
@@ -115,7 +115,7 @@ def unicodeDict(d):
return
d
return
d
for
k
,
v
in
six
.
iteritems
(
d
):
for
k
,
v
in
six
.
iteritems
(
d
):
if
isinstance
(
v
,
str
):
if
isinstance
(
v
,
str
):
d
.
update
({
k
:
unicod
e
(
v
,
'utf8'
)})
d
.
update
({
k
:
six
.
text_typ
e
(
v
,
'utf8'
)})
return
d
return
d
line_list
=
context
.
PaySheetTransaction_getLineListAsDict
()
line_list
=
context
.
PaySheetTransaction_getLineListAsDict
()
...
...
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/PaySheetTransaction_getOtherInformationsDataDict.py
View file @
4a551dca
...
@@ -167,7 +167,7 @@ def unicodeDict(d):
...
@@ -167,7 +167,7 @@ def unicodeDict(d):
return
d
return
d
for
k
,
v
in
six
.
iteritems
(
d
):
for
k
,
v
in
six
.
iteritems
(
d
):
if
isinstance
(
v
,
str
):
if
isinstance
(
v
,
str
):
d
.
update
({
k
:
unicod
e
(
v
,
'utf8'
)})
d
.
update
({
k
:
six
.
text_typ
e
(
v
,
'utf8'
)})
return
d
return
d
source_section
=
paysheet
.
getSourceSectionValue
()
source_section
=
paysheet
.
getSourceSectionValue
()
...
...
bt5/erp5_syncml/DocumentTemplateItem/portal_components/document.erp5.SyncMLSubscription.py
View file @
4a551dca
...
@@ -541,7 +541,7 @@ class SyncMLSubscription(XMLObject):
...
@@ -541,7 +541,7 @@ class SyncMLSubscription(XMLObject):
xml_document = etree.tostring(xml_document, encoding='utf-8',
xml_document = etree.tostring(xml_document, encoding='utf-8',
pretty_print=True)
pretty_print=True)
if six.PY2 and isinstance(xml_document,
unicod
e):
if six.PY2 and isinstance(xml_document,
six.text_typ
e):
xml_document = xml_document.encode('utf-8')
xml_document = xml_document.encode('utf-8')
# Link the signature to the document
# Link the signature to the document
if signature:
if signature:
...
...
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.CrawlableMixin.py
View file @
4a551dca
...
@@ -111,7 +111,7 @@ class CrawlableMixin:
...
@@ -111,7 +111,7 @@ class CrawlableMixin:
# For now take into acount only a and img tags
# For now take into acount only a and img tags
if
attribute_name
not
in
(
'href'
,):
if
attribute_name
not
in
(
'href'
,):
continue
continue
if
isinstance
(
link
,
six
.
text_type
):
if
six
.
PY2
and
isinstance
(
link
,
six
.
text_type
):
link
=
link
.
encode
(
'utf-8'
)
link
=
link
.
encode
(
'utf-8'
)
href_list
.
append
(
link
)
href_list
.
append
(
link
)
return
href_list
return
href_list
...
@@ -129,7 +129,7 @@ class CrawlableMixin:
...
@@ -129,7 +129,7 @@ class CrawlableMixin:
path_part
=
'/'
.
join
(
path_part
.
split
(
'/'
)[:
-
1
])
path_part
=
'/'
.
join
(
path_part
.
split
(
'/'
)[:
-
1
])
base_url
=
urlunsplit
((
splitted_url
[
0
],
splitted_url
[
1
],
path_part
,
None
,
base_url
=
urlunsplit
((
splitted_url
[
0
],
splitted_url
[
1
],
path_part
,
None
,
None
))
None
))
if
isinstance
(
base_url
,
six
.
text_type
):
if
six
.
PY2
and
isinstance
(
base_url
,
six
.
text_type
):
base_url
=
base_url
.
encode
(
'utf-8'
)
base_url
=
base_url
.
encode
(
'utf-8'
)
return
base_url
return
base_url
...
@@ -145,7 +145,7 @@ class CrawlableMixin:
...
@@ -145,7 +145,7 @@ class CrawlableMixin:
# in www.example.com or www.3.example.com
# in www.example.com or www.3.example.com
# keep only the example.com part
# keep only the example.com part
reference_domain
=
''
.
join
(
reference_domain
.
split
(
'.'
)[
-
2
:])
reference_domain
=
''
.
join
(
reference_domain
.
split
(
'.'
)[
-
2
:])
if
isinstance
(
reference_domain
,
six
.
text_type
):
if
six
.
PY2
and
isinstance
(
reference_domain
,
six
.
text_type
):
reference_domain
=
reference_domain
.
encode
(
'utf-8'
)
reference_domain
=
reference_domain
.
encode
(
'utf-8'
)
url_list
=
[]
url_list
=
[]
base_url
=
self
.
getContentBaseURL
()
base_url
=
self
.
getContentBaseURL
()
...
@@ -159,7 +159,7 @@ class CrawlableMixin:
...
@@ -159,7 +159,7 @@ class CrawlableMixin:
if
not
url
:
if
not
url
:
continue
continue
url_domain
=
urlsplit
(
url
)[
1
]
url_domain
=
urlsplit
(
url
)[
1
]
if
isinstance
(
url_domain
,
six
.
text_type
):
if
six
.
PY2
and
isinstance
(
url_domain
,
six
.
text_type
):
url_domain
=
url_domain
.
encode
(
'utf-8'
)
url_domain
=
url_domain
.
encode
(
'utf-8'
)
if
url_domain
and
''
.
join
(
url_domain
.
split
(
'.'
)[
-
2
:])
!=
reference_domain
:
if
url_domain
and
''
.
join
(
url_domain
.
split
(
'.'
)[
-
2
:])
!=
reference_domain
:
continue
continue
...
...
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.DownloadableMixin.py
View file @
4a551dca
...
@@ -43,7 +43,7 @@ try:
...
@@ -43,7 +43,7 @@ try:
except
ImportError
:
except
ImportError
:
# BBB backport https://github.com/zopefoundation/Zope/pull/893 with py2 support
# BBB backport https://github.com/zopefoundation/Zope/pull/893 with py2 support
def
make_content_disposition
(
disposition
,
file_name
):
def
make_content_disposition
(
disposition
,
file_name
):
if
six
.
PY2
and
not
isinstance
(
file_name
,
unicod
e
):
if
six
.
PY2
and
not
isinstance
(
file_name
,
six
.
text_typ
e
):
file_name
=
file_name
.
decode
(
'utf-8'
)
file_name
=
file_name
.
decode
(
'utf-8'
)
try
:
try
:
file_name
.
encode
(
'us-ascii'
)
file_name
.
encode
(
'us-ascii'
)
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getCategoriesSpreadSheetMapping.py
View file @
4a551dca
...
@@ -104,9 +104,9 @@ for table_name in spreadsheet_list.keys():
...
@@ -104,9 +104,9 @@ for table_name in spreadsheet_list.keys():
# 1 table = 1 base category
# 1 table = 1 base category
base_category_name
=
table_name
base_category_name
=
table_name
base_category_id
=
getIDFromString
(
base_category_name
)
base_category_id
=
getIDFromString
(
base_category_name
)
if
six
.
PY2
and
isinstance
(
base_category_name
,
unicod
e
):
if
six
.
PY2
and
isinstance
(
base_category_name
,
six
.
text_typ
e
):
base_category_name
=
base_category_name
.
encode
(
'utf8'
)
base_category_name
=
base_category_name
.
encode
(
'utf8'
)
if
six
.
PY2
and
isinstance
(
base_category_id
,
unicod
e
):
if
six
.
PY2
and
isinstance
(
base_category_id
,
six
.
text_typ
e
):
base_category_id
=
base_category_id
.
encode
(
'utf8'
)
base_category_id
=
base_category_id
.
encode
(
'utf8'
)
category_list
=
category_list_spreadsheet_mapping
.
setdefault
(
base_category_id
,
[])
category_list
=
category_list_spreadsheet_mapping
.
setdefault
(
base_category_id
,
[])
category_list
.
append
({
'path'
:
base_category_id
category_list
.
append
({
'path'
:
base_category_id
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_translateString.py
View file @
4a551dca
...
@@ -12,8 +12,10 @@ if translation_service is not None :
...
@@ -12,8 +12,10 @@ if translation_service is not None :
if
not
encoding
:
if
not
encoding
:
return
translation_service
.
translate
(
catalog
,
msg
,
lang
=
lang
,
**
kw
)
return
translation_service
.
translate
(
catalog
,
msg
,
lang
=
lang
,
**
kw
)
msg
=
translation_service
.
translate
(
catalog
,
msg
,
lang
=
lang
,
**
kw
)
msg
=
translation_service
.
translate
(
catalog
,
msg
,
lang
=
lang
,
**
kw
)
if
isinstance
(
msg
,
six
.
text_type
):
if
six
.
PY2
and
isinstance
(
msg
,
six
.
text_type
):
msg
=
msg
.
encode
(
encoding
)
msg
=
msg
.
encode
(
encoding
)
elif
six
.
PY3
and
isinstance
(
msg
,
six
.
binary_type
):
msg
=
msg
.
decode
(
encoding
)
return
msg
return
msg
except
AttributeError
:
# This happens in unit testing, because it is not able to find something with get_context()
except
AttributeError
:
# This happens in unit testing, because it is not able to find something with get_context()
pass
pass
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_getPythonSourceCodeMessageList.py
View file @
4a551dca
...
@@ -53,7 +53,7 @@ def checkPythonScript(script_instance, script_path):
...
@@ -53,7 +53,7 @@ def checkPythonScript(script_instance, script_path):
'DateTime'
,
'whrandom'
,
'reorder'
,
'sets'
,
'test'
,
'math'
]
'DateTime'
,
'whrandom'
,
'reorder'
,
'sets'
,
'test'
,
'math'
]
code
=
script_instance
.
body
()
code
=
script_instance
.
body
()
if
six
.
PY2
:
if
six
.
PY2
:
code
=
unicod
e
(
code
,
'utf8'
)
code
=
six
.
text_typ
e
(
code
,
'utf8'
)
for
annotation
in
json
.
loads
(
portal
.
ERP5Site_checkPythonSourceCodeAsJSON
(
for
annotation
in
json
.
loads
(
portal
.
ERP5Site_checkPythonSourceCodeAsJSON
(
{
'bound_names'
:
extra_builtins
+
{
'bound_names'
:
extra_builtins
+
script_instance
.
getBindingAssignments
().
getAssignedNamesInOrder
(),
script_instance
.
getBindingAssignments
().
getAssignedNamesInOrder
(),
...
@@ -80,7 +80,7 @@ def checkComponent(component_instance):
...
@@ -80,7 +80,7 @@ def checkComponent(component_instance):
jio_key
=
component_relative_url
,),)
jio_key
=
component_relative_url
,),)
code
=
component_instance
.
getTextContent
()
code
=
component_instance
.
getTextContent
()
if
six
.
PY2
:
if
six
.
PY2
:
code
=
unicod
e
(
code
,
'utf8'
)
code
=
six
.
text_typ
e
(
code
,
'utf8'
)
for
annotation
in
json
.
loads
(
portal
.
ERP5Site_checkPythonSourceCodeAsJSON
(
for
annotation
in
json
.
loads
(
portal
.
ERP5Site_checkPythonSourceCodeAsJSON
(
{
'code'
:
code
}))[
'annotations'
]:
{
'code'
:
code
}))[
'annotations'
]:
annotation
[
'component_path'
]
=
component_relative_url
annotation
[
'component_path'
]
=
component_relative_url
...
...
product/ERP5Catalog/CatalogTool.py
View file @
4a551dca
...
@@ -624,7 +624,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
...
@@ -624,7 +624,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
"""
"""
user
=
_getAuthenticatedUser
(
self
)
user
=
_getAuthenticatedUser
(
self
)
user_str
=
user
.
getIdOrUserName
()
user_str
=
user
.
getIdOrUserName
()
if
isinstance
(
user_str
,
six
.
text_type
):
if
six
.
PY2
and
isinstance
(
user_str
,
six
.
text_type
):
user_str
=
user_str
.
encode
(
'utf-8'
)
user_str
=
user_str
.
encode
(
'utf-8'
)
user_is_superuser
=
(
user
==
system_user
)
or
(
user_str
==
ERP5Security
.
SUPER_USER
)
user_is_superuser
=
(
user
==
system_user
)
or
(
user_str
==
ERP5Security
.
SUPER_USER
)
allowedRolesAndUsers
=
self
.
_listAllowedRolesAndUsers
(
user
)
allowedRolesAndUsers
=
self
.
_listAllowedRolesAndUsers
(
user
)
...
...
product/ERP5Form/ListBox.py
View file @
4a551dca
...
@@ -705,7 +705,7 @@ class ListBoxRenderer:
...
@@ -705,7 +705,7 @@ class ListBoxRenderer:
"""Return the title. Make sure that it is in unicode.
"""Return the title. Make sure that it is in unicode.
"""
"""
if
six
.
PY2
:
if
six
.
PY2
:
return
unicod
e
(
self
.
field
.
get_value
(
'title'
),
self
.
getEncoding
())
return
six
.
text_typ
e
(
self
.
field
.
get_value
(
'title'
),
self
.
getEncoding
())
else
:
else
:
return
self
.
field
.
get_value
(
'title'
)
return
self
.
field
.
get_value
(
'title'
)
...
@@ -897,7 +897,7 @@ class ListBoxRenderer:
...
@@ -897,7 +897,7 @@ class ListBoxRenderer:
"""
"""
columns
=
self
.
field
.
get_value
(
'columns'
)
columns
=
self
.
field
.
get_value
(
'columns'
)
if
six
.
PY2
:
if
six
.
PY2
:
return
[(
str
(
c
[
0
]),
unicod
e
(
c
[
1
],
self
.
getEncoding
()))
for
c
in
columns
]
return
[(
str
(
c
[
0
]),
six
.
text_typ
e
(
c
[
1
],
self
.
getEncoding
()))
for
c
in
columns
]
else
:
else
:
return
columns
return
columns
...
@@ -909,7 +909,7 @@ class ListBoxRenderer:
...
@@ -909,7 +909,7 @@ class ListBoxRenderer:
all_column_list
=
list
(
self
.
getColumnList
())
all_column_list
=
list
(
self
.
getColumnList
())
all_column_id_set
=
{
c
[
0
]
for
c
in
all_column_list
}
all_column_id_set
=
{
c
[
0
]
for
c
in
all_column_list
}
if
six
.
PY2
:
if
six
.
PY2
:
all_column_list
.
extend
((
str
(
c
[
0
]),
unicod
e
(
c
[
1
],
self
.
getEncoding
()))
all_column_list
.
extend
((
str
(
c
[
0
]),
six
.
text_typ
e
(
c
[
1
],
self
.
getEncoding
()))
for
c
in
self
.
field
.
get_value
(
'all_columns'
)
for
c
in
self
.
field
.
get_value
(
'all_columns'
)
if
c
[
0
]
not
in
all_column_id_set
)
if
c
[
0
]
not
in
all_column_id_set
)
else
:
else
:
...
@@ -931,7 +931,7 @@ class ListBoxRenderer:
...
@@ -931,7 +931,7 @@ class ListBoxRenderer:
stat_columns
=
self
.
field
.
get_value
(
'stat_columns'
)
stat_columns
=
self
.
field
.
get_value
(
'stat_columns'
)
if
stat_columns
:
if
stat_columns
:
if
six
.
PY2
:
if
six
.
PY2
:
stat_column_list
=
[(
str
(
c
[
0
]),
unicod
e
(
c
[
1
],
self
.
getEncoding
()))
for
c
in
stat_columns
]
stat_column_list
=
[(
str
(
c
[
0
]),
six
.
text_typ
e
(
c
[
1
],
self
.
getEncoding
()))
for
c
in
stat_columns
]
else
:
else
:
stat_column_list
=
stat_columns
stat_column_list
=
stat_columns
else
:
else
:
...
@@ -964,7 +964,7 @@ class ListBoxRenderer:
...
@@ -964,7 +964,7 @@ class ListBoxRenderer:
"""
"""
domain_root_list
=
self
.
field
.
get_value
(
'domain_root_list'
)
domain_root_list
=
self
.
field
.
get_value
(
'domain_root_list'
)
if
six
.
PY2
:
if
six
.
PY2
:
return
[(
str
(
c
[
0
]),
unicod
e
(
c
[
1
],
self
.
getEncoding
()))
for
c
in
domain_root_list
]
return
[(
str
(
c
[
0
]),
six
.
text_typ
e
(
c
[
1
],
self
.
getEncoding
()))
for
c
in
domain_root_list
]
else
:
else
:
return
domain_root_list
return
domain_root_list
...
@@ -974,7 +974,7 @@ class ListBoxRenderer:
...
@@ -974,7 +974,7 @@ class ListBoxRenderer:
"""
"""
report_root_list
=
self
.
field
.
get_value
(
'report_root_list'
)
report_root_list
=
self
.
field
.
get_value
(
'report_root_list'
)
if
six
.
PY2
:
if
six
.
PY2
:
return
[(
str
(
c
[
0
]),
unicod
e
(
c
[
1
],
self
.
getEncoding
()))
for
c
in
report_root_list
]
return
[(
str
(
c
[
0
]),
six
.
text_typ
e
(
c
[
1
],
self
.
getEncoding
()))
for
c
in
report_root_list
]
else
:
else
:
return
report_root_list
return
report_root_list
...
@@ -984,7 +984,7 @@ class ListBoxRenderer:
...
@@ -984,7 +984,7 @@ class ListBoxRenderer:
titles are in unicode"""
titles are in unicode"""
display_style_list
=
self
.
field
.
get_value
(
'display_style_list'
)
display_style_list
=
self
.
field
.
get_value
(
'display_style_list'
)
if
six
.
PY2
:
if
six
.
PY2
:
return
[(
str
(
c
[
0
]),
unicod
e
(
c
[
1
],
self
.
getEncoding
()))
for
c
in
\
return
[(
str
(
c
[
0
]),
six
.
text_typ
e
(
c
[
1
],
self
.
getEncoding
()))
for
c
in
\
display_style_list
]
display_style_list
]
else
:
else
:
return
display_style_list
return
display_style_list
...
@@ -1751,7 +1751,7 @@ class ListBoxRenderer:
...
@@ -1751,7 +1751,7 @@ class ListBoxRenderer:
if
not
isinstance
(
processed_value
,
six
.
text_type
):
if
not
isinstance
(
processed_value
,
six
.
text_type
):
if
six
.
PY2
:
if
six
.
PY2
:
processed_value
=
unicod
e
(
str
(
processed_value
),
self
.
getEncoding
(),
'replace'
)
processed_value
=
six
.
text_typ
e
(
str
(
processed_value
),
self
.
getEncoding
(),
'replace'
)
else
:
else
:
processed_value
=
str
(
processed_value
).
encode
(
processed_value
=
str
(
processed_value
).
encode
(
self
.
getEncoding
(),
'replace'
).
decode
()
self
.
getEncoding
(),
'replace'
).
decode
()
...
@@ -2381,7 +2381,7 @@ class ListBoxRendererLine:
...
@@ -2381,7 +2381,7 @@ class ListBoxRendererLine:
processed_value
=
u''
processed_value
=
u''
elif
not
isinstance
(
processed_value
,
six
.
text_type
):
elif
not
isinstance
(
processed_value
,
six
.
text_type
):
if
six
.
PY2
:
if
six
.
PY2
:
processed_value
=
unicod
e
(
str
(
processed_value
),
renderer
.
getEncoding
(),
'replace'
)
processed_value
=
six
.
text_typ
e
(
str
(
processed_value
),
renderer
.
getEncoding
(),
'replace'
)
else
:
else
:
processed_value
=
str
(
processed_value
).
encode
(
processed_value
=
str
(
processed_value
).
encode
(
renderer
.
getEncoding
(),
'replace'
).
decode
()
renderer
.
getEncoding
(),
'replace'
).
decode
()
...
@@ -2716,7 +2716,10 @@ class ListBoxListRenderer(ListBoxRenderer):
...
@@ -2716,7 +2716,10 @@ class ListBoxListRenderer(ListBoxRenderer):
title_listboxline
=
ListBoxLine
()
title_listboxline
=
ListBoxLine
()
title_listboxline
.
markTitleLine
()
title_listboxline
.
markTitleLine
()
for
c
in
self
.
getSelectedColumnList
():
for
c
in
self
.
getSelectedColumnList
():
title_listboxline
.
addColumn
(
c
[
0
],
c
[
1
].
encode
(
self
.
getEncoding
()))
if
six
.
PY2
:
title_listboxline
.
addColumn
(
c
[
0
],
c
[
1
].
encode
(
self
.
getEncoding
()))
else
:
title_listboxline
.
addColumn
(
c
[
0
],
c
[
1
])
listboxline_list
.
append
(
title_listboxline
)
listboxline_list
.
append
(
title_listboxline
)
# Obtain the list of lines.
# Obtain the list of lines.
...
@@ -2742,7 +2745,7 @@ class ListBoxListRenderer(ListBoxRenderer):
...
@@ -2742,7 +2745,7 @@ class ListBoxListRenderer(ListBoxRenderer):
listboxline
.
checkLine
(
uid
in
checked_uid_set
)
listboxline
.
checkLine
(
uid
in
checked_uid_set
)
for
(
original_value
,
processed_value
),
(
sql
,
title
)
in
zip
(
line
.
getValueList
(),
self
.
getSelectedColumnList
()):
for
(
original_value
,
processed_value
),
(
sql
,
title
)
in
zip
(
line
.
getValueList
(),
self
.
getSelectedColumnList
()):
if
isinstance
(
original_value
,
six
.
text_type
):
if
six
.
PY2
and
isinstance
(
original_value
,
six
.
text_type
):
value
=
original_value
.
encode
(
self
.
getEncoding
())
value
=
original_value
.
encode
(
self
.
getEncoding
())
else
:
else
:
value
=
original_value
value
=
original_value
...
@@ -2760,7 +2763,7 @@ class ListBoxListRenderer(ListBoxRenderer):
...
@@ -2760,7 +2763,7 @@ class ListBoxListRenderer(ListBoxRenderer):
stat_listboxline
.
markStatLine
()
stat_listboxline
.
markStatLine
()
for
(
original_value
,
processed_value
),
(
sql
,
title
)
in
zip
(
self
.
getStatValueList
(),
self
.
getSelectedColumnList
()):
for
(
original_value
,
processed_value
),
(
sql
,
title
)
in
zip
(
self
.
getStatValueList
(),
self
.
getSelectedColumnList
()):
if
isinstance
(
original_value
,
six
.
text_type
):
if
six
.
PY2
and
isinstance
(
original_value
,
six
.
text_type
):
value
=
original_value
.
encode
(
self
.
getEncoding
())
value
=
original_value
.
encode
(
self
.
getEncoding
())
else
:
else
:
value
=
original_value
value
=
original_value
...
...
product/ERP5Form/PDFTemplate.py
View file @
4a551dca
...
@@ -44,6 +44,7 @@ from ZODB.POSException import ConflictError
...
@@ -44,6 +44,7 @@ from ZODB.POSException import ConflictError
from
Products.ERP5Type.Utils
import
UpperCase
from
Products.ERP5Type.Utils
import
UpperCase
from
zLOG
import
LOG
from
zLOG
import
LOG
import
six
try
:
try
:
from
zExceptions
import
ResourceLockedError
from
zExceptions
import
ResourceLockedError
...
@@ -304,18 +305,16 @@ if ReportTool:
...
@@ -304,18 +305,16 @@ if ReportTool:
#LOG('ReportTool_renderPDF', 0, 'encoding = %r' % encoding)
#LOG('ReportTool_renderPDF', 0, 'encoding = %r' % encoding)
rhandler
=
ERP5ResourceHandler
(
context
,
getattr
(
self
,
'resourcePath'
,
None
))
rhandler
=
ERP5ResourceHandler
(
context
,
getattr
(
self
,
'resourcePath'
,
None
))
# if zope gives us the xml in unicode
# we need to encode it before it can be parsed
template_xml
=
getattr
(
context
,
templatename
)(
*
args
,
**
kwargs
)
template_xml
=
getattr
(
context
,
templatename
)(
*
args
,
**
kwargs
)
if
type
(
template_xml
)
is
type
(
u''
):
if
not
isinstance
(
template_xml
,
six
.
text_type
):
template_xml
=
self
.
_encode
(
template_xml
,
encoding
)
template_xml
=
template_xml
.
decode
(
encoding
)
if
type
(
document_xml
)
is
type
(
u''
):
if
not
isinstance
(
document_xml
,
six
.
text_type
):
document_xml
=
self
.
_encode
(
document_xml
,
encoding
)
document_xml
=
document_xml
.
decode
(
encoding
)
#LOG('ReportTool_renderPDF', 0, 'template_xml = %r, document_xml = %r' % (template_xml, document_xml))
#LOG('ReportTool_renderPDF', 0, 'template_xml = %r, document_xml = %r' % (template_xml, document_xml))
# XXXXX Because reportlab does not support UTF-8, use Latin-1. What a mess.
# XXXXX Because reportlab does not support UTF-8, use Latin-1. What a mess.
template_xml
=
unicode
(
template_xml
,
encoding
)
.
encode
(
'iso-8859-1'
)
template_xml
=
template_xml
.
encode
(
'iso-8859-1'
)
document_xml
=
unicode
(
document_xml
,
encoding
).
encode
(
'iso-8859-1'
,
'replace'
)
document_xml
=
document_xml
.
encode
(
'iso-8859-1'
,
'replace'
)
encoding
=
'iso-8859-1'
encoding
=
'iso-8859-1'
# create the PDFTemplate from xml
# create the PDFTemplate from xml
...
...
product/ERP5Form/Selection.py
View file @
4a551dca
...
@@ -133,9 +133,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
...
@@ -133,9 +133,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
if
uids
is
None
:
uids
=
[]
if
uids
is
None
:
uids
=
[]
if
columns
is
None
:
columns
=
[]
if
columns
is
None
:
columns
=
[]
if
checked_uids
is
None
:
checked_uids
=
[]
if
checked_uids
is
None
:
checked_uids
=
[]
# XXX Because method_path is an URI, it must be in ASCII.
if
six
.
PY2
and
isinstance
(
method_path
,
six
.
text_type
):
# Shouldn't Zope automatically does this conversion? -yo
# XXX Because method_path is an URI, it must be in ASCII.
if
type
(
method_path
)
is
type
(
u'a'
):
# Shouldn't Zope automatically does this conversion? -yo
method_path
=
method_path
.
encode
(
'ascii'
)
method_path
=
method_path
.
encode
(
'ascii'
)
self
.
method_path
=
method_path
self
.
method_path
=
method_path
self
.
params
=
params
self
.
params
=
params
...
@@ -170,9 +170,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
...
@@ -170,9 +170,9 @@ class Selection(Acquisition.Implicit, Traversable, Persistent):
if
kw
is
not
None
:
if
kw
is
not
None
:
for
k
,
v
in
six
.
iteritems
(
kw
):
for
k
,
v
in
six
.
iteritems
(
kw
):
if
k
in
(
'domain'
,
'report'
,
'domain_path'
,
'report_path'
,
'domain_list'
,
'report_list'
)
or
v
is
not
None
:
if
k
in
(
'domain'
,
'report'
,
'domain_path'
,
'report_path'
,
'domain_list'
,
'report_list'
)
or
v
is
not
None
:
# XXX Because method_path is an URI, it must be in ASCII.
if
six
.
PY2
and
k
==
'method_path'
and
isinstance
(
v
,
six
.
text_type
):
# Shouldn't Zope automatically does this conversion? -yo
# XXX Because method_path is an URI, it must be in ASCII.
if
k
==
'method_path'
and
isinstance
(
v
,
six
.
text_type
):
# Shouldn't Zope automatically does this conversion? -yo
v
=
v
.
encode
(
'ascii'
)
v
=
v
.
encode
(
'ascii'
)
if
getattr
(
self
,
k
,
None
)
!=
v
:
if
getattr
(
self
,
k
,
None
)
!=
v
:
setattr
(
self
,
k
,
v
)
setattr
(
self
,
k
,
v
)
...
...
product/ERP5OOo/tests/testIngestion.py
View file @
4a551dca
...
@@ -1502,6 +1502,7 @@ class TestIngestion(IngestionTestCase):
...
@@ -1502,6 +1502,7 @@ class TestIngestion(IngestionTestCase):
"""
"""
input_script_id
=
'Document_getPropertyDictFromContent'
input_script_id
=
'Document_getPropertyDictFromContent'
python_code
=
"""from Products.CMFCore.utils import getToolByName
python_code
=
"""from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
portal = context.getPortalObject()
information = context.getContentInformation()
information = context.getContentInformation()
...
@@ -1510,7 +1511,7 @@ property_id_list = context.propertyIds()
...
@@ -1510,7 +1511,7 @@ property_id_list = context.propertyIds()
for k, v in information.items():
for k, v in information.items():
key = k.lower()
key = k.lower()
if v:
if v:
if
isinstance(v, unicod
e):
if
six.PY2 and isinstance(v, six.text_typ
e):
v = v.encode('utf-8')
v = v.encode('utf-8')
if key in property_id_list:
if key in property_id_list:
if key == 'reference':
if key == 'reference':
...
@@ -1583,6 +1584,7 @@ return result
...
@@ -1583,6 +1584,7 @@ return result
"""
"""
input_script_id
=
'Document_getPropertyDictFromContent'
input_script_id
=
'Document_getPropertyDictFromContent'
python_code
=
"""from Products.CMFCore.utils import getToolByName
python_code
=
"""from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
portal = context.getPortalObject()
information = context.getContentInformation()
information = context.getContentInformation()
...
@@ -1591,7 +1593,7 @@ property_id_list = context.propertyIds()
...
@@ -1591,7 +1593,7 @@ property_id_list = context.propertyIds()
for k, v in information.items():
for k, v in information.items():
key = k.lower()
key = k.lower()
if v:
if v:
if
isinstance(v, unicod
e):
if
six.PY2 and isinstance(v, six.text_typ
e):
v = v.encode('utf-8')
v = v.encode('utf-8')
if key in property_id_list:
if key in property_id_list:
if key == 'reference':
if key == 'reference':
...
@@ -1723,6 +1725,7 @@ context.setReference(reference)
...
@@ -1723,6 +1725,7 @@ context.setReference(reference)
"""
"""
input_script_id
=
'Document_getPropertyDictFromContent'
input_script_id
=
'Document_getPropertyDictFromContent'
python_code
=
"""from Products.CMFCore.utils import getToolByName
python_code
=
"""from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
portal = context.getPortalObject()
information = context.getContentInformation()
information = context.getContentInformation()
...
@@ -1731,7 +1734,7 @@ property_id_list = context.propertyIds()
...
@@ -1731,7 +1734,7 @@ property_id_list = context.propertyIds()
for k, v in information.items():
for k, v in information.items():
key = k.lower()
key = k.lower()
if v:
if v:
if
isinstance(v, unicod
e):
if
six.PY2 and isinstance(v, six.text_typ
e):
v = v.encode('utf-8')
v = v.encode('utf-8')
if key in property_id_list:
if key in property_id_list:
if key == 'reference':
if key == 'reference':
...
@@ -1814,6 +1817,7 @@ return result
...
@@ -1814,6 +1817,7 @@ return result
"""
"""
input_script_id
=
'Document_getPropertyDictFromContent'
input_script_id
=
'Document_getPropertyDictFromContent'
python_code
=
"""from Products.CMFCore.utils import getToolByName
python_code
=
"""from Products.CMFCore.utils import getToolByName
import six
portal = context.getPortalObject()
portal = context.getPortalObject()
information = context.getContentInformation()
information = context.getContentInformation()
...
@@ -1822,7 +1826,7 @@ property_id_list = context.propertyIds()
...
@@ -1822,7 +1826,7 @@ property_id_list = context.propertyIds()
for k, v in information.items():
for k, v in information.items():
key = k.lower()
key = k.lower()
if v:
if v:
if
isinstance(v, unicod
e):
if
six.PY2 and isinstance(v, six.text_typ
e):
v = v.encode('utf-8')
v = v.encode('utf-8')
if key in property_id_list:
if key in property_id_list:
if key == 'reference':
if key == 'reference':
...
...
product/ERP5Type/Accessor/TypeDefinition.py
View file @
4a551dca
...
@@ -104,7 +104,7 @@ def asString(value):
...
@@ -104,7 +104,7 @@ def asString(value):
if
value
is
None
:
if
value
is
None
:
result
=
''
result
=
''
else
:
else
:
if
six
.
PY2
and
isinstance
(
value
,
unicod
e
):
if
six
.
PY2
and
isinstance
(
value
,
six
.
text_typ
e
):
result
=
value
.
encode
(
'utf-8'
)
result
=
value
.
encode
(
'utf-8'
)
elif
six
.
PY3
and
isinstance
(
value
,
bytes
):
elif
six
.
PY3
and
isinstance
(
value
,
bytes
):
result
=
value
.
decode
(
'utf-8'
,
'surrogateescape'
)
result
=
value
.
decode
(
'utf-8'
,
'surrogateescape'
)
...
...
product/ERP5Type/Message.py
View file @
4a551dca
...
@@ -154,19 +154,10 @@ class Message(Persistent):
...
@@ -154,19 +154,10 @@ class Message(Persistent):
Return the translated message as a string object.
Return the translated message as a string object.
"""
"""
message
=
self
.
translate
()
message
=
self
.
translate
()
if
isinstance
(
message
,
six
.
text_type
):
if
six
.
PY2
and
isinstance
(
message
,
six
.
text_type
):
message
=
message
.
encode
(
'utf-8'
)
message
=
message
.
encode
(
'utf-8'
)
return
message
return
message
def
__unicode__
(
self
):
"""
Return the translated message as a unicode object.
"""
message
=
self
.
translate
()
if
isinstance
(
message
,
str
):
message
=
message
.
decode
(
'utf-8'
)
return
message
def
__len__
(
self
):
def
__len__
(
self
):
return
len
(
str
(
self
))
return
len
(
str
(
self
))
...
@@ -176,6 +167,17 @@ class Message(Persistent):
...
@@ -176,6 +167,17 @@ class Message(Persistent):
def
__getslice__
(
self
,
i
,
j
):
def
__getslice__
(
self
,
i
,
j
):
return
str
(
self
)[
i
:
j
]
return
str
(
self
)[
i
:
j
]
if
six
.
PY2
:
def
__unicode__
(
self
):
"""
Return the translated message as a unicode object.
"""
message
=
self
.
translate
()
if
isinstance
(
message
,
str
):
message
=
message
.
decode
(
'utf-8'
)
return
message
Message
.
__unicode__
=
__unicode__
InitializeClass
(
Message
)
InitializeClass
(
Message
)
allow_class
(
Message
)
allow_class
(
Message
)
...
...
product/Formulator/Widget.py
View file @
4a551dca
...
@@ -2123,7 +2123,7 @@ class FloatWidget(TextWidget):
...
@@ -2123,7 +2123,7 @@ class FloatWidget(TextWidget):
# field.
# field.
for
x
in
xrange
(
0
,
precision
):
for
x
in
xrange
(
0
,
precision
):
format
+=
'0'
format
+=
'0'
if
isinstance
(
value
,
six
.
text_type
):
if
six
.
PY2
and
isinstance
(
value
,
six
.
text_type
):
value
=
value
.
encode
(
field
.
get_form_encoding
())
value
=
value
.
encode
(
field
.
get_form_encoding
())
return
{
'query'
:
value
,
return
{
'query'
:
value
,
'format'
:
format
,
'format'
:
format
,
...
...
product/MailTemplates/BaseMailTemplate.py
View file @
4a551dca
...
@@ -51,7 +51,7 @@ class BaseMailTemplate:
...
@@ -51,7 +51,7 @@ class BaseMailTemplate:
# So I remove it.
# So I remove it.
if
text
.
endswith
(
'
\
n
'
):
if
text
.
endswith
(
'
\
n
'
):
text
=
text
[:
-
1
]
text
=
text
[:
-
1
]
if
not
self
.
html
()
and
isinstance
(
text
,
six
.
text_type
):
if
six
.
PY2
and
not
self
.
html
()
and
isinstance
(
text
,
six
.
text_type
):
text
=
text
.
encode
(
encoding
,
'replace'
)
text
=
text
.
encode
(
encoding
,
'replace'
)
# now turn the result into a MIMEText object
# now turn the result into a MIMEText object
msg
=
MIMEText
(
msg
=
MIMEText
(
...
...
product/PortalTransforms/transforms/safe_html.py
View file @
4a551dca
...
@@ -540,7 +540,7 @@ class SafeHTML:
...
@@ -540,7 +540,7 @@ class SafeHTML:
# avoid breaking now.
# avoid breaking now.
# continue into the loop with repaired html
# continue into the loop with repaired html
else
:
else
:
if
isinstance
(
orig
,
unicod
e
):
if
isinstance
(
orig
,
six
.
text_typ
e
):
orig
=
orig
.
encode
(
'utf-8'
)
orig
=
orig
.
encode
(
'utf-8'
)
data
.
setData
(
orig
)
data
.
setData
(
orig
)
break
break
...
...
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