Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Gambier
erp5
Commits
f766e714
Commit
f766e714
authored
Jun 28, 2019
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! Localizer: replace the 'Global Request' monkey-patch with zope.globalrequest
parent
cdaef829
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
product/CMFActivity/ActivityTool.py
product/CMFActivity/ActivityTool.py
+4
-2
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+6
-9
No files found.
product/CMFActivity/ActivityTool.py
View file @
f766e714
...
...
@@ -1464,7 +1464,7 @@ class ActivityTool (BaseTool):
def
invoke
(
self
,
message
):
if
self
.
activity_tracking
:
activity_tracking_logger
.
info
(
'invoking message: object_path=%s, method_id=%s, args=%r, kw=%r, activity_kw=%r, user_name=%s'
%
(
'/'
.
join
(
message
.
object_path
),
message
.
method_id
,
message
.
args
,
message
.
kw
,
message
.
activity_kw
,
message
.
user_name
))
old_request
=
Non
e
restore_request
=
Fals
e
if
getattr
(
self
,
'aq_chain'
,
None
)
is
not
None
:
# Grab existing acquisition chain and extrach base objects.
base_chain
=
[
aq_base
(
x
)
for
x
in
self
.
aq_chain
]
...
...
@@ -1501,6 +1501,7 @@ class ActivityTool (BaseTool):
if
'HTTP_ACCEPT_LANGUAGE'
in
request_info
:
new_request
.
environ
[
'HTTP_ACCEPT_LANGUAGE'
]
=
request_info
[
'HTTP_ACCEPT_LANGUAGE'
]
old_request
=
getRequest
()
restore_request
=
True
setRequest
(
new_request
)
new_request
.
processInputs
()
...
...
@@ -1520,7 +1521,8 @@ class ActivityTool (BaseTool):
# Restore default skin selection
skinnable
=
self
.
getPortalObject
()
skinnable
.
changeSkin
(
skinnable
.
getSkinNameFromRequest
(
request
))
setRequest
(
old_request
)
if
restore_request
:
setRequest
(
old_request
)
if
self
.
activity_tracking
:
activity_tracking_logger
.
info
(
'invoked message'
)
if
my_self
is
not
self
:
# We rewrapped self
...
...
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
f766e714
...
...
@@ -30,12 +30,9 @@ from ExtensionClass import pmc_init_of
from
DateTime
import
DateTime
# XXX make sure that get_request works.
import
Products.ERP5Type.Utils
from
Products.ERP5Type
import
Globals
# store a copy of the original method
original_get_request
=
Globals
.
get_request
convertToUpperCase
=
Products
.
ERP5Type
.
Utils
.
convertToUpperCase
from
new
import
function
from
zope.globalrequest
import
getRequest
original_get_request
=
function
(
getRequest
.
__code__
,
getRequest
.
__globals__
)
from
Testing.ZopeTestCase.connections
import
registry
def
get_context
():
...
...
@@ -50,8 +47,8 @@ def get_request():
if
current_app
is
not
None
:
return
current_app
.
REQUEST
Products
.
ERP5Type
.
Utils
.
get_request
=
get_request
Globals
.
get_request
=
get_request
sys
.
modules
[
getRequest
.
__module__
]
.
get_request
=
get_request
getRequest
.
__code__
=
(
lambda
:
get_request
()).
__code__
from
zope.site.hooks
import
setSite
...
...
@@ -62,7 +59,7 @@ from Products.PythonScripts.PythonScript import PythonScript
from
Products.ERP5Type.Accessor.Constant
import
PropertyGetter
as
ConstantGetter
from
Products.ERP5Form.PreferenceTool
import
Priority
from
zLOG
import
LOG
,
DEBUG
from
Products.ERP5Type.Utils
import
convertToUpperCase
from
Products.ERP5Type.tests.backportUnittest
import
SetupSiteError
from
Products.ERP5Type.tests.utils
import
addUserToDeveloperRole
from
Products.ERP5Type.tests.utils
import
DummyMailHostMixin
,
parseListeningAddress
...
...
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