added automagic vhost support
This commit is contained in:
parent
e6e65d31c9
commit
5a1d3fc17e
|
@ -60,6 +60,14 @@ class WcsPublisher(Publisher):
|
|||
return exc.render()
|
||||
return Publisher.format_publish_error(self, exc)
|
||||
|
||||
|
||||
class WcsVHostPublisher(WcsPublisher):
|
||||
def try_publish(self, request):
|
||||
wcs.APP_DIR = os.path.join('/var/tmp/wcs', request.get_server())
|
||||
init_dir()
|
||||
return wcs.WcsPublisher.try_publish(self, request)
|
||||
|
||||
|
||||
def create_publisher():
|
||||
init_dir()
|
||||
session_manager = sessions.PickleSessionManager()
|
||||
|
@ -70,3 +78,16 @@ def create_publisher():
|
|||
display_exceptions = 'plain',
|
||||
#error_email = "fpeters@entrouvert.com",
|
||||
session_cookie_path = '/')
|
||||
|
||||
def create_vhost_publisher():
|
||||
session_manager = sessions.PickleSessionManager()
|
||||
|
||||
if not os.path.exists(APP_DIR):
|
||||
os.mkdir(APP_DIR)
|
||||
|
||||
return WcsVHostPublisher(RootDirectory(),
|
||||
session_manager = session_manager,
|
||||
session_cookie_name = 'wcs',
|
||||
display_exceptions = 'plain',
|
||||
#error_email = "fpeters@entrouvert.com",
|
||||
session_cookie_path = '/')
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#! /usr/bin/env python
|
||||
|
||||
from quixote.server.scgi_server import run
|
||||
import sys
|
||||
import wcs
|
||||
|
||||
run(wcs.create_publisher, port=3001, script_name = '')
|
||||
if '--vhosts' in sys.argv:
|
||||
run(wcs.create_vhost_publisher, port=3001, script_name = '')
|
||||
else:
|
||||
run(wcs.create_publisher, port=3001, script_name = '')
|
||||
|
|
Loading…
Reference in New Issue