~dustin-spy/twisted/dustin

« back to all changes in this revision

Viewing changes to twisted/tap/news.py

  • Committer: carmstro
  • Date: 2002-04-19 01:51:16 UTC
  • Revision ID: vcs-imports@canonical.com-20020419015116-5da98ced848261da
yay for exarkun! news server

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Twisted, the Framework of Your Internet
 
2
# Copyright (C) 2001 Matthew W. Lefkowitz
 
3
 
4
# This library is free software; you can redistribute it and/or
 
5
# modify it under the terms of version 2.1 of the GNU Lesser General Public
 
6
# License as published by the Free Software Foundation.
 
7
 
8
# This library is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
# Lesser General Public License for more details.
 
12
 
13
# You should have received a copy of the GNU Lesser General Public
 
14
# License along with this library; if not, write to the Free Software
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
from twisted.news import news, database
 
17
from twisted.protocols import nntp
 
18
from twisted.python import usage
 
19
 
 
20
class Options(usage.Options):
 
21
    synopsis = "Usage: mktap nntp [options]"
 
22
    
 
23
    optParameters = [
 
24
        ["port", "p", "119", "Listen port"]
 
25
    ]
 
26
 
 
27
    def __init__(self):
 
28
        usage.Options.__init__(self)
 
29
 
 
30
    def opt_port(self, port):
 
31
        self.port = port
 
32
 
 
33
def updateApplication(app, config):
 
34
    app.listenTCP(
 
35
        int(config.opts['port']),
 
36
        news.createNNTPFactory(nntp.NNTPServer, database.PickleStorage)
 
37
    )