[web] don't rename resources in gen-static-datadir stable
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 10 Oct 2013 10:02:29 +0200
branchstable
changeset 9306 8ab0e601d418
parent 9305 f7a738afc295
child 9307 fe0e1863a137
[web] don't rename resources in gen-static-datadir We should use the result from WebConfiguration.locate_resource to know which file to copy, not what name to copy it to. The destination file should be the name of the resource, as the client will request it. This matters in the case of cubicweb.css which locate_resource might rewrite to cubicweb.old.css. Closes #3206129
web/webctl.py
--- a/web/webctl.py	Wed Oct 23 14:18:58 2013 +0200
+++ b/web/webctl.py	Thu Oct 10 10:02:29 2013 +0200
@@ -87,10 +87,10 @@
                 resources.update(osp.join(rel_dirpath, f) for f in filenames)
         # locate resources and copy them to destination
         for resource in resources:
-            dirname = osp.dirname(resource)
-            dest_resource = osp.join(dest, dirname)
-            if not osp.isdir(dest_resource):
-                os.makedirs(dest_resource)
+            dest_resource = osp.join(dest, resource)
+            dirname = osp.dirname(dest_resource)
+            if not osp.isdir(dirname):
+                os.makedirs(dirname)
             resource_dir, resource_path = config.locate_resource(resource)
             copy(osp.join(resource_dir, resource_path), dest_resource)
         # handle md5 version subdirectory