2
# Twisted, the Framework of Your Internet
3
# Copyright (C) 2001 Matthew W. Lefkowitz
5
# This library is free software; you can redistribute it and/or
6
# modify it under the terms of version 2.1 of the GNU Lesser General Public
7
# License as published by the Free Software Foundation.
9
# This library is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
# Lesser General Public License for more details.
14
# You should have received a copy of the GNU Lesser General Public
15
# License along with this library; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
I am a support module for creating reality servers with mktap.
23
from cPickle import load
27
from twisted.reality import plumbing, reality
28
from twisted.internet import tcp, main
29
from twisted.web import server
30
from twisted.python import usage
31
from twisted.spread import pb
33
class Options(usage.Options):
34
synopsis="Usage: mktap reality -m *map.rpl*"
35
optStrings = [["map", "m", None]]
37
longdesc = """Reality PickLe files are created using the 'gnusto'
38
utility on a build_map file from a Twisted Reality distribution. Some
39
realities can be found at http://twistedmatrix.com/reality.epy.
42
def updateApplication(app, config):
44
raise Exception("Please give a map name")
45
print 'Loading %s...' % config.map
47
rdf = reality._default = load(open(config.map,'rb'))
48
rdf.setApplication(app)
49
# Should this be considered 'Legacy'?
50
rdf.addPlayersAsIdentities()
54
spigot = plumbing.Spigot(rdf)
55
site = server.Site(plumbing.Web(rdf))
56
bf = pb.BrokerFactory(pb.AuthRoot(app))
58
app.listenTCP(8080, site)
59
app.listenTCP(4040, spigot)
60
app.listenTCP(8787, bf)