# HG changeset patch # User paulb # Date 1188606402 0 # Node ID 86f65e70f53347b685b696e708b2564cb6d48521 # Parent 1c5aaee6e41c1f890041c7fc70faae25ae90772c [project @ 2007-09-01 00:26:42 by paulb] Deprecation warning fix for Twisted 2.x, plus commented out suggested fix for request stream access. diff -r 1c5aaee6e41c -r 86f65e70f533 WebStack/Twisted.py --- a/WebStack/Twisted.py Sat Sep 01 00:26:10 2007 +0000 +++ b/WebStack/Twisted.py Sat Sep 01 00:26:42 2007 +0000 @@ -68,7 +68,17 @@ "Returns the server port as a string." - return str(self.trans.getHost()[2]) + host = self.trans.getHost() + + # Use the attribute for Twisted 2.0 or greater. + + if hasattr(host, "port"): + return str(host.port) + + # Use the element for earlier versions. + + else: + return str(host[2]) # Request-related methods. @@ -78,6 +88,7 @@ Returns the request stream for the transaction. """ + #self.trans.content.seek(0) return self.trans.content def get_request_method(self):