Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def adjust_uri(self, uri, relativeto):
- """Adjust the given uri relative to a filename.
- This method is used by mako for filesystem based reasons.
- In dotted lookup land we don't adjust uri so we just return
- the value we are given without any change.
- """
- if uri.startswith('local:'):
- 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')
- if not self.template_filenames_cache.has_key(uri):
- # feed our filename cache if needed.
- self.template_filenames_cache[uri] = result
- else:
- # no dot detected, just return plain name
- result = uri
- return result
Add Comment
Please, Sign In to add comment