[Twisted-Python] mail and web server authentication: yet to come or already there?

Andrew Bennetts andrew-twisted at puzzling.org
Wed Nov 20 19:14:30 EST 2002

On Wed, Nov 20, 2002 at 09:42:08PM +0100, Stefano Debenedetti wrote:
> One thing that is puzzling me is the twisted.cred stuff, even after reading 
> all about it in the docs it is still not clear to my dummy self how to put 
> it to use in order to restrict access on the twisted.web service (is HTTP 
> basic auth implemented somewhere btw?) and also I don't understand why it 

I *think* twisted.web.guard has this functionality... I've heard it's going
to be overhauled at some point, it's not as nice as it could be.

> is not used for access control to the twisted.mail services. Simply a 
> matter of time or is it really meant for other types of authentication? 

I'm even less of a twisted.mail expert than a twisted.web expert, but I
think that twisted.mail's auth stuff predates twisted.cred, and we haven't
had time to migrate it to twisted.cred yet.

> Some more examples in this very sensitive area for people not using PB 
> would help a lot....

Indeed.  Our docs are slowly improving, but still quite lacking.  If you or
anyone can contribute any, that would be great!

> One very small and probably already screwing-up-things contribution that I 
> can do now is to the SMTP class, I include herewith my first attempt at 
> using the diff utility:
> $ diff cvs/Twisted/twisted/protocols/smtp.py 

[We prefer "diff -u ...."; the output is much more readable.]

> cvs/Twisted/twisted/protocols/smtp.py_orig
> 137c137
> <         to = rest[string.find(rest, "<")+1:-len(">")]
> ---
> >        to = rest[len("TO:<"):-len(">")]
> After modifying that, I was able to send mail using Blat [2].

Hmm.  That looks like a dubious change to me.  Wouldn't that fail for
headers like:
    To: Mr. Example <dude at example.com>

I'm not familiar with smtp.py though...

> I am unfortunately locked on a win$ platform for my development so many 
> things are unnecessarily difficult, like getting C stuff to compile without 
> having visual studio installed for instance. Is this dependancy on the m$ 
> compiler anything unavoidable when doing python? Please forgive if that's a 


1. Twisted doesn't require any C modules to be compiled -- they're basically
   just optional speed-ups.  In fact the only C module in Twisted that works
   on Windows is cBanana; cReactor and portmap don't apply to Windows
   because it doesn't have the relevant APIs.

2. I've heard it's possible to use the mingw port of gcc to compile python
   extensions... search comp.lang.python or google for details.

> Oops the very last is this one: are ALL tests supposed to work 
> out-of-the-box (apart from those needing the crypto lib)? When I run them 
> the UI crashes... :-(

Eek.  The UI shouldn't crash, but regardless usually I use "runtests -t",
i.e. run in text mode.

Unfortunately Win32 support isn't 100% -- which tests are failing for you?

> Alright I'll stop my whining here for now and thank you very much for 
> reading so far and providing this great framework, ciao

Thanks :)


More information about the Twisted-Python mailing list