[Twisted-Python] Some comments on twisted.news
![](https://secure.gravatar.com/avatar/f293e6729d818630c72f8aae1b0bbc7e.jpg?s=120&d=mm&r=g)
I just set up a basic demo new server using twisted. Some initial comments: 1. It took me almost no time to put together a basic dummy NNTP server. Just create the backend, put a mktap driver in, and it's working. 2. There seems to be a problem with the server class. It translates \r\n.. to \r\n. in the data the backend supplies - this should be the other way round (it should be *doubling* the dots, so that they don't look like the end of data marker to the client). 3. It would be nice if the server handled the translation to CRLF, so that backends could return data with lines separated by \n, and the server class would convert that to \r\n. After all, \n is the "normal" end of line character internal to Python code, and \r\n is a feature of the NNTP protocol, so the protocol driver should be responsible for the conversion (IMHO). Of course, this is a behaviour change, which could break existing backends, so maybe it's not practical to make this change. 4. The implementation of STAT requests the article from the backend. This could be inefficient if getting the message ID is cheap, but getting the full article is expensive for a particular backend (it will be for me). In my partly-implemented NNTP server written in "raw" Python (before I found Twisted) I had a backend method getArticle(..., head=1, body=1) which was used to implement all of HEAD, BODY, ARTICLE and STAT, just by setting different values for the head and body parameters (so the backend could check for the case where neither was required, and act accordingly). (2) is obviously fairly trivial. I think I could implement (3) and (4), if it would be useful. I could submit a patch, which would alter the server code and the 2 existing backends (I couldn't test the database backend, as I don't have a database to test with, but I could test the pickle-based code). Would this be helpful? Are there likely to be 3rd party nntp backends which would be broken by such a change? Paul. -- This signature intentionally left blank
![](https://secure.gravatar.com/avatar/3a7e70f3ef2ad1539da42afc85c8d09d.jpg?s=120&d=mm&r=g)
On Tue, Oct 22, 2002 at 06:49:09PM +0100, Paul Moore wrote:
There certainly aren't any 3rd party backends yet, twisted.news is still fairly new (and doesn't have any users, afaik, although some may be lurking). I'd recommend implementing everything and waiting for exarkun's approval (He may be a while, as he's visiting Minnesota atm), but I really doubt he'll have any problems with it. -- Christopher Armstrong << radix@twistedmatrix.com >> http://twistedmatrix.com/users/radix.twistd/
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Wed, 23 Oct 2002 22:11:15 +0100 Paul Moore <gustav@morpheus.demon.co.uk> wrote:
OK, I'll see what I can do. What's the best procedure for submitting a patch? Can I post patches to this list?
If it's big, http://sf.net/projects/twisted/ in the bug tracker. -- Itamar Shtull-Trauring http://itamarst.org/ Available for Python, Twisted, Zope and Java consulting
![](https://secure.gravatar.com/avatar/78e124bb69bcaac7a75ecfe640d02261.jpg?s=120&d=mm&r=g)
On Wed, 23 Oct 2002, Paul Moore <gustav@morpheus.demon.co.uk> wrote:
OK, I'll see what I can do. What's the best procedure for submitting a patch? Can I post patches to this list?
Yes, you can.
From the FAQ (in CVS):
I have a patch. How do I maximize the chances the Twisted developers will include it? Use unified diff. Either use cvs diff -u or, better yet, make a clean checkout and use diff -urN between them. Make sure your patch applies cleanly. Then, send it to the mailing list inlined and without any word wrapping.
![](https://secure.gravatar.com/avatar/3c6f9c62d1015960866823348f070ed7.jpg?s=120&d=mm&r=g)
Just wondering if anyone uses twisted.mail as a mail server? saw ZOE http://guests.evectors.it/zoe lately and wondered what it would take to implement something like that with a twisted framework... -Just wondrin.
![](https://secure.gravatar.com/avatar/f2bb7225b5047991e87a44acf37e8373.jpg?s=120&d=mm&r=g)
On 22 Oct 2002 at 16:17, developer@csrules.dyndns.org wrote:
Other people have had this idea after seeing ZOE. I don't know what the current status of t.mail is, but I doubt it would be hard to make it functional enough to use for that type of app. -p -- Paul Swartz (o_ http://twistedmatrix.com/users/z3p.twistd/ //\ z3p@twistedmatrix.com V_/_ AIM: Z3Penguin
![](https://secure.gravatar.com/avatar/7b7a2c0c3c3533817e28c9b2e6379695.jpg?s=120&d=mm&r=g)
On Tue, Oct 22, 2002 at 06:49:09PM +0100, Paul Moore wrote:
Glad to hear it :)
Oops, thanks for the report.
I agree that \n would probably be preferable, this was just sloppyness on my part in the initial implementation. I think it could be changed in such a way so as not to break existing code, but allow new code to use \n (similar to how LineReceiver works), and I think this would be a good thing to do.
Hmmm. I have an {indeterminant}-term goal of creating a better backend interface. If this isn't a pressing concern for you now, I'd rather put it off until that happened (though I'd have no problem if you sent a patch that made the necessary changes).
I've been away a while, so maybe you've already gone ahead and done some of this? If not, I might have a crack at it myself. I'll wait to hear what, if anything, you've done thus far though. Jp -- If the automobile had followed the same development as the computer, a Rolls-Royce would today cost $100, get a million miles per per gallon, and explode once a year killing everyone inside. -- Robert Cringely, InfoWorld -- 12:00am up 164 days, 1:59, 5 users, load average: 0.12, 0.13, 0.10
![](https://secure.gravatar.com/avatar/f293e6729d818630c72f8aae1b0bbc7e.jpg?s=120&d=mm&r=g)
Jp Calderone <exarkun@meson.dyndns.org> writes:
That would be good. As a Windows user, I have a lot of experience with nasty LF/CRLF issues. Most of them respond reasonably well to the "be liberal in what you accept and strict in what you produce" philosophy.
That's fine by me - I don't have a major issue with this. What I'll do (if and when I get the time) is to post a copy of the design I used for my backend interface - it may be of interest.
Unfortunately, events overtook me, and I haven't had a chance to get back to this yet. When I do, I have 2 things to look at - on the one hand, I need to complete the job of implementing the news server I needed this for in the first place, and in the second, I'd like to help by supplying some patches. I suspect that getting the job done may have to take priority, though :-) I'll keep looking at this, though, and discuss further with you. Paul. -- This signature intentionally left blank
![](https://secure.gravatar.com/avatar/ab9d321e14b7de587809bcadc1352cb0.jpg?s=120&d=mm&r=g)
Quoting Jp Calderone <exarkun@meson.dyndns.org> (2002-11-01 06:01:45 GMT):
I posted a patch a few months ago that took any of a number of line endings. It seemed to get devnulled, and I haven't got a copy any more but I suspect it's in the list archives. We do *have* list archives, don't we? -- CROMARTY
![](https://secure.gravatar.com/avatar/3a7e70f3ef2ad1539da42afc85c8d09d.jpg?s=120&d=mm&r=g)
On Tue, Oct 22, 2002 at 06:49:09PM +0100, Paul Moore wrote:
There certainly aren't any 3rd party backends yet, twisted.news is still fairly new (and doesn't have any users, afaik, although some may be lurking). I'd recommend implementing everything and waiting for exarkun's approval (He may be a while, as he's visiting Minnesota atm), but I really doubt he'll have any problems with it. -- Christopher Armstrong << radix@twistedmatrix.com >> http://twistedmatrix.com/users/radix.twistd/
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Wed, 23 Oct 2002 22:11:15 +0100 Paul Moore <gustav@morpheus.demon.co.uk> wrote:
OK, I'll see what I can do. What's the best procedure for submitting a patch? Can I post patches to this list?
If it's big, http://sf.net/projects/twisted/ in the bug tracker. -- Itamar Shtull-Trauring http://itamarst.org/ Available for Python, Twisted, Zope and Java consulting
![](https://secure.gravatar.com/avatar/78e124bb69bcaac7a75ecfe640d02261.jpg?s=120&d=mm&r=g)
On Wed, 23 Oct 2002, Paul Moore <gustav@morpheus.demon.co.uk> wrote:
OK, I'll see what I can do. What's the best procedure for submitting a patch? Can I post patches to this list?
Yes, you can.
From the FAQ (in CVS):
I have a patch. How do I maximize the chances the Twisted developers will include it? Use unified diff. Either use cvs diff -u or, better yet, make a clean checkout and use diff -urN between them. Make sure your patch applies cleanly. Then, send it to the mailing list inlined and without any word wrapping.
![](https://secure.gravatar.com/avatar/3c6f9c62d1015960866823348f070ed7.jpg?s=120&d=mm&r=g)
Just wondering if anyone uses twisted.mail as a mail server? saw ZOE http://guests.evectors.it/zoe lately and wondered what it would take to implement something like that with a twisted framework... -Just wondrin.
![](https://secure.gravatar.com/avatar/f2bb7225b5047991e87a44acf37e8373.jpg?s=120&d=mm&r=g)
On 22 Oct 2002 at 16:17, developer@csrules.dyndns.org wrote:
Other people have had this idea after seeing ZOE. I don't know what the current status of t.mail is, but I doubt it would be hard to make it functional enough to use for that type of app. -p -- Paul Swartz (o_ http://twistedmatrix.com/users/z3p.twistd/ //\ z3p@twistedmatrix.com V_/_ AIM: Z3Penguin
![](https://secure.gravatar.com/avatar/7b7a2c0c3c3533817e28c9b2e6379695.jpg?s=120&d=mm&r=g)
On Tue, Oct 22, 2002 at 06:49:09PM +0100, Paul Moore wrote:
Glad to hear it :)
Oops, thanks for the report.
I agree that \n would probably be preferable, this was just sloppyness on my part in the initial implementation. I think it could be changed in such a way so as not to break existing code, but allow new code to use \n (similar to how LineReceiver works), and I think this would be a good thing to do.
Hmmm. I have an {indeterminant}-term goal of creating a better backend interface. If this isn't a pressing concern for you now, I'd rather put it off until that happened (though I'd have no problem if you sent a patch that made the necessary changes).
I've been away a while, so maybe you've already gone ahead and done some of this? If not, I might have a crack at it myself. I'll wait to hear what, if anything, you've done thus far though. Jp -- If the automobile had followed the same development as the computer, a Rolls-Royce would today cost $100, get a million miles per per gallon, and explode once a year killing everyone inside. -- Robert Cringely, InfoWorld -- 12:00am up 164 days, 1:59, 5 users, load average: 0.12, 0.13, 0.10
![](https://secure.gravatar.com/avatar/f293e6729d818630c72f8aae1b0bbc7e.jpg?s=120&d=mm&r=g)
Jp Calderone <exarkun@meson.dyndns.org> writes:
That would be good. As a Windows user, I have a lot of experience with nasty LF/CRLF issues. Most of them respond reasonably well to the "be liberal in what you accept and strict in what you produce" philosophy.
That's fine by me - I don't have a major issue with this. What I'll do (if and when I get the time) is to post a copy of the design I used for my backend interface - it may be of interest.
Unfortunately, events overtook me, and I haven't had a chance to get back to this yet. When I do, I have 2 things to look at - on the one hand, I need to complete the job of implementing the news server I needed this for in the first place, and in the second, I'd like to help by supplying some patches. I suspect that getting the job done may have to take priority, though :-) I'll keep looking at this, though, and discuss further with you. Paul. -- This signature intentionally left blank
![](https://secure.gravatar.com/avatar/ab9d321e14b7de587809bcadc1352cb0.jpg?s=120&d=mm&r=g)
Quoting Jp Calderone <exarkun@meson.dyndns.org> (2002-11-01 06:01:45 GMT):
I posted a patch a few months ago that took any of a number of line endings. It seemed to get devnulled, and I haven't got a copy any more but I suspect it's in the list archives. We do *have* list archives, don't we? -- CROMARTY
participants (9)
-
Andrew Stribblehill
-
Christopher Armstrong
-
developer@csrules.dyndns.org
-
Itamar Shtull-Trauring
-
Jp Calderone
-
Moshe Zadka
-
Paul Moore
-
Paul Moore
-
Paul Swartz