Skip to content

Commit

Permalink
Simple support for WSGI (no SSL yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed May 1, 2011
1 parent dcecc68 commit 2fd6efa
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 263 deletions.
4 changes: 2 additions & 2 deletions radicale.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import optparse
import signal
import threading
from wsgiref.simple_server import make_server

import radicale

Expand Down Expand Up @@ -95,13 +96,12 @@

# Create calendar servers
servers = []
server_class = radicale.HTTPSServer if options.ssl else radicale.HTTPServer
shutdown_program = threading.Event()

for host in options.hosts.split(','):
address, port = host.strip().rsplit(':', 1)
address, port = address.strip('[] '), int(port)
servers.append(server_class((address, port), radicale.CalendarHTTPHandler))
servers.append(make_server(address, port, radicale.Application()))

# SIGTERM and SIGINT (aka KeyboardInterrupt) should just mark this for shutdown
signal.signal(signal.SIGTERM, lambda *_: shutdown_program.set())
Expand Down
Loading

0 comments on commit 2fd6efa

Please sign in to comment.