[Python-modules-commits] r10248 - in packages/pastescript/trunk/debian/patches (1 file)
piotr at users.alioth.debian.org
piotr at users.alioth.debian.org
Mon Nov 2 23:02:44 UTC 2009
Date: Monday, November 2, 2009 @ 23:02:40
Author: piotr
Revision: 10248
try to remove all /.*templates/ directories when guessing template path
(various applications use different name for this directory)
Modified:
packages/pastescript/trunk/debian/patches/03_try_to_find_templates_in_system_dir.dpatch
Modified: packages/pastescript/trunk/debian/patches/03_try_to_find_templates_in_system_dir.dpatch
===================================================================
--- packages/pastescript/trunk/debian/patches/03_try_to_find_templates_in_system_dir.dpatch 2009-11-02 22:48:32 UTC (rev 10247)
+++ packages/pastescript/trunk/debian/patches/03_try_to_find_templates_in_system_dir.dpatch 2009-11-02 23:02:40 UTC (rev 10248)
@@ -7,8 +7,16 @@
@DPATCH@
diff -urNad pastescript-1.7.3~/paste/script/templates.py pastescript-1.7.3/paste/script/templates.py
--- pastescript-1.7.3~/paste/script/templates.py 2008-11-10 20:46:10.000000000 +0100
-+++ pastescript-1.7.3/paste/script/templates.py 2009-10-29 10:04:23.938996504 +0100
-@@ -45,13 +45,27 @@
++++ pastescript-1.7.3/paste/script/templates.py 2009-11-02 22:34:44.854305689 +0100
+@@ -5,6 +5,7 @@
+ import inspect
+ import copydir
+ import command
++import re
+
+ from paste.util.template import paste_script_template_renderer
+
+@@ -45,13 +46,29 @@
mod = sys.modules[self.__class__.__module__]
return os.path.dirname(mod.__file__)
@@ -16,13 +24,15 @@
+ """Returns full path to template directory if it's found in
+ /usr/local/share/paster_templates/ or /usr/share/paster_templates/"""
+
++ tpldir_pattern = re.compile('/[^/]*templates/')
++
+ for d in ('/usr/local/share/paster_templates/', '/usr/share/paster_templates/'):
+ directory = os.path.join(d, *args)
+ if os.path.isdir(directory):
+ return directory
-+ # remove paster_templates if it's in the args and try again
++ # remove .*templates directory if it's in the args and try again
+ args_joined = os.path.join(*args)
-+ directory = os.path.join(d, args_joined.replace('paster_templates/', ''))
++ directory = os.path.join(d, tpldir_pattern.sub('/', args_joined))
+ if os.path.isdir(directory):
+ return directory
+
More information about the Python-modules-commits
mailing list