SVN: r24000 - in trunk/quixote: . server
Neil Schemenauer <nascheme-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Thu, 15 Apr 2004 17:38:26 -0400
| Newsgroups | gmane.comp.web.quixote.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: nascheme Date: 2004-04-15 17:38:26 -0400 (Thu, 15 Apr 2004) New Revision: 24000 Modified: trunk/quixote/ACKS trunk/quixote/TODO trunk/quixote/errors.py trunk/quixote/publish.py trunk/quixote/server/twisted_http.py Log: Minor fixes from Andrew. Pass along more request headers when using twisted_http.py. Fix typos in some comments and docstrings. Modified: trunk/quixote/ACKS =================================================================== --- trunk/quixote/ACKS 2004-04-15 19:23:50 UTC (rev 23999) +++ trunk/quixote/ACKS 2004-04-15 21:38:26 UTC (rev 24000) @@ -26,7 +26,7 @@ Neal M. Holtz Kaweh Kazemi Shahms E. King -A.M. Kuchling <akuchlin-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> +A.M. Kuchling <[email protected]> Erno Kuusela Nicola Larosa Hamish Lawson Modified: trunk/quixote/TODO =================================================================== --- trunk/quixote/TODO 2004-04-15 19:23:50 UTC (rev 23999) +++ trunk/quixote/TODO 2004-04-15 21:38:26 UTC (rev 24000) @@ -1,6 +1,4 @@ -* Add a simple User class (ID, e-mail, password) to Quixote. - * Extend HTTPRequest to support single/multiple-valued fields. * Add way to strip redundant whitespace from output HTML (or pipe it Modified: trunk/quixote/errors.py =================================================================== --- trunk/quixote/errors.py 2004-04-15 19:23:50 UTC (rev 23999) +++ trunk/quixote/errors.py 2004-04-15 21:38:26 UTC (rev 24000) @@ -115,7 +115,7 @@ class AccessError (PublishError): - """Should be raised raised if the client does not have access to the + """Should be raised if the client does not have access to the requested resource. Usually applications will raise this error from an _q_access method. """ Modified: trunk/quixote/publish.py =================================================================== --- trunk/quixote/publish.py 2004-04-15 19:23:50 UTC (rev 23999) +++ trunk/quixote/publish.py 2004-04-15 21:38:26 UTC (rev 24000) @@ -778,7 +778,7 @@ if component in container._q_exports or component == '_q_index': internal_name = component else: - # check for an explict external to internal mapping + # check for an explicit external to internal mapping for value in container._q_exports: if type(value) is types.TupleType: if value[0] == component: Modified: trunk/quixote/server/twisted_http.py =================================================================== --- trunk/quixote/server/twisted_http.py 2004-04-15 19:23:50 UTC (rev 23999) +++ trunk/quixote/server/twisted_http.py 2004-04-15 21:38:26 UTC (rev 24000) @@ -30,7 +30,7 @@ def process(self): self.publisher = self.channel.factory.publisher environ = self.create_environment() - ## this seek is important, it doesnt work without it + ## this seek is important, it doesn't work without it self.content.seek(0,0) qxrequest = self.publisher.create_request(self.content, environ) self.quixote_publish(qxrequest, environ) @@ -83,6 +83,12 @@ "SCRIPT_FILENAME": '', "REQUEST_URI": self.uri, "HTTPS": (self.isSecure() and 'on') or 'off', + "ACCEPT_ENCODING": self.getHeader('Accept-encoding'), + 'CONTENT_TYPE': self.getHeader('Content-type'), + 'HTTP_COOKIE': self.getHeader('Cookie'), + 'HTTP_REFERER': self.getHeader('Referer'), + 'HTTP_USER_AGENT': self.getHeader('User-agent'), + 'SERVER_PROTOCOL': 'HTTP/1.1', } client = self.getClient() @@ -125,18 +131,18 @@ return h -def run (): - import quixote.demo - # Ports this server will listen on - http_port = 8080 - namespace = quixote.demo - +def Server (namespace, port): app = Application('Quixote') publisher = Publisher(namespace) ##publisher.setup_logs() qf = QuixoteFactory(publisher) - app.listenTCP(http_port, qf) + app.listenTCP(port, qf) + return app + +def run (namespace, port): + app = Server(namespace, port) app.run(save=0) + if __name__ == '__main__': - run() + run('quixote.demo', 8080)