Per a short chat with exarkun (thanks exarkun), I'm posting this to the
list for discussion.
A project upon which I am working requires a twisted.web service that
allows a user to delegate authentication/authorization to a third party,
e.g., Facebook, Twitter, et cetera. In so doing, I've found myself
missing nevow.guard, since web.guard currently only has out-of-the-box
support for HTTP Auth. I'd like to see web.guard expand to cover more
kinds of auth, such as form-based auth or the OAuth-based solutions coming
from so many social graph sites.
With this in mind, I asked exarkun about this, and he mentioned that the
only thing he does not consider to be garbage in nevow.guard is the
feature-set, and that I should port the features to web, discarding the
I'd like to solicit the list for some guidance as to what those features
are, or should be, and hopefully end up with a ticket describing the
features to be implemented, which I will then attempt to implement and
contribute to twisted.web.
L. Daniel Burr
I used twisted to develop my web site just a little time.
I have a question about how to get Content-Type when I upload a picture?
When I get request.args["picture"], I only get picture content strings.
Can I have a easy way to get the picture's Content-Type?
I ask you to help me finding the source of problems with the following code.
The result of opening page at
https://serveraddr:serverport/services/admin is 403 Forbidden.
It needs to show the output from UpdateManager.render_GET().
root = resource.ForbiddenResource()
err = resource.ForbiddenResource()
upd = UpdateXMLProcessor()
portal = Portal(PublicHTMLRealm(), [FilePasswordDB('httpd.password')])
credentialFactory = DigestCredentialFactory("md5", "House of Life Updates")
admin = HTTPAuthSessionWrapper(portal, [credentialFactory])
def requestAvatar(self, avatarId, mind, *interfaces):
if IResource in interfaces:
resc = UpdateManager()
resc.realm = self
return (IResource, resc, lambda: None)
isLeaf = False
pathFromRoot = '/service/admin'
self.newFull = NewFullResource()
self.newDelta = NewDeltaResource()
self.switch = SwitchResource()
def render_GET(self, request):
Is anything wrong here in these code parts?
I have no errors shown in the console running with
twistd -ny server.tac
Thank you for your assistance,
Can you tell me what are the best practices for setting up a twistd
daemon in a linux (centos) environment on a server. The server should
be always uptime and relaunch on fatal error. I am sure there is a
common procedure for this.
Also I'm interested in providing secure access to twisted application
services. I set up twisted in a python virtualenv and my application
is running under user 'nobody'. What else could be done? What about
permissions of the python script files and static server resources?
Also, is it a good idea to listen (HTTP and HTTPS) on ports 8081 and
8083 and set up apache to redirect port 80 and port 443 on a subdomain
to the appropriate twistd daemon ports?
Thank you for example. I write a simple plugin for template:
from twisted.application import service, internet
from twisted.internet import utils, reactor
from twisted.python import log
from twisted.python import usage
name = 'TestService'
def __init__(self, reactor):
self.reactor = reactor
utils.getProcessOutputAndValue('/usr/bin/sleep', args = ['1000'])
s = TestService(reactor)
It's work (twistd -n test ) , but kill pid ( without kill -9 ) don't work. I see a message "Main loop terminated" and script continue running. Why ?
14 июля 2011, 17:30 от Duncan McGreggor <duncan.mcgreggor(a)gmail.com>:
On Thu, Jul 14, 2011 at 7:05 AM, Thorne, Stephen <
> On Thu, Jul 14, 2011 at 13:50, Ivan <
>> I have a very simple example:
>> from twisted.internet import protocol, utils, reactor
>> def start():
> I put together an example of how to create a 'complete' example
> application using twisted plugins (which are also run with 'twistd'
> but allow things like command line arguments) a few weeks ago.
> repo is here:
> It shows how to do things in 'Service.startService', this approach
> would map to using a .tac file as well, with some munging.
I gotta second this. This is the best example of Twisted plugins I've
seen yet. I know I'll regret saying this, but it's foolproof.
Twisted-web mailing list
I have a very simple example:
from twisted.internet import protocol, utils, reactor
How to create tac file for this example ?
So far this is where I have got to.
In my timeout using callLater, I call d._canceller().
This calls _connectionLost_WAITING which is partly what I would expect. But
it does not call _canceller_WAITING which I would have expected as well.
The function at d._canceller would appear to be cancelConnection so I can
see why it would go to loseConnection right away. But I have not found
where cancelConnection resides yet.
The _connectLost_WAITING then calls disconnectParser and finally does the
errback with ResponseFailed and the connection is dropped cleanly.
The fact that _canceller_WAITING is not called makes me think I am making
the wrong call on the request deferred when I use d._canceller(), but I have
not seen anything else I can call.
Also d._canceller requires a parameter. And I can pass it anything and it
seems to not make use of any argument I pass in. I have used d the deferred,
None, 'TRANSMITTING' the string all with exactly the same effect.
So it makes me think I am making the wrong call on the request deferred.
Does anyone know if I should be calling some other function.
Below is the result from a test run outputting various points the program
runs through which might be helpful.
dispatcher <function dispatcher at 0x00FD57B0> template <function
dispatcher <function dispatcher at 0x00FD58F0> template <function
ved at 0x00FD58B0>
dispatcher <function dispatcher at 0x00FD5A30> template <function
hed at 0x00FD59F0>
dispatcher <function dispatcher at 0x00FD5F70> template <function _canceller
dispatcher <function dispatcher at 0x00FD9170> template <function
body <stringprod_resp.StringProducer object at 0x00F9BCB0>
fff canceller <function cancelConnect at 0x00FD95B0>
got do cancel
connectionlost waiting [Failure instance: Traceback (failure with no
lass 'twisted.internet.error.ConnectionDone'>: Connection was closed
disconnect parser [Failure instance: Traceback (failure with no frames):
'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly.
got error <bound method Failure.getErrorMessage of
re <class 'twisted.web._newclient.ResponseFailed'>>>
Thanks for any info.