Created
January 8, 2010 16:03
-
-
Save chbrown/272130 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r c07cda5335f1 tg/dottednamesupport.py | |
--- a/tg/dottednamesupport.py Sun Nov 29 14:41:33 2009 -0700 | |
+++ b/tg/dottednamesupport.py Fri Jan 08 10:03:10 2010 -0600 | |
@@ -59,16 +59,23 @@ | |
""" | |
if uri.startswith('local:'): | |
- uri = uri.replace('local:', tg.config['pylons.package']+'.') | |
+ package = tg.config['pylons.package'] | |
+ if relativeto: | |
+ cwd = os.getcwd() | |
+ assert cwd.endswith(package) | |
+ path_in_common = cwd[:-len(package)] | |
+ assert relativeto.startswith(path_in_common) | |
+ package = relativeto[len(path_in_common):] | |
+ package = package.split('/', 2)[0] | |
+ | |
+ uri = uri.replace('local:', package + '.') | |
if '.' in uri: | |
# We are in the DottedTemplateLookup system so dots in | |
# names should be treated as a Python path. Since this | |
# method is called by template inheritance we must | |
# support dotted names also in the inheritance. | |
- result = tg.config['pylons.app_globals' | |
- ].dotted_filename_finder.get_dotted_filename( | |
- template_name=uri, | |
- template_extension='.mak') | |
+ result = tg.config['pylons.app_globals'].\ | |
+ dotted_filename_finder.get_dotted_filename(template_name=uri, template_extension='.mak') | |
if not self.template_filenames_cache.has_key(uri): | |
# feed our filename cache if needed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment