Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
87be8d16
Commit
87be8d16
authored
Apr 30, 2006
by
Lennart Regebro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made the twisted module optional.
parent
8cd1393e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
23 deletions
+28
-23
lib/python/Zope2/Startup/handlers.py
lib/python/Zope2/Startup/handlers.py
+28
-23
No files found.
lib/python/Zope2/Startup/handlers.py
View file @
87be8d16
...
...
@@ -5,10 +5,29 @@ import logging
from
re
import
compile
from
socket
import
gethostbyaddr
import
twisted.internet
from
twisted.application.service
import
MultiService
import
zope.app.appsetup.interfaces
import
zope.app.twisted.main
try
:
import
twisted.internet
from
twisted.application.service
import
MultiService
import
zope.app.appsetup.interfaces
import
zope.app.twisted.main
import
twisted.web2.wsgi
import
twisted.web2.server
import
twisted.web2.log
try
:
from
twisted.web2.http
import
HTTPFactory
except
ImportError
:
from
twisted.web2.channel.http
import
HTTPFactory
from
zope.component
import
provideUtility
from
zope.app.twisted.server
import
ServerType
,
SSLServerType
from
zope.app.twisted.interfaces
import
IServerType
from
ZPublisher.WSGIPublisher
import
publish_module
_use_twisted
=
True
except
ImportError
:
_use_twisted
=
False
# top-level key handlers
...
...
@@ -242,29 +261,15 @@ def _name2Ips(host, isIp_=compile(r'(\d+\.){3}').match):
if
isIp_
(
host
):
return
[
host
]
return
gethostbyaddr
(
host
)[
2
]
# XXX Need to find a better place for this.
import
twisted.web2.wsgi
import
twisted.web2.server
import
twisted.web2.log
try
:
from
twisted.web2.http
import
HTTPFactory
except
ImportError
:
from
twisted.web2.channel.http
import
HTTPFactory
from
zope.component
import
provideUtility
from
zope.app.twisted.server
import
ServerType
,
SSLServerType
from
zope.app.twisted.interfaces
import
IServerType
from
ZPublisher.WSGIPublisher
import
publish_module
# Twisted support:
def
createHTTPFactory
(
ignored
):
resource
=
twisted
.
web2
.
wsgi
.
WSGIResource
(
publish_module
)
resource
=
twisted
.
web2
.
wsgi
.
WSGIResource
(
publish_module
)
resource
=
twisted
.
web2
.
log
.
LogWrapperResource
(
resource
)
return
HTTPFactory
(
twisted
.
web2
.
server
.
Site
(
resource
))
http
=
ServerType
(
createHTTPFactory
,
8080
)
provideUtility
(
http
,
IServerType
,
'Zope2-HTTP'
)
if
_use_twisted
:
http
=
ServerType
(
createHTTPFactory
,
8080
)
provideUtility
(
http
,
IServerType
,
'Zope2-HTTP'
)
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