def copy_template(self, src, dst, context={}): tpl = os.path.join(os.getcwd(), 'up/templates/', self.name, src) try: with open (tpl, 'r') as fd: tpl = template(fd.read(), context, stringio=True) return self.put(local_path=tpl, remote_path=dst, use_glob=False) except IOError: log.warning("Cannot load template: %s" % tpl)
def interpolate_string(self, s, context=None): if not context: context = self.get_context() return template(s, context)