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
Titouan Soulard
erp5
Commits
9a25bc04
Commit
9a25bc04
authored
Mar 02, 2023
by
Arnaud Fontaine
Committed by
Jérome Perrin
Mar 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zope4: ZServer removal: Remove Publisher monkey patches.
parent
e6ad58fb
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
472 deletions
+6
-472
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
-58
product/Localizer/utils.py
product/Localizer/utils.py
+2
-5
No files found.
product/ERP5Type/ZopePatch.py
View file @
9a25bc04
...
@@ -94,9 +94,6 @@ from Products.ERP5Type.patches import OFSFile
...
@@ -94,9 +94,6 @@ from Products.ERP5Type.patches import OFSFile
from
Products.ERP5Type.patches
import
ZSQLMethod
from
Products.ERP5Type.patches
import
ZSQLMethod
from
Products.ERP5Type.patches
import
MimetypesRegistry
from
Products.ERP5Type.patches
import
MimetypesRegistry
from
Products.ERP5Type.patches
import
users
from
Products.ERP5Type.patches
import
users
if
six
.
PY2
:
# No ZServer
from
Products.ERP5Type.patches
import
Publish
from
Products.ERP5Type.patches
import
WSGITask
from
Products.ERP5Type.patches
import
WSGITask
if
six
.
PY2
:
if
six
.
PY2
:
# XXX-zope4py3: urllib2 removed (see future/backports/urllib/request.py)
# XXX-zope4py3: urllib2 removed (see future/backports/urllib/request.py)
...
...
product/ERP5Type/patches/Publish.py
deleted
100644 → 0
View file @
e6ad58fb
This diff is collapsed.
Click to expand it.
product/Localizer/__init__.py
View file @
9a25bc04
...
@@ -25,7 +25,7 @@ from DocumentTemplate.DT_String import String
...
@@ -25,7 +25,7 @@ from DocumentTemplate.DT_String import String
# Import from Localizer
# Import from Localizer
import
six
import
six
if
six
.
PY2
:
if
six
.
PY2
:
from
.
patches
import
get_request
from
.
import
patches
as
_
from
.
import
Localizer
,
MessageCatalog
from
.
import
Localizer
,
MessageCatalog
from
.LocalFiles
import
LocalDTMLFile
from
.LocalFiles
import
LocalDTMLFile
...
...
product/Localizer/patches.py
View file @
9a25bc04
...
@@ -18,70 +18,15 @@
...
@@ -18,70 +18,15 @@
This is a hotfix, it dynamically applies several patches to Zope.
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
# Import from itools
from
.itools.i18n
import
AcceptLanguageType
from
.itools.i18n
import
AcceptLanguageType
# Import from Zope
# Import from Zope
from
ZPublisher.HTTPRequest
import
HTTPRequest
from
ZPublisher.HTTPRequest
import
HTTPRequest
from
zope.globalrequest
import
clearRequest
,
setRequest
from
zope.globalrequest
import
getRequest
as
get_request
# Flag
patch
=
False
patch
=
False
Z_DEBUG_MODE
=
os
.
environ
.
get
(
'Z_DEBUG_MODE'
)
==
'1'
logger
=
logging
.
getLogger
(
'Localizer'
)
# Accept
# PATCH 1: Global Request
#
# 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.
#
# Also, we keep the get_request method in the Globals module for backwards
# compatibility (with TranslationService for example).
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
logger
.
info
(
'Install "Globals.get_request".'
)
# Apply the patch
from
ZPublisher
import
Publish
Publish
.
publish
=
get_new_publish
(
Publish
.
publish
)
# Add to Globals for backwards compatibility
import
Globals
Globals
.
get_request
=
get_request
# PATCH 2: Accept
#
#
# Adds the variable AcceptLanguage to the REQUEST. It provides a higher
# Adds the variable AcceptLanguage to the REQUEST. It provides a higher
# level interface than HTTP_ACCEPT_LANGUAGE.
# level interface than HTTP_ACCEPT_LANGUAGE.
...
@@ -110,7 +55,7 @@ def new_processInputs(self):
...
@@ -110,7 +55,7 @@ def new_processInputs(self):
self
.
other
[
'AcceptLanguage'
]
=
accept_language
self
.
other
[
'AcceptLanguage'
]
=
accept_language
if
patch
:
if
not
patch
:
HTTPRequest
.
old_processInputs
=
HTTPRequest
.
processInputs
HTTPRequest
.
old_processInputs
=
HTTPRequest
.
processInputs
HTTPRequest
.
processInputs
=
new_processInputs
HTTPRequest
.
processInputs
=
new_processInputs
patch
=
True
product/Localizer/utils.py
View file @
9a25bc04
...
@@ -22,10 +22,6 @@ from .itools.i18n import AcceptLanguageType, init_language_selector
...
@@ -22,10 +22,6 @@ from .itools.i18n import AcceptLanguageType, init_language_selector
# Import from Zope
# Import from Zope
from
App.Common
import
package_home
from
App.Common
import
package_home
# Import from Localizer
from
.patches
import
get_request
# Package home
# Package home
ph
=
package_home
(
globals
())
ph
=
package_home
(
globals
())
...
@@ -42,7 +38,8 @@ def lang_negotiator(available_languages):
...
@@ -42,7 +38,8 @@ def lang_negotiator(available_languages):
the list of available languages. Returns the first user pref. language
the list of available languages. Returns the first user pref. language
that is available, if none is available returns None.
that is available, if none is available returns None.
"""
"""
request
=
get_request
()
from
zope.globalrequest
import
getRequest
request
=
getRequest
()
if
request
is
None
:
if
request
is
None
:
return
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