--- a/etwist/server.py Thu Apr 28 17:36:04 2011 +0200
+++ b/etwist/server.py Thu Apr 28 19:42:19 2011 +0200
@@ -86,6 +86,10 @@
# root directory or as a data subdirectory. XXX (adim) : why
# that ?
self.putChild('fckeditor', FCKEditorResource(self.config, ''))
+ self._defineChildResources()
+
+ def _defineChildResources(self):
+ self.putChild(self.config.instance_md5_version(), self)
def getChild(self, path, request):
if not path:
@@ -133,6 +137,9 @@
etc.
"""
+ def _defineChildResources(self):
+ pass
+
def render(self, request):
# XXX: Don't provide additional resource information to error responses
#
@@ -156,8 +163,6 @@
self.putChild('static', NoListingFile(config.static_directory))
self.putChild('fckeditor', FCKEditorResource(self.config, ''))
self.putChild('data', DataLookupDirectory(self.config, ''))
- self.putChild('data%s' % config.instance_md5_version(),
- LongTimeExpiringFile(self.config, ''))
def init_publisher(self):
config = self.config
--- a/web/webconfig.py Thu Apr 28 17:36:04 2011 +0200
+++ b/web/webconfig.py Thu Apr 28 19:42:19 2011 +0200
@@ -300,19 +300,14 @@
if not (self.repairing or self.creating):
self.global_set_option('base-url', baseurl)
httpsurl = self['https-url']
+ datadir_path = 'data/' if self.debugmode else 'data/%s/' % self.instance_md5_version()
if httpsurl:
if httpsurl[-1] != '/':
httpsurl += '/'
if not self.repairing:
self.global_set_option('https-url', httpsurl)
- if self.debugmode:
- self.https_datadir_url = httpsurl + 'data/'
- else:
- self.https_datadir_url = httpsurl + 'data%s/' % self.instance_md5_version()
- if self.debugmode:
- self.datadir_url = baseurl + 'data/'
- else:
- self.datadir_url = baseurl + 'data%s/' % self.instance_md5_version()
+ self.https_datadir_url = httpsurl + datadir_path
+ self.datadir_url = baseurl + datadir_path
def _build_ui_properties(self):
# self.datadir_url[:-1] to remove trailing /
--- a/web/webctl.py Thu Apr 28 17:36:04 2011 +0200
+++ b/web/webctl.py Thu Apr 28 19:42:19 2011 +0200
@@ -32,6 +32,12 @@
from cubicweb.toolsutils import Command, CommandHandler, underline_title
+try:
+ from os import symlink as linkdir
+except ImportError:
+ from shutil import copytree as linkdir
+
+
class WebCreateHandler(CommandHandler):
cmdname = 'create'
@@ -87,6 +93,8 @@
os.makedirs(dest_resource)
resource_dir, resource_path = config.locate_resource(resource)
copy(osp.join(resource_dir, resource_path), dest_resource)
+ # handle md5 version subdirectory
+ linkdir(dest, osp.join(dest, config.instance_md5_version()))
print ('You can use apache rewrite rule below :\n'
'RewriteRule ^/data/(.*) %s/$1 [L]' % dest)