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
301b54d9
Commit
301b54d9
authored
Apr 09, 1999
by
Amos Latteier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Major changes to ZServer. Perparation for beta one.
parent
00b71f40
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
102 additions
and
616 deletions
+102
-616
ZServer/PubCore/ZEvent.py
ZServer/PubCore/ZEvent.py
+11
-29
ZServer/PubCore/ZOutPipe.py
ZServer/PubCore/ZOutPipe.py
+0
-178
ZServer/PubCore/ZRendezvous.py
ZServer/PubCore/ZRendezvous.py
+13
-34
ZServer/PubCore/ZServerPublisher.py
ZServer/PubCore/ZServerPublisher.py
+16
-38
ZServer/PubCore/__init__.py
ZServer/PubCore/__init__.py
+11
-29
lib/python/ZServer/PubCore/ZEvent.py
lib/python/ZServer/PubCore/ZEvent.py
+11
-29
lib/python/ZServer/PubCore/ZOutPipe.py
lib/python/ZServer/PubCore/ZOutPipe.py
+0
-178
lib/python/ZServer/PubCore/ZRendezvous.py
lib/python/ZServer/PubCore/ZRendezvous.py
+13
-34
lib/python/ZServer/PubCore/ZServerPublisher.py
lib/python/ZServer/PubCore/ZServerPublisher.py
+16
-38
lib/python/ZServer/PubCore/__init__.py
lib/python/ZServer/PubCore/__init__.py
+11
-29
No files found.
ZServer/PubCore/ZEvent.py
View file @
301b54d9
##############################################################################
#
# Zope Public License (ZPL) Version
0.9.6
# -------------------------------------
--
# Zope Public License (ZPL) Version
1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
...
...
@@ -17,12 +19,13 @@
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Any use, including use of the Zope software to operate a website,
# must either comply with the terms described below under
# "Attribution" or alternatively secure a separate license from
# Digital Creations. Digital Creations will not unreasonably
# deny such a separate license in the event that the request
# explains in detail a valid reason for withholding attribution.
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
...
...
@@ -73,27 +76,6 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Attribution
#
# Individuals or organizations using this software as a web
# site ("the web site") must provide attribution by placing
# the accompanying "button" on the website's main entry
# point. By default, the button links to a "credits page"
# on the Digital Creations' web site. The "credits page" may
# be copied to "the web site" in order to add other credits,
# or keep users "on site". In that case, the "button" link
# may be updated to point to the "on site" "credits page".
# In cases where this placement of attribution is not
# feasible, a separate arrangment must be concluded with
# Digital Creations. Those using the software for purposes
# other than web sites must provide a corresponding
# attribution in locations that include a copyright using a
# manner best suited to the application environment. Where
# attribution is not possible, or is considered to be
# onerous for some other reason, a request should be made to
# Digital Creations to waive this requirement in writing.
# As stated above, for valid requests, Digital Creations
# will not unreasonably deny such requests.
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
...
...
ZServer/PubCore/ZOutPipe.py
deleted
100644 → 0
View file @
00b71f40
##############################################################################
#
# Zope Public License (ZPL) Version 0.9.6
# ---------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Any use, including use of the Zope software to operate a website,
# must either comply with the terms described below under
# "Attribution" or alternatively secure a separate license from
# Digital Creations. Digital Creations will not unreasonably
# deny such a separate license in the event that the request
# explains in detail a valid reason for withholding attribution.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Attribution
#
# Individuals or organizations using this software as a web
# site ("the web site") must provide attribution by placing
# the accompanying "button" on the website's main entry
# point. By default, the button links to a "credits page"
# on the Digital Creations' web site. The "credits page" may
# be copied to "the web site" in order to add other credits,
# or keep users "on site". In that case, the "button" link
# may be updated to point to the "on site" "credits page".
# In cases where this placement of attribution is not
# feasible, a separate arrangment must be concluded with
# Digital Creations. Those using the software for purposes
# other than web sites must provide a corresponding
# attribution in locations that include a copyright using a
# manner best suited to the application environment. Where
# attribution is not possible, or is considered to be
# onerous for some other reason, a request should be made to
# Digital Creations to waive this requirement in writing.
# As stated above, for valid requests, Digital Creations
# will not unreasonably deny such requests.
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
"""ZServer output pipe
"""
import
thread
from
ZEvent
import
Wakeup
from
string
import
join
TupleType
=
type
(())
class
OutputPipe
:
"""A pipe which can be written to and read from different threads.
Also supports callbacks to notify readers when the pipe has been
written to or has been closed."""
def
__init__
(
self
,
callback
=
None
):
"callback should be a tuple (function,(args,))"
lock
=
thread
.
allocate_lock
()
self
.
_r
=
lock
.
release
self
.
_a
=
lock
.
acquire
self
.
_buf
=
[]
self
.
_callback
=
callback
def
write
(
self
,
text
):
self
.
_a
()
try
:
self
.
_buf
.
append
(
text
)
finally
:
self
.
_r
()
self
.
notify
()
def
notify
(
self
):
if
self
.
_callback
:
fun
=
self
.
_callback
[
0
]
args
=
self
.
_callback
[
1
]
+
(
self
,)
Wakeup
(
lambda
f
=
fun
,
a
=
args
:
apply
(
f
,
a
))
else
:
Wakeup
()
def
close
(
self
):
self
.
_a
()
try
:
b
=
self
.
_buf
if
b
:
self
.
_buf
=
tuple
(
b
)
else
:
self
.
_buf
=
None
finally
:
self
.
_r
()
self
.
notify
()
def
read
(
self
):
"""Read data from the pipe
Return None if the pipe is open but has no data.
Return an empty string if the pipe is closed.
"""
self
.
_a
()
try
:
b
=
self
.
_buf
if
b
is
None
:
return
''
if
not
b
:
return
None
if
type
(
b
)
is
TupleType
:
self
.
_buf
=
None
else
:
self
.
_buf
=
[]
return
join
(
b
,
''
)
finally
:
self
.
_r
()
def
ready
(
self
):
"""Pipe status, medusa producer style.
Return 1 if the pipe is open and has data.
Return None if the pipe is open but has no data.
Return 1 if the pipe is closed.
"""
self
.
_a
()
try
:
b
=
self
.
_buf
if
b
is
None
:
return
1
if
not
b
:
return
None
return
1
finally
:
self
.
_r
()
ZServer/PubCore/ZRendezvous.py
View file @
301b54d9
##############################################################################
#
# Zope Public License (ZPL) Version
0.9.6
# -------------------------------------
--
# Zope Public License (ZPL) Version
1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
...
...
@@ -17,12 +19,13 @@
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Any use, including use of the Zope software to operate a website,
# must either comply with the terms described below under
# "Attribution" or alternatively secure a separate license from
# Digital Creations. Digital Creations will not unreasonably
# deny such a separate license in the event that the request
# explains in detail a valid reason for withholding attribution.
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
...
...
@@ -73,27 +76,6 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Attribution
#
# Individuals or organizations using this software as a web
# site ("the web site") must provide attribution by placing
# the accompanying "button" on the website's main entry
# point. By default, the button links to a "credits page"
# on the Digital Creations' web site. The "credits page" may
# be copied to "the web site" in order to add other credits,
# or keep users "on site". In that case, the "button" link
# may be updated to point to the "on site" "credits page".
# In cases where this placement of attribution is not
# feasible, a separate arrangment must be concluded with
# Digital Creations. Those using the software for purposes
# other than web sites must provide a corresponding
# attribution in locations that include a copyright using a
# manner best suited to the application environment. Where
# attribution is not possible, or is considered to be
# onerous for some other reason, a request should be made to
# Digital Creations to waive this requirement in writing.
# As stated above, for valid requests, Digital Creations
# will not unreasonably deny such requests.
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
...
...
@@ -102,7 +84,6 @@
##############################################################################
import
thread
from
ZOutPipe
import
OutputPipe
from
ZServerPublisher
import
ZServerPublisher
class
ZRendevous
:
...
...
@@ -142,15 +123,13 @@ class ZRendevous:
return
r
finally
:
self
.
_r
()
def
handle
(
self
,
name
,
environ
,
input
,
callback
=
None
):
output
=
OutputPipe
(
callback
)
def
handle
(
self
,
name
,
request
,
response
):
self
.
_a
()
try
:
pool
,
requests
,
ready
=
self
.
_lists
requests
.
append
((
name
,
input
,
output
,
environ
))
requests
.
append
((
name
,
request
,
response
))
if
ready
:
l
=
ready
[
-
1
]
del
ready
[
-
1
]
l
.
release
()
return
output
finally
:
self
.
_r
()
ZServer/PubCore/ZServerPublisher.py
View file @
301b54d9
##############################################################################
#
# Zope Public License (ZPL) Version
0.9.6
# -------------------------------------
--
# Zope Public License (ZPL) Version
1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
...
...
@@ -17,12 +19,13 @@
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Any use, including use of the Zope software to operate a website,
# must either comply with the terms described below under
# "Attribution" or alternatively secure a separate license from
# Digital Creations. Digital Creations will not unreasonably
# deny such a separate license in the event that the request
# explains in detail a valid reason for withholding attribution.
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
...
...
@@ -73,47 +76,22 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Attribution
#
# Individuals or organizations using this software as a web
# site ("the web site") must provide attribution by placing
# the accompanying "button" on the website's main entry
# point. By default, the button links to a "credits page"
# on the Digital Creations' web site. The "credits page" may
# be copied to "the web site" in order to add other credits,
# or keep users "on site". In that case, the "button" link
# may be updated to point to the "on site" "credits page".
# In cases where this placement of attribution is not
# feasible, a separate arrangment must be concluded with
# Digital Creations. Those using the software for purposes
# other than web sites must provide a corresponding
# attribution in locations that include a copyright using a
# manner best suited to the application environment. Where
# attribution is not possible, or is considered to be
# onerous for some other reason, a request should be made to
# Digital Creations to waive this requirement in writing.
# As stated above, for valid requests, Digital Creations
# will not unreasonably deny such requests.
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
from
ZPublisher
import
publish_module
from
cStringIO
import
StringIO
class
ZServerPublisher
:
def
__init__
(
self
,
accept
):
while
1
:
try
:
name
,
input
,
output
,
environ
=
accept
()
name
,
request
,
response
=
accept
()
publish_module
(
name
,
stdin
=
input
,
stdout
=
output
,
stderr
=
StringIO
(),
# whatever ;)
environ
=
environ
)
name
,
request
=
request
,
response
=
response
)
finally
:
output
.
close
()
response
.
_finish
()
ZServer/PubCore/__init__.py
View file @
301b54d9
##############################################################################
#
# Zope Public License (ZPL) Version
0.9.6
# -------------------------------------
--
# Zope Public License (ZPL) Version
1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
...
...
@@ -17,12 +19,13 @@
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Any use, including use of the Zope software to operate a website,
# must either comply with the terms described below under
# "Attribution" or alternatively secure a separate license from
# Digital Creations. Digital Creations will not unreasonably
# deny such a separate license in the event that the request
# explains in detail a valid reason for withholding attribution.
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
...
...
@@ -73,27 +76,6 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Attribution
#
# Individuals or organizations using this software as a web
# site ("the web site") must provide attribution by placing
# the accompanying "button" on the website's main entry
# point. By default, the button links to a "credits page"
# on the Digital Creations' web site. The "credits page" may
# be copied to "the web site" in order to add other credits,
# or keep users "on site". In that case, the "button" link
# may be updated to point to the "on site" "credits page".
# In cases where this placement of attribution is not
# feasible, a separate arrangment must be concluded with
# Digital Creations. Those using the software for purposes
# other than web sites must provide a corresponding
# attribution in locations that include a copyright using a
# manner best suited to the application environment. Where
# attribution is not possible, or is considered to be
# onerous for some other reason, a request should be made to
# Digital Creations to waive this requirement in writing.
# As stated above, for valid requests, Digital Creations
# will not unreasonably deny such requests.
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
...
...
lib/python/ZServer/PubCore/ZEvent.py
View file @
301b54d9
##############################################################################
#
# Zope Public License (ZPL) Version
0.9.6
# -------------------------------------
--
# Zope Public License (ZPL) Version
1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
...
...
@@ -17,12 +19,13 @@
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Any use, including use of the Zope software to operate a website,
# must either comply with the terms described below under
# "Attribution" or alternatively secure a separate license from
# Digital Creations. Digital Creations will not unreasonably
# deny such a separate license in the event that the request
# explains in detail a valid reason for withholding attribution.
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
...
...
@@ -73,27 +76,6 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Attribution
#
# Individuals or organizations using this software as a web
# site ("the web site") must provide attribution by placing
# the accompanying "button" on the website's main entry
# point. By default, the button links to a "credits page"
# on the Digital Creations' web site. The "credits page" may
# be copied to "the web site" in order to add other credits,
# or keep users "on site". In that case, the "button" link
# may be updated to point to the "on site" "credits page".
# In cases where this placement of attribution is not
# feasible, a separate arrangment must be concluded with
# Digital Creations. Those using the software for purposes
# other than web sites must provide a corresponding
# attribution in locations that include a copyright using a
# manner best suited to the application environment. Where
# attribution is not possible, or is considered to be
# onerous for some other reason, a request should be made to
# Digital Creations to waive this requirement in writing.
# As stated above, for valid requests, Digital Creations
# will not unreasonably deny such requests.
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
...
...
lib/python/ZServer/PubCore/ZOutPipe.py
deleted
100644 → 0
View file @
00b71f40
##############################################################################
#
# Zope Public License (ZPL) Version 0.9.6
# ---------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions in source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Any use, including use of the Zope software to operate a website,
# must either comply with the terms described below under
# "Attribution" or alternatively secure a separate license from
# Digital Creations. Digital Creations will not unreasonably
# deny such a separate license in the event that the request
# explains in detail a valid reason for withholding attribution.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
# the following acknowledgement:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# In the event that the product being advertised includes an
# intact Zope distribution (with copyright and license included)
# then this clause is waived.
#
# 5. Names associated with Zope or Digital Creations must not be used to
# endorse or promote products derived from this software without
# prior written permission from Digital Creations.
#
# 6. Modified redistributions of any form whatsoever must retain
# the following acknowledgment:
#
# "This product includes software developed by Digital Creations
# for use in the Z Object Publishing Environment
# (http://www.zope.org/)."
#
# Intact (re-)distributions of any official Zope release do not
# require an external acknowledgement.
#
# 7. Modifications are encouraged but must be packaged separately as
# patches to official Zope releases. Distributions that do not
# clearly separate the patches from the original work must be clearly
# labeled as unofficial distributions. Modifications which do not
# carry the name Zope may be packaged in any form, as long as they
# conform to all of the clauses above.
#
#
# Disclaimer
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Attribution
#
# Individuals or organizations using this software as a web
# site ("the web site") must provide attribution by placing
# the accompanying "button" on the website's main entry
# point. By default, the button links to a "credits page"
# on the Digital Creations' web site. The "credits page" may
# be copied to "the web site" in order to add other credits,
# or keep users "on site". In that case, the "button" link
# may be updated to point to the "on site" "credits page".
# In cases where this placement of attribution is not
# feasible, a separate arrangment must be concluded with
# Digital Creations. Those using the software for purposes
# other than web sites must provide a corresponding
# attribution in locations that include a copyright using a
# manner best suited to the application environment. Where
# attribution is not possible, or is considered to be
# onerous for some other reason, a request should be made to
# Digital Creations to waive this requirement in writing.
# As stated above, for valid requests, Digital Creations
# will not unreasonably deny such requests.
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
"""ZServer output pipe
"""
import
thread
from
ZEvent
import
Wakeup
from
string
import
join
TupleType
=
type
(())
class
OutputPipe
:
"""A pipe which can be written to and read from different threads.
Also supports callbacks to notify readers when the pipe has been
written to or has been closed."""
def
__init__
(
self
,
callback
=
None
):
"callback should be a tuple (function,(args,))"
lock
=
thread
.
allocate_lock
()
self
.
_r
=
lock
.
release
self
.
_a
=
lock
.
acquire
self
.
_buf
=
[]
self
.
_callback
=
callback
def
write
(
self
,
text
):
self
.
_a
()
try
:
self
.
_buf
.
append
(
text
)
finally
:
self
.
_r
()
self
.
notify
()
def
notify
(
self
):
if
self
.
_callback
:
fun
=
self
.
_callback
[
0
]
args
=
self
.
_callback
[
1
]
+
(
self
,)
Wakeup
(
lambda
f
=
fun
,
a
=
args
:
apply
(
f
,
a
))
else
:
Wakeup
()
def
close
(
self
):
self
.
_a
()
try
:
b
=
self
.
_buf
if
b
:
self
.
_buf
=
tuple
(
b
)
else
:
self
.
_buf
=
None
finally
:
self
.
_r
()
self
.
notify
()
def
read
(
self
):
"""Read data from the pipe
Return None if the pipe is open but has no data.
Return an empty string if the pipe is closed.
"""
self
.
_a
()
try
:
b
=
self
.
_buf
if
b
is
None
:
return
''
if
not
b
:
return
None
if
type
(
b
)
is
TupleType
:
self
.
_buf
=
None
else
:
self
.
_buf
=
[]
return
join
(
b
,
''
)
finally
:
self
.
_r
()
def
ready
(
self
):
"""Pipe status, medusa producer style.
Return 1 if the pipe is open and has data.
Return None if the pipe is open but has no data.
Return 1 if the pipe is closed.
"""
self
.
_a
()
try
:
b
=
self
.
_buf
if
b
is
None
:
return
1
if
not
b
:
return
None
return
1
finally
:
self
.
_r
()
lib/python/ZServer/PubCore/ZRendezvous.py
View file @
301b54d9
##############################################################################
#
# Zope Public License (ZPL) Version
0.9.6
# -------------------------------------
--
# Zope Public License (ZPL) Version
1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
...
...
@@ -17,12 +19,13 @@
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Any use, including use of the Zope software to operate a website,
# must either comply with the terms described below under
# "Attribution" or alternatively secure a separate license from
# Digital Creations. Digital Creations will not unreasonably
# deny such a separate license in the event that the request
# explains in detail a valid reason for withholding attribution.
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
...
...
@@ -73,27 +76,6 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Attribution
#
# Individuals or organizations using this software as a web
# site ("the web site") must provide attribution by placing
# the accompanying "button" on the website's main entry
# point. By default, the button links to a "credits page"
# on the Digital Creations' web site. The "credits page" may
# be copied to "the web site" in order to add other credits,
# or keep users "on site". In that case, the "button" link
# may be updated to point to the "on site" "credits page".
# In cases where this placement of attribution is not
# feasible, a separate arrangment must be concluded with
# Digital Creations. Those using the software for purposes
# other than web sites must provide a corresponding
# attribution in locations that include a copyright using a
# manner best suited to the application environment. Where
# attribution is not possible, or is considered to be
# onerous for some other reason, a request should be made to
# Digital Creations to waive this requirement in writing.
# As stated above, for valid requests, Digital Creations
# will not unreasonably deny such requests.
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
...
...
@@ -102,7 +84,6 @@
##############################################################################
import
thread
from
ZOutPipe
import
OutputPipe
from
ZServerPublisher
import
ZServerPublisher
class
ZRendevous
:
...
...
@@ -142,15 +123,13 @@ class ZRendevous:
return
r
finally
:
self
.
_r
()
def
handle
(
self
,
name
,
environ
,
input
,
callback
=
None
):
output
=
OutputPipe
(
callback
)
def
handle
(
self
,
name
,
request
,
response
):
self
.
_a
()
try
:
pool
,
requests
,
ready
=
self
.
_lists
requests
.
append
((
name
,
input
,
output
,
environ
))
requests
.
append
((
name
,
request
,
response
))
if
ready
:
l
=
ready
[
-
1
]
del
ready
[
-
1
]
l
.
release
()
return
output
finally
:
self
.
_r
()
lib/python/ZServer/PubCore/ZServerPublisher.py
View file @
301b54d9
##############################################################################
#
# Zope Public License (ZPL) Version
0.9.6
# -------------------------------------
--
# Zope Public License (ZPL) Version
1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
...
...
@@ -17,12 +19,13 @@
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Any use, including use of the Zope software to operate a website,
# must either comply with the terms described below under
# "Attribution" or alternatively secure a separate license from
# Digital Creations. Digital Creations will not unreasonably
# deny such a separate license in the event that the request
# explains in detail a valid reason for withholding attribution.
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
...
...
@@ -73,47 +76,22 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Attribution
#
# Individuals or organizations using this software as a web
# site ("the web site") must provide attribution by placing
# the accompanying "button" on the website's main entry
# point. By default, the button links to a "credits page"
# on the Digital Creations' web site. The "credits page" may
# be copied to "the web site" in order to add other credits,
# or keep users "on site". In that case, the "button" link
# may be updated to point to the "on site" "credits page".
# In cases where this placement of attribution is not
# feasible, a separate arrangment must be concluded with
# Digital Creations. Those using the software for purposes
# other than web sites must provide a corresponding
# attribution in locations that include a copyright using a
# manner best suited to the application environment. Where
# attribution is not possible, or is considered to be
# onerous for some other reason, a request should be made to
# Digital Creations to waive this requirement in writing.
# As stated above, for valid requests, Digital Creations
# will not unreasonably deny such requests.
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
# attributions are listed in the accompanying credits file.
#
##############################################################################
from
ZPublisher
import
publish_module
from
cStringIO
import
StringIO
class
ZServerPublisher
:
def
__init__
(
self
,
accept
):
while
1
:
try
:
name
,
input
,
output
,
environ
=
accept
()
name
,
request
,
response
=
accept
()
publish_module
(
name
,
stdin
=
input
,
stdout
=
output
,
stderr
=
StringIO
(),
# whatever ;)
environ
=
environ
)
name
,
request
=
request
,
response
=
response
)
finally
:
output
.
close
()
response
.
_finish
()
lib/python/ZServer/PubCore/__init__.py
View file @
301b54d9
##############################################################################
#
# Zope Public License (ZPL) Version
0.9.6
# -------------------------------------
--
# Zope Public License (ZPL) Version
1.0
# -------------------------------------
#
# Copyright (c) Digital Creations. All rights reserved.
#
# This license has been certified as Open Source(tm).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
...
...
@@ -17,12 +19,13 @@
# the documentation and/or other materials provided with the
# distribution.
#
# 3. Any use, including use of the Zope software to operate a website,
# must either comply with the terms described below under
# "Attribution" or alternatively secure a separate license from
# Digital Creations. Digital Creations will not unreasonably
# deny such a separate license in the event that the request
# explains in detail a valid reason for withholding attribution.
# 3. Digital Creations requests that attribution be given to Zope
# in any manner possible. Zope includes a "Powered by Zope"
# button that is installed by default. While it is not a license
# violation to remove this button, it is requested that the
# attribution remain. A significant investment has been put
# into Zope, and this effort will continue if the Zope community
# continues to grow. This is one way to assure that growth.
#
# 4. All advertising materials and documentation mentioning
# features derived from or use of this software must display
...
...
@@ -73,27 +76,6 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Attribution
#
# Individuals or organizations using this software as a web
# site ("the web site") must provide attribution by placing
# the accompanying "button" on the website's main entry
# point. By default, the button links to a "credits page"
# on the Digital Creations' web site. The "credits page" may
# be copied to "the web site" in order to add other credits,
# or keep users "on site". In that case, the "button" link
# may be updated to point to the "on site" "credits page".
# In cases where this placement of attribution is not
# feasible, a separate arrangment must be concluded with
# Digital Creations. Those using the software for purposes
# other than web sites must provide a corresponding
# attribution in locations that include a copyright using a
# manner best suited to the application environment. Where
# attribution is not possible, or is considered to be
# onerous for some other reason, a request should be made to
# Digital Creations to waive this requirement in writing.
# As stated above, for valid requests, Digital Creations
# will not unreasonably deny such requests.
#
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations. Specific
...
...
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