Commit 37864476 authored by Arnaud Fontaine's avatar Arnaud Fontaine

py3: ZServer/SignalHandler only available on python2.

parent 268e5923
......@@ -113,6 +113,7 @@ def match(self, request):
return 1
else:
return 0
from ZServer.HTTPServer import zhttp_handler
zhttp_handler.match = match
import six
if six.PY2:
from ZServer.HTTPServer import zhttp_handler
zhttp_handler.match = match
......@@ -27,12 +27,16 @@
#
##############################################################################
from webdav.client import Resource
try:
from webdav.client import Resource
except ImportError: # six.PY3, ZServer
pass
from App.config import getConfiguration
import os
import shutil
import sys
import six
from Acquisition import Implicit, Explicit
from AccessControl import ClassSecurityInfo
......@@ -285,6 +289,9 @@ class TemplateTool (BaseTool):
"""
Publish the given business template at the given URL.
"""
if six.PY3:
raise NotImplementedError("TODO-zope4py3")
business_template.build()
export_string = self.manage_exportObject(id=business_template.getId(),
download=True)
......@@ -298,6 +305,9 @@ class TemplateTool (BaseTool):
"""
Update an existing template from its publication URL.
"""
if six.PY3:
raise NotImplementedError("TODO-zope4py3")
url = business_template.getPublicationUrl()
id = business_template.getId()
bt = Resource(url)
......
......@@ -201,7 +201,12 @@ def runwsgi():
make_wsgi_app({}, zope_conf=args.zope_conf)
try:
from Signals.SignalHandler import SignalHandler
except ImportError:
import warnings
warnings.warn("zope4py3: SignalHandling not implemented!")
else:
SignalHandler.registerHandler(signal.SIGTERM, sys.exit)
if args.timerserver_interval:
......
......@@ -53,7 +53,9 @@ from Products.ERP5Type.patches import ActionInformation
from Products.ERP5Type.patches import ActionProviderBase
from Products.ERP5Type.patches import ActionsTool
from Products.ERP5Type.patches import CookieCrumbler
from Products.ERP5Type.patches import PropertySheets
if six.PY2:
# XXX- patch for webdav
from Products.ERP5Type.patches import PropertySheets
from Products.ERP5Type.patches import CMFCoreSkinnable
from Products.ERP5Type.patches import CMFCoreSkinsTool
from Products.ERP5Type.patches import OFSFolder
......@@ -62,7 +64,9 @@ from Products.ERP5Type.patches import PersistentMapping
from Products.ERP5Type.patches import DateTimePatch
from Products.ERP5Type.patches import PythonScript
from Products.ERP5Type.patches import MailHost
from Products.ERP5Type.patches import http_server
if six.PY2:
# No more ZServer
from Products.ERP5Type.patches import http_server
from Products.ERP5Type.patches import memcache_client
if WITH_LEGACY_WORKFLOW:
from Products.ERP5Type.patches import StateChangeInfoPatch
......@@ -88,13 +92,17 @@ from Products.ERP5Type.patches import SourceCodeEditorZMI
from Products.ERP5Type.patches import CachingPolicyManager
from Products.ERP5Type.patches import AcceleratedHTTPCacheManager
from Products.ERP5Type.patches import ExceptionFormatter
from Products.ERP5Type.patches import WebDAV
if six.PY2:
# No ZServer, so no webdav
from Products.ERP5Type.patches import WebDAV
from Products.ERP5Type.patches import CMFCoreUtils
from Products.ERP5Type.patches import OFSFile
from Products.ERP5Type.patches import ZSQLMethod
from Products.ERP5Type.patches import MimetypesRegistry
from Products.ERP5Type.patches import users
from Products.ERP5Type.patches import Publish
if six.PY2:
# No ZServer
from Products.ERP5Type.patches import Publish
from Products.ERP5Type.patches import WSGITask
from Products.ERP5Type.patches import urllib_opener
......
......@@ -21,13 +21,12 @@ 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
# import Globals
from ZPublisher import Publish
from ZPublisher.HTTPRequest import HTTPRequest
from zope.globalrequest import clearRequest, setRequest
from zope.globalrequest import getRequest as get_request
......@@ -68,16 +67,18 @@ def get_new_publish(zope_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)
patch = True
# Add to Globals for backwards compatibility
# XXX-AUREL do we really care ?
# Globals.get_request = get_request
import Globals
Globals.get_request = get_request
# PATCH 2: Accept
......
from ZServer.datatypes import ServerFactory
import six
if six.PY2:
from ZServer.datatypes import ServerFactory
class TimerServerFactory(ServerFactory):
class TimerServerFactory(ServerFactory):
def __init__(self, section):
ServerFactory.__init__(self)
self.interval = section.interval
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment