Changeset 276

Show
Ignore:
Timestamp:
01/19/07 12:21:47 (2 years ago)
Author:
matt
Message:

Make the examples runnable without the tac file.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/convenient-adding/examples.tac

    r196 r276  
    44 
    55application = service.Application('examples') 
    6 service = internet.TCPServer(8000, main.makeSite(application)) 
     6service = internet.TCPServer(8000, main.makeSite()) 
    77service.setServiceParent(application) 
    88 
  • branches/convenient-adding/formal/examples/main.py

    r275 r276  
    2828    ] 
    2929 
    30 def makeSite(application): 
     30def makeSite(): 
    3131    root = RootPage() 
    32     site = appserver.NevowSite(root, logPath='web.log'
     32    site = appserver.NevowSite(root, logPath="web.log"
    3333    return site 
    3434 
     
    111111setattr(RootPage, 'child_formal.css', formal.defaultCSS) 
    112112setattr(RootPage, 'child_js', formal.formsJS) 
     113 
     114if __name__ == '__main__': 
     115     
     116    import sys 
     117    from twisted.internet import reactor 
     118    from twisted.python import log 
     119     
     120    if len(sys.argv) > 1: 
     121        port = int(sys.argv[1]) 
     122    else: 
     123        port = 8000 
     124     
     125    log.startLogging(sys.stdout) 
     126    site = makeSite() 
     127    reactor.listenTCP(port, site) 
     128    reactor.run() 
     129