moved adeline special casing elsewhere so it is no longer necessary to override
try_publish
This commit is contained in:
parent
273baa52cf
commit
4a7427d009
|
@ -12,9 +12,6 @@ _1 = _
|
|||
__builtin__.__dict__['_'] = lambda x: unicode(_1(str(x)), 'utf-8').encode('iso-8859-1')
|
||||
__builtin__.__dict__['N_'] = lambda x: x
|
||||
|
||||
if not os.path.exists(APP_DIR):
|
||||
os.mkdir(APP_DIR)
|
||||
|
||||
from quixote import enable_ptl, errors, get_session, redirect, get_session_manager
|
||||
from quixote.publish import Publisher
|
||||
from quixote.directory import Directory
|
||||
|
@ -28,6 +25,17 @@ import admin.root
|
|||
import forms.root
|
||||
import liberty.root
|
||||
|
||||
|
||||
def init_dir():
|
||||
global app_dir
|
||||
if not os.path.exists(APP_DIR):
|
||||
os.mkdir(APP_DIR)
|
||||
app_dir = wcs.APP_DIR
|
||||
wcs.misc.filename = os.path.join(app_dir, 'config.pck')
|
||||
wcs.misc.reload_cfg()
|
||||
storage.FilesStorage.BASEDIR = app_dir
|
||||
|
||||
|
||||
class RootDirectory(Directory):
|
||||
_q_exports = ["", "admin", "forms", "login", "logout", "liberty"]
|
||||
|
||||
|
@ -52,18 +60,8 @@ class WcsPublisher(Publisher):
|
|||
return exc.render()
|
||||
return Publisher.format_publish_error(self, exc)
|
||||
|
||||
def try_publish(self, request):
|
||||
# called for each request, should set APP_DIR here for a kind of
|
||||
# virtual hosting (set it from HTTP header, hostname, uri, whatever)
|
||||
global app_dir
|
||||
app_dir = wcs.APP_DIR
|
||||
wcs.misc.filename = os.path.join(app_dir, 'config.pck')
|
||||
wcs.misc.reload_cfg()
|
||||
storage.FilesStorage.BASEDIR = app_dir
|
||||
return Publisher.try_publish(self, request)
|
||||
|
||||
|
||||
def create_publisher():
|
||||
init_dir()
|
||||
session_manager = sessions.PickleSessionManager()
|
||||
|
||||
return WcsPublisher(RootDirectory(),
|
||||
|
|
Loading…
Reference in New Issue