Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
1a895b06
Commit
1a895b06
authored
Apr 27, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more generic zope4py3 fixes
parent
3562e471
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
32 additions
and
19 deletions
+32
-19
bt5/erp5_base/MixinTemplateItem/portal_components/mixin.erp5.EncryptedPasswordMixin.py
...em/portal_components/mixin.erp5.EncryptedPasswordMixin.py
+3
-3
bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_createPersonAndAssignment.py
...credential/CredentialRequest_createPersonAndAssignment.py
+1
-1
bt5/erp5_dms/DocumentTemplateItem/portal_components/document.erp5.PDFDocument.py
...mplateItem/portal_components/document.erp5.PDFDocument.py
+4
-2
bt5/erp5_dms_ui_test/SkinTemplateItem/portal_skins/erp5_dms_ui_test/PDF_getContentPassword.py
...m/portal_skins/erp5_dms_ui_test/PDF_getContentPassword.py
+1
-1
bt5/erp5_pdm/DocumentTemplateItem/portal_components/document.erp5.Transformation.py
...ateItem/portal_components/document.erp5.Transformation.py
+1
-1
bt5/erp5_web/ModuleComponentTemplateItem/portal_components/module.erp5.TransformHtmlToPdf.py
...eItem/portal_components/module.erp5.TransformHtmlToPdf.py
+6
-4
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.SessionTool.py
...ntTemplateItem/portal_components/tool.erp5.SessionTool.py
+9
-5
product/ERP5Type/patches/diff.py
product/ERP5Type/patches/diff.py
+7
-2
No files found.
bt5/erp5_base/MixinTemplateItem/portal_components/mixin.erp5.EncryptedPasswordMixin.py
View file @
1a895b06
...
...
@@ -36,10 +36,12 @@ from Acquisition import aq_base
from
Products.ERP5Type
import
Permissions
from
erp5.component.interface.IEncryptedPassword
import
IEncryptedPassword
from
Products.ERP5Type.Globals
import
PersistentMapping
from
Products.ERP5Type.Utils
import
bytes2str
from
Products.CMFCore.utils
import
_checkPermission
from
Products.CMFCore.exceptions
import
AccessControl_Unauthorized
from
six
import
string_types
as
basestring
@
zope
.
interface
.
implementer
(
IEncryptedPassword
,)
class
EncryptedPasswordMixin
(
object
):
"""Encrypted Password Mixin
...
...
@@ -82,8 +84,6 @@ class EncryptedPasswordMixin(object):
value
,
format
=
'default'
,
# pylint: disable=redefined-builtin
):
if
value
is
not
None
and
not
isinstance
(
value
,
bytes
):
value
=
value
.
encode
()
password
=
getattr
(
aq_base
(
self
),
'password'
,
None
)
if
password
is
None
or
isinstance
(
password
,
basestring
):
password
=
self
.
password
=
PersistentMapping
()
...
...
@@ -105,7 +105,7 @@ class EncryptedPasswordMixin(object):
# workflows on this method.
self
.
password
=
PersistentMapping
()
if
value
:
self
.
_setEncodedPassword
(
pw_encrypt
(
value
))
self
.
_setEncodedPassword
(
bytes2str
(
pw_encrypt
(
value
)
))
def
_setPassword
(
self
,
value
):
self
.
checkPasswordValueAcceptable
(
value
)
...
...
bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/CredentialRequest_createPersonAndAssignment.py
View file @
1a895b06
...
...
@@ -35,7 +35,7 @@ for portal_type in related_portal_type:
context
.
CredentialRequest_updateLocalRolesOnSecurityGroups
()
if
password
is
not
None
:
if
password
.
startswith
(
b
'{SSHA}'
):
if
password
.
startswith
(
'{SSHA}'
):
#password is encoded, set it to None to script witch send the password to user
password
=
None
# Send notification in activities
...
...
bt5/erp5_dms/DocumentTemplateItem/portal_components/document.erp5.PDFDocument.py
View file @
1a895b06
...
...
@@ -123,7 +123,8 @@ class PDFDocument(Image):
"""
if
format
==
'html'
:
try
:
return
self
.
getConversion
(
format
=
format
)
mime
,
data
=
self
.
getConversion
(
format
=
format
)
return
mime
,
bytes2str
(
data
)
except
KeyError
:
mime
=
'text/html'
data
=
self
.
_convertToHTML
()
...
...
@@ -131,7 +132,8 @@ class PDFDocument(Image):
return
(
mime
,
data
)
elif
format
in
(
'txt'
,
'text'
):
try
:
return
self
.
getConversion
(
format
=
'txt'
)
mime
,
data
=
self
.
getConversion
(
format
=
'txt'
)
return
mime
,
bytes2str
(
data
)
except
KeyError
:
mime
=
'text/plain'
data
=
self
.
_convertToText
()
...
...
bt5/erp5_dms_ui_test/SkinTemplateItem/portal_skins/erp5_dms_ui_test/PDF_getContentPassword.py
View file @
1a895b06
# type: () ->
bytes
# type: () ->
str
if
context
.
getId
()
==
'test_ERP5_Logo_Encrypted_PDF'
:
return
'secret'
return
context
.
skinSuper
(
'erp5_dms_ui_test'
,
'PDF_getContentPassword'
)(
REQUEST
=
REQUEST
)
bt5/erp5_pdm/DocumentTemplateItem/portal_components/document.erp5.Transformation.py
View file @
1a895b06
...
...
@@ -170,7 +170,7 @@ class Transformation(MappedValue, VariatedMixin, Amount, AmountGeneratorMixin):
User may want to define generic transformation without
any defined resource.
"""
if
base_category_list
is
():
if
base_category_list
==
():
base_category_list
=
self
.
getVariationBaseCategoryList
()
resource
=
self
.
getResourceValue
()
...
...
bt5/erp5_web/ModuleComponentTemplateItem/portal_components/module.erp5.TransformHtmlToPdf.py
View file @
1a895b06
# -*- coding: utf-8 -*-
import
six
from
Products.PortalTransforms.interfaces
import
ITransform
from
zope.interface
import
implementer
from
erp5.component.module.TransformLib
import
DocumentConversionServerTransform
@
implementer
(
ITransform
)
class
TransformHtmlToPdf
(
DocumentConversionServerTransform
):
"""
...
...
@@ -19,13 +21,13 @@ class TransformHtmlToPdf(DocumentConversionServerTransform):
# (https://lab.nexedi.com/nexedi/cloudooo/merge_requests/20)
return
'html'
if
mimetype
==
'text/html'
else
'pdf'
def
convert
(
self
,
*
args
,
**
kwargs
):
def
convert
(
self
,
orig
,
*
args
,
**
kwargs
):
# wkhtmltopdf handler currently requires conversion_kw (hack in convertFile())...
if
'conversion_kw'
not
in
kwargs
:
kwargs
[
'conversion_kw'
]
=
{
'encoding'
:
'utf-8'
}
# raise RuntimeError
return
DocumentConversionServerTransform
.
convert
(
self
,
*
args
,
**
kwargs
)
if
six
.
PY3
and
isinstance
(
orig
,
str
):
orig
=
orig
.
encode
()
return
DocumentConversionServerTransform
.
convert
(
self
,
orig
,
*
args
,
**
kwargs
)
def
register
():
return
TransformHtmlToPdf
()
\ No newline at end of file
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.SessionTool.py
View file @
1a895b06
...
...
@@ -34,8 +34,12 @@ from Products.ERP5Type.Tool.BaseTool import BaseTool
from
Products.ERP5Type
import
Permissions
from
Acquisition
import
aq_base
from
six.moves
import
UserDict
import
collections
import
six
if
six
.
PY3
:
import
collections.abc
as
collections_abc
else
:
import
collections
as
collections_abc
# the ERP5 cache factory used as a storage
SESSION_CACHE_FACTORY
=
'erp5_session_cache'
...
...
@@ -54,11 +58,11 @@ def remove_acquisition_wrapper(obj):
if
isinstance
(
obj
,
basestring
):
return
obj
obj
=
aq_base
(
obj
)
if
isinstance
(
obj
,
collections
.
Mapping
):
if
isinstance
(
obj
,
collections
_abc
.
Mapping
):
return
obj
.
__class__
({
remove_acquisition_wrapper
(
k
):
remove_acquisition_wrapper
(
v
)
for
k
,
v
in
obj
.
items
()})
if
isinstance
(
obj
,
(
collections
.
Sequence
,
collections
.
Set
)):
if
isinstance
(
obj
,
(
collections
_abc
.
Sequence
,
collections_abc
.
Set
)):
return
obj
.
__class__
([
remove_acquisition_wrapper
(
o
)
for
o
in
obj
])
return
obj
...
...
@@ -68,11 +72,11 @@ def restore_acquisition_wrapper(obj, context):
return
obj
if
hasattr
(
obj
,
'__of__'
):
obj
=
obj
.
__of__
(
context
)
if
isinstance
(
obj
,
collections
.
Mapping
):
if
isinstance
(
obj
,
collections
_abc
.
Mapping
):
return
obj
.
__class__
({
restore_acquisition_wrapper
(
k
,
context
):
restore_acquisition_wrapper
(
v
,
context
)
for
k
,
v
in
obj
.
items
()})
if
isinstance
(
obj
,
(
collections
.
Sequence
,
collections
.
Set
)):
if
isinstance
(
obj
,
(
collections
_abc
.
Sequence
,
collections_abc
.
Set
)):
return
obj
.
__class__
([
restore_acquisition_wrapper
(
o
,
context
)
for
o
in
obj
])
return
obj
...
...
product/ERP5Type/patches/diff.py
View file @
1a895b06
...
...
@@ -27,8 +27,13 @@
##############################################################################
import
warnings
from
collections
import
Mapping
from
collections
import
Iterable
import
six
if
six
.
PY3
:
from
collections.abc
import
Mapping
from
collections.abc
import
Iterable
else
:
from
collections
import
Mapping
from
collections
import
Iterable
try
:
from
deepdiff
import
DeepDiff
except
ImportError
:
...
...
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