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
143
Merge Requests
143
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
958cce99
Commit
958cce99
authored
Sep 29, 2022
by
Kazuhiko Shiozaki
Committed by
Jérome Perrin
May 08, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: remove ZServer dependency.
parent
645bc7d6
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
2 additions
and
273 deletions
+2
-273
product/ERP5Type/ZopePatch.py
product/ERP5Type/ZopePatch.py
+0
-4
product/ERP5Type/patches/Publish.py
product/ERP5Type/patches/Publish.py
+0
-206
product/ERP5Type/patches/SharedDCScriptsBindings.py
product/ERP5Type/patches/SharedDCScriptsBindings.py
+0
-14
product/ERP5Type/patches/ZPublisherBeforeTraverse.py
product/ERP5Type/patches/ZPublisherBeforeTraverse.py
+0
-18
product/ERP5Type/tests/ProcessingNodeTestCase.py
product/ERP5Type/tests/ProcessingNodeTestCase.py
+2
-14
product/ERP5Type/tests/runUnitTest.py
product/ERP5Type/tests/runUnitTest.py
+0
-5
product/TimerService/timerserver/__init__.py
product/TimerService/timerserver/__init__.py
+0
-12
No files found.
product/ERP5Type/ZopePatch.py
View file @
958cce99
...
...
@@ -94,10 +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
IS_ZOPE2
:
# BBB Zope2
from
Products.ERP5Type.patches
import
Publish
from
Products.ERP5Type.patches
import
SharedDCScriptsBindings
from
Products.ERP5Type.patches
import
ZPublisherBeforeTraverse
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 @
645bc7d6
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
from
Products.ERP5Type.Timeout
import
getPublisherDeadlineValue
from
ZPublisher
import
Publish
from
ZPublisher.Publish
import
(
# Produced using:
# dis.dis(
# compile(open(<this_file>, 'r').read(), 'foo', 'exec').co_consts[
# <index of publish code object in co_consts>
# ]
# )
# and checking all uniques LOAD_GLOBAL names, excluding builtins and
# getPublisherDeadlineValue, and including publish parameter default
# values.
ISkinnable
,
PubAfterTraversal
,
PubBeforeAbort
,
PubBeforeCommit
,
PubFailure
,
PubStart
,
PubSuccess
,
Redirect
,
Retry
,
call_object
,
dont_publish_class
,
endInteraction
,
get_module_info
,
mapply
,
missing_name
,
newInteraction
,
notify
,
publish
,
setDefaultSkin
,
sys
,
urlparse
,
)
def
publish
(
request
,
module_name
,
after_list
,
debug
=
0
,
# Optimize:
call_object
=
call_object
,
missing_name
=
missing_name
,
dont_publish_class
=
dont_publish_class
,
mapply
=
mapply
,
):
(
bobo_before
,
bobo_after
,
object
,
realm
,
debug_mode
,
err_hook
,
validated_hook
,
transactions_manager
)
=
get_module_info
(
module_name
)
parents
=
None
response
=
None
try
:
with
getPublisherDeadlineValue
(
request
):
notify
(
PubStart
(
request
))
# TODO pass request here once BaseRequest implements IParticipation
newInteraction
()
request
.
processInputs
()
request_get
=
request
.
get
response
=
request
.
response
# First check for "cancel" redirect:
if
request_get
(
'SUBMIT'
,
''
).
strip
().
lower
()
==
'cancel'
:
cancel
=
request_get
(
'CANCEL_ACTION'
,
''
)
if
cancel
:
# Relative URLs aren't part of the spec, but are accepted by
# some browsers.
for
part
,
base
in
zip
(
urlparse
(
cancel
)[:
3
],
urlparse
(
request
[
'BASE1'
])[:
3
]):
if
not
part
:
continue
if
not
part
.
startswith
(
base
):
cancel
=
''
break
if
cancel
:
raise
Redirect
(
cancel
)
after_list
[
0
]
=
bobo_after
if
debug_mode
:
response
.
debug_mode
=
debug_mode
if
realm
and
not
request
.
get
(
'REMOTE_USER'
,
None
):
response
.
realm
=
realm
if
bobo_before
is
not
None
:
bobo_before
()
# Get the path list.
# According to RFC1738 a trailing space in the path is valid.
path
=
request_get
(
'PATH_INFO'
)
request
[
'PARENTS'
]
=
parents
=
[
object
]
if
transactions_manager
:
transactions_manager
.
begin
()
object
=
request
.
traverse
(
path
,
validated_hook
=
validated_hook
)
notify
(
PubAfterTraversal
(
request
))
if
transactions_manager
:
transactions_manager
.
recordMetaData
(
object
,
request
)
result
=
mapply
(
object
,
request
.
args
,
request
,
call_object
,
1
,
missing_name
,
dont_publish_class
,
request
,
bind
=
1
)
if
result
is
not
response
:
response
.
setBody
(
result
)
notify
(
PubBeforeCommit
(
request
))
if
transactions_manager
:
transactions_manager
.
commit
()
endInteraction
()
notify
(
PubSuccess
(
request
))
return
response
except
:
# save in order to give 'PubFailure' the original exception info
exc_info
=
sys
.
exc_info
()
# DM: provide nicer error message for FTP
sm
=
None
if
response
is
not
None
:
sm
=
getattr
(
response
,
"setMessage"
,
None
)
if
sm
is
not
None
:
from
asyncore
import
compact_traceback
cl
,
val
=
sys
.
exc_info
()[:
2
]
sm
(
'%s: %s %s'
%
(
getattr
(
cl
,
'__name__'
,
cl
),
val
,
debug_mode
and
compact_traceback
()[
-
1
]
or
''
))
# debug is just used by tests (has nothing to do with debug_mode!)
if
not
debug
and
err_hook
is
not
None
:
retry
=
False
if
parents
:
parents
=
parents
[
0
]
try
:
try
:
with
getPublisherDeadlineValue
(
request
):
return
err_hook
(
parents
,
request
,
sys
.
exc_info
()[
0
],
sys
.
exc_info
()[
1
],
sys
.
exc_info
()[
2
],
)
except
Retry
:
if
not
request
.
supports_retry
():
with
getPublisherDeadlineValue
(
request
):
return
err_hook
(
parents
,
request
,
sys
.
exc_info
()[
0
],
sys
.
exc_info
()[
1
],
sys
.
exc_info
()[
2
],
)
retry
=
True
finally
:
# Note: 'abort's can fail. Nevertheless, we want end request handling
try
:
try
:
notify
(
PubBeforeAbort
(
request
,
exc_info
,
retry
))
finally
:
if
transactions_manager
:
transactions_manager
.
abort
()
finally
:
endInteraction
()
notify
(
PubFailure
(
request
,
exc_info
,
retry
))
# Only reachable if Retry is raised and request supports retry.
newrequest
=
request
.
retry
()
request
.
close
()
# Free resources held by the request.
# Set the default layer/skin on the newly generated request
if
ISkinnable
.
providedBy
(
newrequest
):
setDefaultSkin
(
newrequest
)
try
:
return
publish
(
newrequest
,
module_name
,
after_list
,
debug
)
finally
:
newrequest
.
close
()
else
:
# Note: 'abort's can fail. Nevertheless, we want end request handling
try
:
try
:
notify
(
PubBeforeAbort
(
request
,
exc_info
,
False
))
finally
:
if
transactions_manager
:
transactions_manager
.
abort
()
finally
:
endInteraction
()
notify
(
PubFailure
(
request
,
exc_info
,
False
))
raise
Publish
.
publish
=
publish
product/ERP5Type/patches/SharedDCScriptsBindings.py
deleted
100644 → 0
View file @
645bc7d6
import
Shared.DC.Scripts.Bindings
# Make Shared.DC.Scripts.Bindings a new style classes already on Zope2, so that
# we can install business templates exported on Zope4 in Zope2 instances.
_NameAssignments
=
Shared
.
DC
.
Scripts
.
Bindings
.
NameAssignments
if
not
isinstance
(
_NameAssignments
,
type
):
class
NameAssignments
(
_NameAssignments
,
object
):
def
__init__
(
self
,
mapping
=
None
):
if
mapping
is
None
:
mapping
=
{}
_NameAssignments
.
__init__
(
self
,
mapping
)
NameAssignments
.
__module__
=
_NameAssignments
.
__module__
Shared
.
DC
.
Scripts
.
Bindings
.
NameAssignments
=
NameAssignments
product/ERP5Type/patches/ZPublisherBeforeTraverse.py
deleted
100644 → 0
View file @
645bc7d6
import
ZPublisher.BeforeTraverse
# Make ZPublisher.BeforeTraverse.MultiHook a new style classes already on
# Zope2, so that we can install business templates exported on Zope4 in
# Zope2 instances.
_MultiHook
=
ZPublisher
.
BeforeTraverse
.
MultiHook
if
not
isinstance
(
_MultiHook
,
type
):
class
MultiHook
(
_MultiHook
,
object
):
def
__init__
(
self
,
hookname
=
'<undefined hookname>'
,
prior
=
None
,
defined_in_class
=
False
):
_MultiHook
.
__init__
(
self
,
hookname
,
prior
,
defined_in_class
)
def
__repr__
(
self
):
# BBB keep the old class repr for testBeforeTraverse
return
'<ZPublisher.BeforeTraverse.MultiHook instance at 0x%0x (patched in %r)>'
%
(
id
(
self
),
__file__
)
MultiHook
.
__module__
=
_MultiHook
.
__module__
ZPublisher
.
BeforeTraverse
.
MultiHook
=
MultiHook
product/ERP5Type/tests/ProcessingNodeTestCase.py
View file @
958cce99
...
...
@@ -8,7 +8,6 @@ if six.PY2:
from
UserDict
import
IterableUserDict
as
UserDict
else
:
from
collections
import
UserDict
import
Lifetime
import
transaction
from
Testing
import
ZopeTestCase
from
zope.globalrequest
import
setRequest
...
...
@@ -152,14 +151,6 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
"""
_server_address
=
None
# (host, port) of the http server if it was started, None otherwise
@
staticmethod
def
asyncore_loop
():
try
:
Lifetime
.
lifetime_loop
()
except
KeyboardInterrupt
:
pass
Lifetime
.
graceful_shutdown_loop
()
@
staticmethod
def
startHTTPServer
(
verbose
=
False
):
"""Start HTTP Server in background"""
...
...
@@ -316,9 +307,6 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
ZopeTestCase
.
_print
(
' %i'
%
message_count
)
old_message_count
=
message_count
portal_activities
.
process_timer
(
None
,
None
)
if
Lifetime
.
_shutdown_phase
:
# XXX CMFActivity contains bare excepts
raise
KeyboardInterrupt
message_list
=
getMessageList
()
message_count
=
len
(
message_list
)
if
time
.
time
()
>=
deadline
or
message_count
and
any
(
x
.
processing_node
==
-
2
...
...
@@ -387,7 +375,7 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
"""Main loop for nodes that process activities"""
setRequest
(
self
.
app
.
REQUEST
)
try
:
while
not
Lifetime
.
_shutdown_phas
e
:
while
Tru
e
:
time
.
sleep
(.
3
)
transaction
.
begin
()
try
:
...
...
@@ -418,7 +406,7 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
timerserver_thread
=
None
try
:
while
not
Lifetime
.
_shutdown_phas
e
:
while
Tru
e
:
time
.
sleep
(.
3
)
transaction
.
begin
()
try
:
...
...
product/ERP5Type/tests/runUnitTest.py
View file @
958cce99
...
...
@@ -465,9 +465,6 @@ class DebugTestResult:
self
.
result
=
result
def
_start_debugger
(
self
,
tb
):
import
Lifetime
if
Lifetime
.
_shutdown_phase
:
return
try
:
# try ipython if available
import
IPython
...
...
@@ -637,11 +634,9 @@ def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None):
TestRunner
=
unittest
.
TextTestRunner
import
Lifetime
from
Zope2.custom_zodb
import
Storage
,
save_mysql
,
\
node_pid_list
,
neo_cluster
,
zeo_server_pid
,
wcfs_server
def
shutdown
(
signum
,
frame
,
signum_set
=
set
()):
Lifetime
.
shutdown
(
0
)
signum_set
.
add
(
signum
)
if
node_pid_list
is
None
and
len
(
signum_set
)
>
1
:
# in case of ^C, a child should also receive a SIGHUP from the parent,
...
...
product/TimerService/timerserver/__init__.py
View file @
958cce99
import
six
if
six
.
PY2
:
from
ZServer.datatypes
import
ServerFactory
class
TimerServerFactory
(
ServerFactory
):
def
__init__
(
self
,
section
):
ServerFactory
.
__init__
(
self
)
self
.
interval
=
section
.
interval
def
create
(
self
):
from
.TimerServer
import
TimerServer
return
TimerServer
(
self
.
module
,
self
.
interval
)
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