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
139
Merge Requests
139
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
1b2c272c
Commit
1b2c272c
authored
Mar 19, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*: use base64 encodebytes for python3.9
parent
cc6b5c58
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
41 additions
and
41 deletions
+41
-41
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCookieCrumbler.py
...ateItem/portal_components/test.erp5.testCookieCrumbler.py
+2
-2
bt5/erp5_dms/ExtensionTemplateItem/portal_components/extension.erp5.DocumentManagement.py
...em/portal_components/extension.erp5.DocumentManagement.py
+3
-3
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_getTempImageList.py
...rtal_skins/erp5_document_scanner/Base_getTempImageList.py
+2
-2
bt5/erp5_oauth2_authorisation/TestTemplateItem/portal_components/test.erp5.testOAuth2Server.py
...plateItem/portal_components/test.erp5.testOAuth2Server.py
+1
-1
bt5/erp5_oauth2_resource/DocumentTemplateItem/portal_components/document.erp5.OAuth2AuthorisationClientConnector.py
...nents/document.erp5.OAuth2AuthorisationClientConnector.py
+1
-1
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_common/StaticWebSite_getRedirectSourceUrlForOfficeJSApplication.py
...aticWebSite_getRedirectSourceUrlForOfficeJSApplication.py
+1
-1
bt5/erp5_payzen_secure_payment/DocumentTemplateItem/portal_components/document.erp5.PayzenService.py
...lateItem/portal_components/document.erp5.PayzenService.py
+1
-1
bt5/erp5_smart_assistant/SkinTemplateItem/portal_skins/erp5_smart_assistant/Query_createExpenseRecord.py
...l_skins/erp5_smart_assistant/Query_createExpenseRecord.py
+1
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_formatAttachmentListToMIMEMultipartString.py
...rp5_web/Base_formatAttachmentListToMIMEMultipartString.py
+1
-1
bt5/erp5_web_shacache/TestTemplateItem/portal_components/test.erp5.ShaCacheMixin.py
...TemplateItem/portal_components/test.erp5.ShaCacheMixin.py
+1
-1
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheExternal.py
...eItem/portal_components/test.erp5.testShaCacheExternal.py
+1
-1
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirExternal.py
...ateItem/portal_components/test.erp5.testShaDirExternal.py
+1
-1
erp5/util/testbrowser/examples/createERP5User.py
erp5/util/testbrowser/examples/createERP5User.py
+1
-1
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+2
-2
product/ERP5/bin/bigfile_client_example.py
product/ERP5/bin/bigfile_client_example.py
+1
-1
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.Document.py
...tTemplateItem/portal_components/document.erp5.Document.py
+2
-2
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.BaseExtensibleTraversableMixin.py
...l_components/mixin.erp5.BaseExtensibleTraversableMixin.py
+2
-2
product/ERP5/tests/erp5_url_checker.py
product/ERP5/tests/erp5_url_checker.py
+1
-1
product/ERP5Security/ERP5KeyAuthPlugin.py
product/ERP5Security/ERP5KeyAuthPlugin.py
+3
-3
product/ERP5Security/__init__.py
product/ERP5Security/__init__.py
+2
-2
product/ERP5Type/CachePlugins/DistributedRamCache.py
product/ERP5Type/CachePlugins/DistributedRamCache.py
+1
-1
product/ERP5Type/XMLExportImport/__init__.py
product/ERP5Type/XMLExportImport/__init__.py
+3
-3
product/ERP5Type/XMLExportImport/ppml.py
product/ERP5Type/XMLExportImport/ppml.py
+6
-6
product/ERP5Type/patches/CookieCrumbler.py
product/ERP5Type/patches/CookieCrumbler.py
+1
-1
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCookieCrumbler.py
View file @
1b2c272c
...
@@ -73,7 +73,7 @@ class ERP5CookieCrumblerTests (CookieCrumblerTests):
...
@@ -73,7 +73,7 @@ class ERP5CookieCrumblerTests (CookieCrumblerTests):
self
.
req
=
makerequest
(
root
,
self
.
responseOut
)
self
.
req
=
makerequest
(
root
,
self
.
responseOut
)
self
.
credentials
=
quote
(
self
.
credentials
=
quote
(
base64
.
encode
string
(
'abraham:pass-w'
).
replace
(
'
\
012
'
,
''
))
base64
.
encode
bytes
(
'abraham:pass-w'
).
replace
(
'
\
012
'
,
''
))
def
testCookieLongLogin
(
self
):
def
testCookieLongLogin
(
self
):
# verify the user and auth cookie get set
# verify the user and auth cookie get set
...
@@ -88,7 +88,7 @@ class ERP5CookieCrumblerTests (CookieCrumblerTests):
...
@@ -88,7 +88,7 @@ class ERP5CookieCrumblerTests (CookieCrumblerTests):
'abrahammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm'
)
'abrahammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm'
)
resp
=
self
.
req
.
response
resp
=
self
.
req
.
response
self
.
assertIn
(
'__ac'
,
resp
.
cookies
)
self
.
assertIn
(
'__ac'
,
resp
.
cookies
)
self
.
credentials
=
base64
.
encode
string
(
'%s:%s'
%
(
long_name
,
long_pass
)).
replace
(
'
\
012
'
,
''
)
self
.
credentials
=
base64
.
encode
bytes
(
'%s:%s'
%
(
long_name
,
long_pass
)).
replace
(
'
\
012
'
,
''
)
self
.
assertEqual
(
resp
.
cookies
[
'__ac'
][
'value'
],
self
.
assertEqual
(
resp
.
cookies
[
'__ac'
][
'value'
],
self
.
credentials
)
self
.
credentials
)
self
.
assertEqual
(
resp
.
cookies
[
'__ac'
][
normalizeCookieParameterName
(
'path'
)],
'/'
)
self
.
assertEqual
(
resp
.
cookies
[
'__ac'
][
normalizeCookieParameterName
(
'path'
)],
'/'
)
...
...
bt5/erp5_dms/ExtensionTemplateItem/portal_components/extension.erp5.DocumentManagement.py
View file @
1b2c272c
...
@@ -58,8 +58,8 @@ def convertToOdf(self, name, data):
...
@@ -58,8 +58,8 @@ def convertToOdf(self, name, data):
to work with (and we for example have to figure out portal_type)
to work with (and we for example have to figure out portal_type)
"""
"""
sp
=
mkProxy
(
self
)
sp
=
mkProxy
(
self
)
kw
=
sp
.
run_convert
(
name
,
base64
.
encode
string
(
data
))
kw
=
sp
.
run_convert
(
name
,
base64
.
encode
bytes
(
data
))
odf
=
base64
.
decode
string
(
kw
[
'data'
])
odf
=
base64
.
decode
bytes
(
kw
[
'data'
])
return
odf
return
odf
def
mkProxy
(
self
):
def
mkProxy
(
self
):
...
@@ -74,7 +74,7 @@ def mkProxy(self):
...
@@ -74,7 +74,7 @@ def mkProxy(self):
def
generateFile
(
self
,
name
,
data
,
format
):
# pylint: disable=redefined-builtin
def
generateFile
(
self
,
name
,
data
,
format
):
# pylint: disable=redefined-builtin
sp
=
mkProxy
(
self
)
sp
=
mkProxy
(
self
)
kw
=
sp
.
run_generate
(
name
,
data
,
None
,
format
)
kw
=
sp
.
run_generate
(
name
,
data
,
None
,
format
)
res
=
base64
.
decode
string
(
kw
[
'data'
])
res
=
base64
.
decode
bytes
(
kw
[
'data'
])
return
res
return
res
def
getAttrFromFilename
(
self
,
fname
):
def
getAttrFromFilename
(
self
,
fname
):
...
...
bt5/erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/Base_getTempImageList.py
View file @
1b2c272c
"""
"""
Proxy role as Manager is required here to access getResultList
Proxy role as Manager is required here to access getResultList
"""
"""
from
base64
import
decode
string
from
base64
import
decode
bytes
if
REQUEST
:
if
REQUEST
:
return
RuntimeError
(
"You cannot run this script in the url"
)
return
RuntimeError
(
"You cannot run this script in the url"
)
...
@@ -11,7 +11,7 @@ pdf_data_list = []
...
@@ -11,7 +11,7 @@ pdf_data_list = []
for
result
in
active_process
.
getResultList
():
for
result
in
active_process
.
getResultList
():
if
result
.
reference
in
image_list
:
if
result
.
reference
in
image_list
:
pdf_data_list
.
append
(
pdf_data_list
.
append
(
image_module
.
newContent
(
data
=
decode
string
(
result
.
detail
),
image_module
.
newContent
(
data
=
decode
bytes
(
result
.
detail
),
portal_type
=
"Image"
,
portal_type
=
"Image"
,
temp_object
=
True
).
convert
(
format
=
"pdf"
)[
1
])
temp_object
=
True
).
convert
(
format
=
"pdf"
)[
1
])
...
...
bt5/erp5_oauth2_authorisation/TestTemplateItem/portal_components/test.erp5.testOAuth2Server.py
View file @
1b2c272c
...
@@ -782,7 +782,7 @@ class TestOAuth2(ERP5TypeTestCase):
...
@@ -782,7 +782,7 @@ class TestOAuth2(ERP5TypeTestCase):
"""
"""
Get a token, renew it, terminate session.
Get a token, renew it, terminate session.
"""
"""
basic_auth
=
'Basic '
+
bytes2str
(
base64
.
encode
string
(
basic_auth
=
'Basic '
+
bytes2str
(
base64
.
encode
bytes
(
str2bytes
(
_TEST_USER_LOGIN
+
':'
+
self
.
__password
),
str2bytes
(
_TEST_USER_LOGIN
+
':'
+
self
.
__password
),
)).
rstrip
()
)).
rstrip
()
oauth2_server_connector
=
self
.
__oauth2_server_connector_value
.
getPath
()
oauth2_server_connector
=
self
.
__oauth2_server_connector_value
.
getPath
()
...
...
bt5/erp5_oauth2_resource/DocumentTemplateItem/portal_components/document.erp5.OAuth2AuthorisationClientConnector.py
View file @
1b2c272c
...
@@ -157,7 +157,7 @@ class _SimpleHTTPRequest(object):
...
@@ -157,7 +157,7 @@ class _SimpleHTTPRequest(object):
def
_authUserPW
(
self
):
def
_authUserPW
(
self
):
if
self
.
_auth
.
lower
().
startswith
(
'basic '
):
if
self
.
_auth
.
lower
().
startswith
(
'basic '
):
return
bytes2str
(
base64
.
decode
string
(
return
bytes2str
(
base64
.
decode
bytes
(
self
.
_auth
.
split
(
None
,
1
)[
1
],
self
.
_auth
.
split
(
None
,
1
)[
1
],
)).
split
(
':'
,
1
)
)).
split
(
':'
,
1
)
...
...
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_common/StaticWebSite_getRedirectSourceUrlForOfficeJSApplication.py
View file @
1b2c272c
...
@@ -20,7 +20,7 @@ except KeyError:
...
@@ -20,7 +20,7 @@ except KeyError:
try
:
try
:
encoded
=
name
.
replace
(
"definition_view/"
,
""
,
1
)
encoded
=
name
.
replace
(
"definition_view/"
,
""
,
1
)
name
=
base64
.
decode
string
(
encoded
)
name
=
base64
.
decode
bytes
(
encoded
)
base_64
=
True
base_64
=
True
except
binascii
.
Error
:
except
binascii
.
Error
:
pass
pass
...
...
bt5/erp5_payzen_secure_payment/DocumentTemplateItem/portal_components/document.erp5.PayzenService.py
View file @
1b2c272c
...
@@ -54,7 +54,7 @@ class PayzenREST:
...
@@ -54,7 +54,7 @@ class PayzenREST:
"""
"""
def
callPayzenApi
(
self
,
URL
,
payzen_dict
):
def
callPayzenApi
(
self
,
URL
,
payzen_dict
):
base64string
=
base64
.
encode
string
(
base64string
=
base64
.
encode
bytes
(
'%s:%s'
%
(
'%s:%s'
%
(
self
.
getServiceUsername
(),
self
.
getServiceUsername
(),
self
.
getServiceApiKey
())).
replace
(
'
\
n
'
,
''
)
self
.
getServiceApiKey
())).
replace
(
'
\
n
'
,
''
)
...
...
bt5/erp5_smart_assistant/SkinTemplateItem/portal_skins/erp5_smart_assistant/Query_createExpenseRecord.py
View file @
1b2c272c
...
@@ -3,7 +3,7 @@ portal = context.getPortalObject()
...
@@ -3,7 +3,7 @@ portal = context.getPortalObject()
expense_record_module
=
portal
.
getDefaultModule
(
'Expense Record'
)
expense_record_module
=
portal
.
getDefaultModule
(
'Expense Record'
)
sender
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
sender
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
data
=
context
.
getData
()
data
=
context
.
getData
()
data64
=
u''
.
join
(
base64
.
encode
string
(
data
).
splitlines
())
data64
=
u''
.
join
(
base64
.
encode
bytes
(
data
).
splitlines
())
photo_data
=
u'data:%s;base64,%s'
%
(
"image/*"
,
data64
)
photo_data
=
u'data:%s;base64,%s'
%
(
"image/*"
,
data64
)
expense_record_module
.
newContent
(
expense_record_module
.
newContent
(
comment
=
comment
,
comment
=
comment
,
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_formatAttachmentListToMIMEMultipartString.py
View file @
1b2c272c
...
@@ -36,7 +36,7 @@ To send specific encoded data, please make your attachment dict look like:
...
@@ -36,7 +36,7 @@ To send specific encoded data, please make your attachment dict look like:
"mime_type": "text/html",
"mime_type": "text/html",
"encode": "noop",
"encode": "noop",
"add_header_list": [("Content-Transfer-Encoding", "my-encoding")],
"add_header_list": [("Content-Transfer-Encoding", "my-encoding")],
"data": encode
string
(html_data),
"data": encode
bytes
(html_data),
}
}
"""
"""
...
...
bt5/erp5_web_shacache/TestTemplateItem/portal_components/test.erp5.ShaCacheMixin.py
View file @
1b2c272c
...
@@ -48,7 +48,7 @@ class ShaCacheMixin(object):
...
@@ -48,7 +48,7 @@ class ShaCacheMixin(object):
self
.
shacache
.
publish
()
self
.
shacache
.
publish
()
self
.
header_dict
=
{
self
.
header_dict
=
{
'Content-Type'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
'Authorization'
:
'Basic %s'
%
(
base64
.
encode
string
(
'ERP5TypeTestCase:'
).
strip
())
'Authorization'
:
'Basic %s'
%
(
base64
.
encode
bytes
(
'ERP5TypeTestCase:'
).
strip
())
}
}
self
.
shacache_url
=
self
.
shacache
.
absolute_url
()
self
.
shacache_url
=
self
.
shacache
.
absolute_url
()
self
.
tic
()
self
.
tic
()
...
...
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheExternal.py
View file @
1b2c272c
...
@@ -60,7 +60,7 @@ class TestShaCacheExternal(ShaCacheMixin, ShaSecurityMixin, ERP5TypeTestCase):
...
@@ -60,7 +60,7 @@ class TestShaCacheExternal(ShaCacheMixin, ShaSecurityMixin, ERP5TypeTestCase):
# Define POST headers with Authentication
# Define POST headers with Authentication
self
.
content_type
=
'application/json'
self
.
content_type
=
'application/json'
authentication_string
=
'lucas:lucas'
authentication_string
=
'lucas:lucas'
base64string
=
base64
.
encode
string
(
authentication_string
).
strip
()
base64string
=
base64
.
encode
bytes
(
authentication_string
).
strip
()
self
.
header_dict
=
{
'Authorization'
:
'Basic %s'
%
base64string
,
self
.
header_dict
=
{
'Authorization'
:
'Basic %s'
%
base64string
,
'Content-Type'
:
self
.
content_type
}
'Content-Type'
:
self
.
content_type
}
...
...
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirExternal.py
View file @
1b2c272c
...
@@ -61,7 +61,7 @@ class TestShaDirExternal(ShaDirMixin, ShaSecurityMixin, ERP5TypeTestCase):
...
@@ -61,7 +61,7 @@ class TestShaDirExternal(ShaDirMixin, ShaSecurityMixin, ERP5TypeTestCase):
# Define POST headers with Authentication
# Define POST headers with Authentication
self
.
content_type
=
'application/json'
self
.
content_type
=
'application/json'
authentication_string
=
'lucas:lucas'
authentication_string
=
'lucas:lucas'
base64string
=
base64
.
encode
string
(
authentication_string
).
strip
()
base64string
=
base64
.
encode
bytes
(
authentication_string
).
strip
()
self
.
header_dict
=
{
'Authorization'
:
'Basic %s'
%
base64string
,
self
.
header_dict
=
{
'Authorization'
:
'Basic %s'
%
base64string
,
'Content-Type'
:
self
.
content_type
}
'Content-Type'
:
self
.
content_type
}
...
...
erp5/util/testbrowser/examples/createERP5User.py
View file @
1b2c272c
...
@@ -45,7 +45,7 @@ zope_url = url.rsplit('/', 2)[0]
...
@@ -45,7 +45,7 @@ zope_url = url.rsplit('/', 2)[0]
import
base64
import
base64
browser
.
mech_browser
.
addheaders
.
append
(
browser
.
mech_browser
.
addheaders
.
append
(
(
'Authorization'
,
(
'Authorization'
,
'Basic %s'
%
base64
.
encode
string
(
'%s:%s'
%
(
username
,
password
))))
'Basic %s'
%
base64
.
encode
bytes
(
'%s:%s'
%
(
username
,
password
))))
for
index
in
range
(
user_nbr
):
for
index
in
range
(
user_nbr
):
new_username
=
"%s%d"
%
(
new_username_prefix
,
index
)
new_username
=
"%s%d"
%
(
new_username_prefix
,
index
)
...
...
product/ERP5/Tool/TemplateTool.py
View file @
1b2c272c
...
@@ -64,7 +64,7 @@ import struct
...
@@ -64,7 +64,7 @@ import struct
from
base64
import
b64encode
,
b64decode
from
base64
import
b64encode
,
b64decode
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
from
zLOG
import
LOG
,
INFO
,
WARNING
from
zLOG
import
LOG
,
INFO
,
WARNING
from
base64
import
decode
string
from
base64
import
decode
bytes
import
subprocess
import
subprocess
import
time
import
time
from
Products.ERP5Type.Utils
import
bytes2str
,
str2bytes
,
unicode2str
from
Products.ERP5Type.Utils
import
bytes2str
,
str2bytes
,
unicode2str
...
@@ -410,7 +410,7 @@ class TemplateTool (BaseTool):
...
@@ -410,7 +410,7 @@ class TemplateTool (BaseTool):
"""
"""
Import Business Template from passed base64 encoded text.
Import Business Template from passed base64 encoded text.
"""
"""
import_file = StringIO(decode
string
(file_data))
import_file = StringIO(decode
bytes
(file_data))
return self.importFile(import_file = import_file, id = id, REQUEST = REQUEST,
return self.importFile(import_file = import_file, id = id, REQUEST = REQUEST,
batch_mode = batch_mode, **kw)
batch_mode = batch_mode, **kw)
...
...
product/ERP5/bin/bigfile_client_example.py
View file @
1b2c272c
...
@@ -4,7 +4,7 @@ import six.moves.http_client
...
@@ -4,7 +4,7 @@ import six.moves.http_client
connection
=
six
.
moves
.
http_client
.
HTTPConnection
(
'192.168.242.68:12001'
)
connection
=
six
.
moves
.
http_client
.
HTTPConnection
(
'192.168.242.68:12001'
)
import
base64
import
base64
base64string
=
base64
.
encode
string
(
'zope:insecure'
)[:
-
1
]
base64string
=
base64
.
encode
bytes
(
'zope:insecure'
)[:
-
1
]
n
=
1
<<
20
n
=
1
<<
20
...
...
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.Document.py
View file @
1b2c272c
...
@@ -84,8 +84,8 @@ class NotConvertedError(Exception):pass
...
@@ -84,8 +84,8 @@ class NotConvertedError(Exception):pass
allow_class
(
NotConvertedError
)
allow_class
(
NotConvertedError
)
import
base64
import
base64
enc
=
base64
.
encode
string
enc
=
base64
.
encode
bytes
dec
=
base64
.
decode
string
dec
=
base64
.
decode
bytes
DOCUMENT_CONVERSION_SERVER_PROXY_TIMEOUT
=
360
DOCUMENT_CONVERSION_SERVER_PROXY_TIMEOUT
=
360
DOCUMENT_CONVERSION_SERVER_RETRY
=
0
DOCUMENT_CONVERSION_SERVER_RETRY
=
0
# store time (as int) where we had last failure in order
# store time (as int) where we had last failure in order
...
...
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.BaseExtensibleTraversableMixin.py
View file @
1b2c272c
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
##############################################################################
##############################################################################
from
warnings
import
warn
from
warnings
import
warn
from
base64
import
decode
string
from
base64
import
decode
bytes
from
zLOG
import
LOG
from
zLOG
import
LOG
from
AccessControl
import
ClassSecurityInfo
,
getSecurityManager
from
AccessControl
import
ClassSecurityInfo
,
getSecurityManager
...
@@ -106,7 +106,7 @@ class BaseExtensibleTraversableMixin(ExtensibleTraversableMixin):
...
@@ -106,7 +106,7 @@ class BaseExtensibleTraversableMixin(ExtensibleTraversableMixin):
# this logic is copied from identify() in
# this logic is copied from identify() in
# AccessControl.User.BasicUserFolder.
# AccessControl.User.BasicUserFolder.
if
auth
and
auth
.
lower
().
startswith
(
'basic '
):
if
auth
and
auth
.
lower
().
startswith
(
'basic '
):
name
=
decode
string
(
auth
.
split
(
' '
)[
-
1
]).
split
(
':'
,
1
)[
0
]
name
=
decode
bytes
(
auth
.
split
(
' '
)[
-
1
]).
split
(
':'
,
1
)[
0
]
if
name
is
not
None
:
if
name
is
not
None
:
user
=
portal_membership
.
_huntUser
(
name
,
self
)
user
=
portal_membership
.
_huntUser
(
name
,
self
)
else
:
else
:
...
...
product/ERP5/tests/erp5_url_checker.py
View file @
1b2c272c
...
@@ -99,7 +99,7 @@ class URLOpener(FancyURLopener):
...
@@ -99,7 +99,7 @@ class URLOpener(FancyURLopener):
if
not
host
:
raise
IOError
(
'http error'
,
'no host given'
)
if
not
host
:
raise
IOError
(
'http error'
,
'no host given'
)
if
user_passwd
:
if
user_passwd
:
import
base64
import
base64
auth
=
base64
.
encode
string
(
user_passwd
).
strip
()
auth
=
base64
.
encode
bytes
(
user_passwd
).
strip
()
else
:
else
:
auth
=
None
auth
=
None
h
=
six
.
moves
.
http_client
.
HTTP
(
host
)
h
=
six
.
moves
.
http_client
.
HTTP
(
host
)
...
...
product/ERP5Security/ERP5KeyAuthPlugin.py
View file @
1b2c272c
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#
#
##############################################################################
##############################################################################
from
base64
import
encode
string
,
decodestring
from
base64
import
encode
bytes
,
decodebytes
from
six.moves.urllib.parse
import
quote
,
unquote
from
six.moves.urllib.parse
import
quote
,
unquote
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
zLOG
import
LOG
,
PROBLEM
from
zLOG
import
LOG
,
PROBLEM
...
@@ -270,7 +270,7 @@ class ERP5KeyAuthPlugin(ERP5UserManager, CookieAuthHelper):
...
@@ -270,7 +270,7 @@ class ERP5KeyAuthPlugin(ERP5UserManager, CookieAuthHelper):
default_cookie
=
request
.
get
(
self
.
default_cookie_name
,
None
)
default_cookie
=
request
.
get
(
self
.
default_cookie_name
,
None
)
if
default_cookie
is
not
None
:
if
default_cookie
is
not
None
:
#Cookie is found
#Cookie is found
cookie_val
=
decode
string
(
unquote
(
default_cookie
))
cookie_val
=
decode
bytes
(
unquote
(
default_cookie
))
if
cookie_val
is
not
None
:
if
cookie_val
is
not
None
:
login
,
password
=
cookie_val
.
split
(
':'
)
login
,
password
=
cookie_val
.
split
(
':'
)
creds
[
'login'
]
=
login
creds
[
'login'
]
=
login
...
@@ -305,7 +305,7 @@ class ERP5KeyAuthPlugin(ERP5UserManager, CookieAuthHelper):
...
@@ -305,7 +305,7 @@ class ERP5KeyAuthPlugin(ERP5UserManager, CookieAuthHelper):
response
.
setCookie
(
self
.
cookie_name
,
quote
(
cookie_val
),
path
=
'/'
)
#, expires=expires)
response
.
setCookie
(
self
.
cookie_name
,
quote
(
cookie_val
),
path
=
'/'
)
#, expires=expires)
response
.
expireCookie
(
self
.
default_cookie_name
,
path
=
'/'
)
response
.
expireCookie
(
self
.
default_cookie_name
,
path
=
'/'
)
elif
login
is
not
None
and
new_password
is
not
None
:
elif
login
is
not
None
and
new_password
is
not
None
:
cookie_val
=
encode
string
(
'%s:%s'
%
(
login
,
new_password
))
cookie_val
=
encode
bytes
(
'%s:%s'
%
(
login
,
new_password
))
cookie_val
=
cookie_val
.
rstrip
()
cookie_val
=
cookie_val
.
rstrip
()
response
.
setCookie
(
self
.
default_cookie_name
,
quote
(
cookie_val
),
path
=
'/'
)
response
.
setCookie
(
self
.
default_cookie_name
,
quote
(
cookie_val
),
path
=
'/'
)
response
.
expireCookie
(
self
.
cookie_name
,
path
=
'/'
)
response
.
expireCookie
(
self
.
cookie_name
,
path
=
'/'
)
...
...
product/ERP5Security/__init__.py
View file @
1b2c272c
...
@@ -18,7 +18,7 @@ from __future__ import absolute_import
...
@@ -18,7 +18,7 @@ from __future__ import absolute_import
from
copy
import
deepcopy
from
copy
import
deepcopy
from
collections
import
defaultdict
from
collections
import
defaultdict
from
base64
import
encode
string
from
base64
import
encode
bytes
from
Acquisition
import
aq_inner
,
aq_parent
from
Acquisition
import
aq_inner
,
aq_parent
from
AccessControl.Permissions
import
manage_users
as
ManageUsers
from
AccessControl.Permissions
import
manage_users
as
ManageUsers
...
@@ -77,7 +77,7 @@ if IS_ZOPE2: # BBB
...
@@ -77,7 +77,7 @@ if IS_ZOPE2: # BBB
except
AttributeError
:
except
AttributeError
:
pass
pass
else
:
else
:
medusa_headers
[
'authorization'
]
=
'Basic %s'
%
encode
string
(
'%s:'
%
username
).
rstrip
()
medusa_headers
[
'authorization'
]
=
'Basic %s'
%
encode
bytes
(
'%s:'
%
username
).
rstrip
()
else
:
else
:
REQUEST
.
_orig_env
[
'REMOTE_USER'
]
=
username
REQUEST
.
_orig_env
[
'REMOTE_USER'
]
=
username
else
:
# zope4
else
:
# zope4
...
...
product/ERP5Type/CachePlugins/DistributedRamCache.py
View file @
1b2c272c
...
@@ -37,7 +37,7 @@ from .BaseCache import BaseCache
...
@@ -37,7 +37,7 @@ from .BaseCache import BaseCache
from
.BaseCache
import
CacheEntry
from
.BaseCache
import
CacheEntry
from
Products.ERP5Type
import
interfaces
from
Products.ERP5Type
import
interfaces
import
zope.interface
import
zope.interface
from
base64
import
encode
string
from
base64
import
encode
bytes
try
:
try
:
from
Products.ERP5Type.Tool.MemcachedTool
import
MemcachedDict
,
SharedDict
from
Products.ERP5Type.Tool.MemcachedTool
import
MemcachedDict
,
SharedDict
...
...
product/ERP5Type/XMLExportImport/__init__.py
View file @
1b2c272c
...
@@ -233,7 +233,7 @@ def Folder_asXML(object, omit_xml_declaration=True, root=None):
...
@@ -233,7 +233,7 @@ def Folder_asXML(object, omit_xml_declaration=True, root=None):
## The code below was initially from OFS.XMLExportImport
## The code below was initially from OFS.XMLExportImport
from
six
import
string_types
as
basestring
from
six
import
string_types
as
basestring
from
base64
import
encode
string
from
base64
import
encode
bytes
from
ZODB.serialize
import
referencesf
from
ZODB.serialize
import
referencesf
from
ZODB.ExportImport
import
TemporaryFile
,
export_end_marker
from
ZODB.ExportImport
import
TemporaryFile
,
export_end_marker
from
ZODB.utils
import
p64
from
ZODB.utils
import
p64
...
@@ -293,8 +293,8 @@ def reorderPickle(jar, p):
...
@@ -293,8 +293,8 @@ def reorderPickle(jar, p):
def
_mapOid
(
id_mapping
,
oid
):
def
_mapOid
(
id_mapping
,
oid
):
idprefix
=
str
(
u64
(
oid
))
idprefix
=
str
(
u64
(
oid
))
id
=
id_mapping
[
idprefix
]
id
=
id_mapping
[
idprefix
]
old_aka
=
encode
string
(
oid
)[:
-
1
]
old_aka
=
encode
bytes
(
oid
)[:
-
1
]
aka
=
encode
string
(
p64
(
long_
(
id
)))[:
-
1
]
# Rebuild oid based on mapped id
aka
=
encode
bytes
(
p64
(
long_
(
id
)))[:
-
1
]
# Rebuild oid based on mapped id
id_mapping
.
setConvertedAka
(
old_aka
,
aka
)
id_mapping
.
setConvertedAka
(
old_aka
,
aka
)
return
idprefix
+
'.'
,
id
,
aka
return
idprefix
+
'.'
,
id
,
aka
...
...
product/ERP5Type/XMLExportImport/ppml.py
View file @
1b2c272c
...
@@ -42,7 +42,7 @@ else:
...
@@ -42,7 +42,7 @@ else:
def
escape
(
s
,
encoding
=
'repr'
):
def
escape
(
s
,
encoding
=
'repr'
):
if
binary
(
s
)
and
isinstance
(
s
,
str
):
if
binary
(
s
)
and
isinstance
(
s
,
str
):
s
=
base64
.
encode
string
(
s
)[:
-
1
]
s
=
base64
.
encode
bytes
(
s
)[:
-
1
]
encoding
=
'base64'
encoding
=
'base64'
elif
'>'
in
s
or
'<'
in
s
or
'&'
in
s
:
elif
'>'
in
s
or
'<'
in
s
or
'&'
in
s
:
if
not
']]>'
in
s
:
if
not
']]>'
in
s
:
...
@@ -56,7 +56,7 @@ def escape(s, encoding='repr'):
...
@@ -56,7 +56,7 @@ def escape(s, encoding='repr'):
def
unescape
(
s
,
encoding
):
def
unescape
(
s
,
encoding
):
if
encoding
==
'base64'
:
if
encoding
==
'base64'
:
return
base64
.
decode
string
(
s
)
return
base64
.
decode
bytes
(
s
)
else
:
else
:
s
=
s
.
replace
(
b'<'
,
b'<'
)
s
=
s
.
replace
(
b'<'
,
b'<'
)
s
=
s
.
replace
(
b'>'
,
b'>'
)
s
=
s
.
replace
(
b'>'
,
b'>'
)
...
@@ -92,12 +92,12 @@ def convert(S):
...
@@ -92,12 +92,12 @@ def convert(S):
if
not
isinstance
(
S
,
six
.
text_type
):
if
not
isinstance
(
S
,
six
.
text_type
):
S
.
decode
(
'utf8'
)
S
.
decode
(
'utf8'
)
except
UnicodeDecodeError
:
except
UnicodeDecodeError
:
return
'base64'
,
base64
.
encode
string
(
S
)[:
-
1
]
return
'base64'
,
base64
.
encode
bytes
(
S
)[:
-
1
]
else
:
else
:
new
=
reprs_re
.
sub
(
sub_reprs
,
S
)
new
=
reprs_re
.
sub
(
sub_reprs
,
S
)
### patch end
### patch end
if
len
(
new
)
>
(
1.4
*
len
(
S
)):
if
len
(
new
)
>
(
1.4
*
len
(
S
)):
return
'base64'
,
base64
.
encode
string
(
S
)[:
-
1
]
return
'base64'
,
base64
.
encode
bytes
(
S
)[:
-
1
]
elif
'>'
in
new
or
'<'
in
S
or
'&'
in
S
:
elif
'>'
in
new
or
'<'
in
S
or
'&'
in
S
:
if
not
']]>'
in
S
:
if
not
']]>'
in
S
:
return
'cdata'
,
'<![CDATA[
\
n
\
n
'
+
new
+
'
\
n
\
n
]]>'
return
'cdata'
,
'<![CDATA[
\
n
\
n
'
+
new
+
'
\
n
\
n
]]>'
...
@@ -108,7 +108,7 @@ def convert(S):
...
@@ -108,7 +108,7 @@ def convert(S):
# For optimization.
# For optimization.
def
unconvert
(
encoding
,
S
):
def
unconvert
(
encoding
,
S
):
if
encoding
==
'base64'
:
if
encoding
==
'base64'
:
return
base64
.
decode
string
(
S
)
return
base64
.
decode
bytes
(
S
)
else
:
else
:
return
str2bytes
(
eval
(
b"'"
+
S
.
replace
(
b'
\
n
'
,
b''
)
+
b"'"
))
return
str2bytes
(
eval
(
b"'"
+
S
.
replace
(
b'
\
n
'
,
b''
)
+
b"'"
))
...
@@ -173,7 +173,7 @@ class String(Scalar):
...
@@ -173,7 +173,7 @@ class String(Scalar):
# This is used when strings represent references which need to
# This is used when strings represent references which need to
# be converted.
# be converted.
encoding
=
'base64'
encoding
=
'base64'
v
=
base64
.
encode
string
(
self
.
_v
)[:
-
1
]
v
=
base64
.
encode
bytes
(
self
.
_v
)[:
-
1
]
self
.
_v
=
self
.
mapping
.
convertBase64
(
v
)
self
.
_v
=
self
.
mapping
.
convertBase64
(
v
)
else
:
else
:
encoding
,
self
.
_v
=
convert
(
self
.
_v
)
encoding
,
self
.
_v
=
convert
(
self
.
_v
)
...
...
product/ERP5Type/patches/CookieCrumbler.py
View file @
1b2c272c
...
@@ -192,7 +192,7 @@ def credentialsChanged(self, user, name, pw, request=None):
...
@@ -192,7 +192,7 @@ def credentialsChanged(self, user, name, pw, request=None):
reponse
=
request
[
'RESPONSE'
]
reponse
=
request
[
'RESPONSE'
]
# <patch>
# <patch>
# We don't want new lines, so use base64.standard_b64encode instead of
# We don't want new lines, so use base64.standard_b64encode instead of
# base64.encode
string
# base64.encode
bytes
ac
=
standard_b64encode
(
'%s:%s'
%
(
name
,
pw
)).
rstrip
()
ac
=
standard_b64encode
(
'%s:%s'
%
(
name
,
pw
)).
rstrip
()
# </patch>
# </patch>
method
=
self
.
getCookieMethod
(
'setAuthCookie'
,
method
=
self
.
getCookieMethod
(
'setAuthCookie'
,
...
...
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