On Mon, Sep 03, 2001 at 09:41:31AM +1000, Chris.Hadgis(a)mincom.com wrote:
> > ... broadcastToPair() sends the message to all containers
> > associated with the figure's current location.
> > My proposed solution is to not include the location's containers
> > in the container list.
> I'd say that this is the wrong solution.
Indeed it is. Last night I sorted out the problem. broadcastToPair()
calls pairHears() for each container. Each call to pairHears() calls
hears() for target. This means the target gets the target message once
for each container. This is clearly wrong.
My temporary fix is to call hears() for target once in
broadcastToPair() and remove the call from pairHears().
I say it is a temporary solution because I am still in the middle of
overhauling the broadcast and hears routines.
If the next release goes out before the overhaul is complete, please
let me know and I will make the above fix available.
P.S. My heart-felt condolences go out to the Americans on the list,
and indeed to people wherever they are, for the tragedy which occurred
on Tuesday morning. I have been watching the news on the American news
channels (Fox and CNN) here in Australia and I still can't believe
what I am seeing. Courage and hope to all people affected by these
This transmission is for the intended addressee only and is confidential
information. If you have received this transmission in error, please
delete it and notify the sender. The contents of this e-mail are the
opinion of the writer only and are not endorsed by the Mincom Group
of companies unless expressly stated otherwise.
Following a suggestion from Moshez, I rewrote his UDP classes in order to
get them somewhat more usable (eventually aiming at DNS protocol
the example in doc/examples/udp-echoserv.py is now obsolete and will not
work. Instead, UDP integrates neatly into doc/examples/echoserv.py
Équipe de Logique Mathématique
UFR de Mathématiques (case 7012)
Université Paris 7
2 place Jussieu
75251 Paris Cedex 05
I have been taking a look on WebDAV, especially RFC 2518, "HTTP Extension for Distributed Authoring -- WEBDAV". The extension concerns four areas, queries and manipulation of properties, handling of collections, locking and namespace operations. The two last areas are not crucial.
Each of these areas has its set of methods, which is dispatched the same way as 'GET' and 'PUT', but usually with a XML-file appended to the request.
The twisted.web architecture of resources is well suited for adding WebDAV. resource.Resource is fitting the term Resource as it is used in the RFC. And twisted.web.server.Request's way of handling requests/responses seems open-ended enough too add a xml-reader/writer that concates the reply with XML (mimed). I will here try to examine the changes that need to be done to twisted.web.server (and protocols.http). Barely nothing else is examined, or needed.
I will blend some explanations into my proposal in case my understanding of twisted.* is wrong :).
The methods 'GET', 'PUT', 'HEAD', etc, is not touched by WebDAV. These methods by definitions only concern 'files' (eg. GET retrieves the entity described by the URI).
The WebDAV-Resource '/foo/' is a Resource Collection, and '/foo/file' is a member of the collection. If '/foo/faa/file' exists, then the 'faa'-collection needs to exist because the resource-tree has to be consistent. The trailing slash tells if the files is a collection or not; this is not a rule so the server may correct the client with a MOVED_PERMANENTLY in the same way web.static does. The tree may however contain non-DAV-compliant resources, so there won't be a need to force DAV onto everything. If a putChild should be put into a collection is a discussion on its own :) (I will however mean that a DAVResource should be a good starting point for making everything DAV, by letting the stuff to go DAV inherit DAVResource)
Since resource is the dispatcher of methods, then WebDAV can be a simple twisted.web.resource. The request has arguments in the Header and this gets conviently passed to the assigned resource. The request may contain an XML with additional arguments as well. Request.process seems to handle the task well, except that its 'POST'-handler may be rewritten to collect the XML for most methods.
'GET' is done in the regular way, no XML, just send the entity the URI point at (for collections, send eg. the index.html. I don't know the case here, really). This is resource-stuff. All the action will be in resource.render (it will render the response XML, I guess).
Minor thing, yet: If a request take long time to accomplish (eg. MOVE 100M of data over wire) there is a reply 102 PROCESSING which tells the client to keep the line open and wait. I don't know how the details, but I guess a NOT_DONE_YET may stop the block :) The problems with this is that it will send a response later on, I guess this can be hacked in.
The changes that need to be done to protocols.http is simply adding the new error-codes, since that is all that is in it :) If we want to add namespace operations (MOVE, COPY) the http-client needs to be made DAV-compliant. Note that COPY/MOVE also can be done by FTP too ;)
Request.resource: retrieve the XML in the request.
Handle the response 102 PROCESSING
Everything will happen in the DAV-Resource. :)
In windows 2000, threaded server, my server does nut shutdown when
main.shutDown() is called. It seens that main.waker is the problem,
since it is not removed from the list of readers registered with the
Does the following patch seem reasonable (someone better test on unix)
or does someone have a better suggestion? It does seem to solve the problem:
RCS file: /cvs/Twisted/twisted/internet/main.py,v
retrieving revision 1.23
diff -c -r1.23 main.py
*** main.py 2001/09/02 14:42:10 1.23
--- main.py 2001/09/10 18:19:29
*** 198,203 ****
--- 198,204 ----
running = 0
log.msg('Starting Shutdown Sequence.')
Hi. I didn't commit this, as it's a bit of a conceptual change.
Please give feedback. Patch is at the end.
This change allows web.widgets to call defer.Deferred's
callback() with a list instead of a string, making it possible
to stream a web page to the browser by returning a string and
then a Deferred object.
Here's a snippet of a web UI I'm doing that streams LDAP
search results to the browser as soon as the server sends
them -- see handle_entry():
def __init__(self, ldapclient, callback, filter=pureldap.LDAPFilterMatchAll):
self.callback(["<p>%d entries matched."%self.count])
def handle_entry(self, objectName, attributes):
for a,l in attributes:
result=result+" <li>%s: %s\n"%(a, l)
result=result+" <li>%s:\n <ul>\n"%a
for i in l:
def handle_fail(self, resultCode, errorMessage):
self.callback("fail: %d: %s"%(resultCode, errorMessage or "Unknown error"))
--- twisted/web/widgets.py 2001/09/10 17:13:24 1.8
+++ twisted/web/widgets.py 2001/09/10 17:18:37
@@ -283,12 +283,17 @@
def callback(self, result, position, decNeedsHeaders):
if result != FORGET_IT:
self.needsHeaders = self.needsHeaders - decNeedsHeaders
- if isinstance(result, defer.Deferred):
- self._addDeferred(result, position)
- self.lst[position] = result
+ if not isinstance(result, types.ListType):
+ for i in xrange(len(result)):
+ if isinstance(result[i], defer.Deferred):
+ self._addDeferred(result[i], position+i)
+ self.lst[position:position+1] = result
+ assert self.position <= position
- if isinstance(result, defer.Deferred):
+ for r in result:
+ if isinstance(r, defer.Deferred):
I'm resending this because I didn't notice it coming up on the ml; sorry if it is a duplicate
> I was wondering if it would be possible to implement WebDAV fully in
> Resources, and not touching anything else. Resources can munge whatever
> headers they want, etc, and we could just have a base DAVResource do all
> the XML/Mime encoding.
Yes, my last post pointed out how that could be done. Though, the stuff I pointed out (eg to make process able to forward the request content even if the method isn't POST) is really only what needs to be done.
The only stupid stuff is that the child-list for the Resources will be duplicated since they need to be a member of their parent-collection.
So, the DAVResource needs to both represent resources ("files") and collectionresources. Hm, will it create a new DAVResource for each step down the tree? And if it hits an exisisting resource, refer to it? I am not trained in twisted.web =)
Oh, how many times resource and (dav)resource will confuse
Just checking before I commit :)
Why do this:
_host = socket.gethostbyaddr(socket.gethostname())
when this works?
This at least doesn't make the crash go bad in win98
On Sat, 08 Sep 2001, Glyph Lefkowitz <glyph(a)twistedmatrix.com> wrote:
> -import string, time, types, traceback, copy, pprint, sys, os
> +import string, time, types, traceback, copy, pprint, sys, os, string
string is imported twice. No biggie, but it ain't nice
The Official Moshe Zadka FAQ: http://moshez.geek
The Official Moshe Zadka FAQ For Dummies: http://moshez.org
Read the FAQ