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
138
Merge Requests
138
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
afa4a185
Commit
afa4a185
authored
Mar 02, 2023
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zope4: ZServer removal: Remove Publisher monkey patches.
parent
e74de444
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
467 deletions
+6
-467
product/ERP5Type/ZopePatch.py
product/ERP5Type/ZopePatch.py
+0
-3
product/ERP5Type/patches/Publish.py
product/ERP5Type/patches/Publish.py
+0
-405
product/Localizer/__init__.py
product/Localizer/__init__.py
+1
-1
product/Localizer/patches.py
product/Localizer/patches.py
+3
-53
product/Localizer/utils.py
product/Localizer/utils.py
+2
-5
No files found.
product/ERP5Type/ZopePatch.py
View file @
afa4a185
...
...
@@ -94,9 +94,6 @@ from Products.ERP5Type.patches import OFSFile
from
Products.ERP5Type.patches
import
ZSQLMethod
from
Products.ERP5Type.patches
import
MimetypesRegistry
from
Products.ERP5Type.patches
import
users
if
six
.
PY2
:
# No ZServer
from
Products.ERP5Type.patches
import
Publish
from
Products.ERP5Type.patches
import
WSGITask
if
six
.
PY2
:
# XXX-zope4py3: urllib2 removed (see future/backports/urllib/request.py)
...
...
product/ERP5Type/patches/Publish.py
deleted
100644 → 0
View file @
e74de444
This diff is collapsed.
Click to expand it.
product/Localizer/__init__.py
View file @
afa4a185
...
...
@@ -25,7 +25,7 @@ from DocumentTemplate.DT_String import String
# Import from Localizer
import
six
if
six
.
PY2
:
from
.
patches
import
get_request
from
.
import
patches
as
_
from
.
import
Localizer
,
MessageCatalog
from
.LocalFiles
import
LocalDTMLFile
...
...
product/Localizer/patches.py
View file @
afa4a185
...
...
@@ -18,65 +18,15 @@
This is a hotfix, it dynamically applies several patches to Zope.
"""
# Import from the Standard Library
import
logging
import
os
import
six
# Import from itools
from
.itools.i18n
import
AcceptLanguageType
# Import from Zope
from
ZPublisher.HTTPRequest
import
HTTPRequest
from
zope.globalrequest
import
clearRequest
,
setRequest
from
zope.globalrequest
import
getRequest
as
get_request
# Flag
patch
=
False
Z_DEBUG_MODE
=
os
.
environ
.
get
(
'Z_DEBUG_MODE'
)
==
'1'
logger
=
logging
.
getLogger
(
'Localizer'
)
# PATCH 1: Global Request
#
# This part is obsolete because, we now use zope.globalrequest
#
# The original purpose was to get the request object from places where the
# acquisition was disabled (within the __of__ method for example). It was
# inspired by the Tim McLaughlin's GlobalGetRequest proposal, see
# http://dev.zope.org/Wikis/DevSite/Proposals/GlobalGetRequest
#
# Currently it keeps a Context instance, which wraps the request object,
# but also other things, like the user's session, as it is required by
# the ikaaro CMS.
#
# The request objects are stored in a dictionary in the Publish module,
# whose keys are the thread id.
#
def
get_new_publish
(
zope_publish
):
def
publish
(
request
,
*
args
,
**
kwargs
):
try
:
setRequest
(
request
)
return
zope_publish
(
request
,
*
args
,
**
kwargs
)
finally
:
clearRequest
()
return
publish
if
patch
is
False
:
patch
=
True
if
six
.
PY2
:
# ZServer-specific patch
# Apply the patch TODO: zope4py2 is this really needed ?
from
ZPublisher
import
Publish
Publish
.
publish
=
get_new_publish
(
Publish
.
publish
)
# PATCH 2: Accept
# Accept
#
# Adds the variable AcceptLanguage to the REQUEST. It provides a higher
# level interface than HTTP_ACCEPT_LANGUAGE.
...
...
@@ -105,7 +55,7 @@ def new_processInputs(self):
self
.
other
[
'AcceptLanguage'
]
=
accept_language
if
patch
:
if
not
patch
:
HTTPRequest
.
old_processInputs
=
HTTPRequest
.
processInputs
HTTPRequest
.
processInputs
=
new_processInputs
patch
=
True
product/Localizer/utils.py
View file @
afa4a185
...
...
@@ -22,10 +22,6 @@ from .itools.i18n import AcceptLanguageType, init_language_selector
# Import from Zope
from
App.Common
import
package_home
# Import from Localizer
from
.patches
import
get_request
# Package home
ph
=
package_home
(
globals
())
...
...
@@ -42,7 +38,8 @@ def lang_negotiator(available_languages):
the list of available languages. Returns the first user pref. language
that is available, if none is available returns None.
"""
request
=
get_request
()
from
zope.globalrequest
import
getRequest
request
=
getRequest
()
if
request
is
None
:
return
None
...
...
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