#865 closed enhancement (worksforme)
twisted.web handler
Reported by: | Owned by: | Jonas Borgström | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | general | Version: | devel |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The attached patch adds a twisted.web handler; auth and file uploads are currently non-functional. Sample .rpy and .tac (standalone) scripts are also attached.
Attachments (5)
Change History (16)
by , 20 years ago
comment:1 by , 20 years ago
Milestone: | → 0.9 |
---|---|
Status: | new → assigned |
Cool, I'll apply the patch and give you commit rights as soon as 0.8 is released and the 0.8-stable branch is created.
comment:2 by , 20 years ago
It's been a while since 0.8 was released, but there doesn't seem to have been any progress here; what's happening?
comment:3 by , 20 years ago
I've attached an update version of the patch with htdigest auth support. Still no file upload support, because twisted.web throws away the filename when processing file uploads (grr).
comment:4 by , 20 years ago
The patch needs updating to the recently refactored web layer. As an advantage, you can know reuse DigestAuth
from the trac.web.standalone
module, instead of copying the code over.
comment:5 by , 20 years ago
I'm attaching a newly updated patch, that now uses twisted.web2 - file uploads are still broken, pending file upload support in web2.
comment:6 by , 20 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
I think we'll hold off on adding new server frontends until we've added WSGI support, which should make it easier to add and maintain new frontends. See: #1582.
comment:7 by , 19 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
I access trac as a WSGI resource of my twisted.web2 HTTP server, and everything seems to be working fine. The only exception is bug #2913, which is a result of trac running in a persistent Python process when accessed via tracd or WSGI.
Here's the code I use:
# Access Trac from Twisted Web2 via WSGI # This snippet of fairly obvious code written by Edwin A. Suominen # and hereby dedicated to the public domain. from twisted.web2.wsgi import WSGIResource import trac.web.main class TracResource(WSGIResource): """ I provide a Trac site for a specified path via a WSGI gateway. The WSGI application is L{trac.web.main.dispatch_request}, the 'Main entry point for the Trac web interface.' It has the following required WSGI-compliant parameters: environ: the WSGI environment dict start_response: the WSGI callback for starting the response """ def __init__(self, path): self.path = path WSGIResource.__init__(self, self.tracApplication) def tracApplication(self, environ, start_response): """ This method is the callable object that provides access to my particular Trac environment via WSGI. """ environ['trac.env_path'] = self.path return trac.web.main.dispatch_request(environ, start_response)
comment:9 by , 18 years ago
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
Replying to edsuom:
I access trac as a WSGI resource of my twisted.web2 HTTP server, and everything seems to be working fine. The only exception is bug #2913, which is a result of trac running in a persistent Python process when accessed via tracd or WSGI.
Well, the Twisted project now uses Trac as a WSGI application and #2913, so I think it's safe to say this is working.
follow-up: 11 comment:10 by , 18 years ago
Is there a recipe somewhere about how to use Trac with Twisted?
comment:11 by , 18 years ago
Replying to cboos:
Is there a recipe somewhere about how to use Trac with Twisted?
Sample .rpy file, place in existing t.w server