(self, template_path, context_dict, package,
                           output_path)
Render a template as a file in the output package.

    Args:
      template_path: (str) Full path to a template.
      context_dict: (dict) A dictionary to augment the standard template
        dictionary.
      package: (LibraryPackage) output package.
      output_path: (str) file path in the package.

    Returns:
      None
Render a template as a file in the output package.
Render a template as a file in the output package .
def RenderTemplateToFile(self, template_path, context_dict, package,
                           output_path):
    """Render a template as a file in the output package.

    Args:
      template_path: (str) Full path to a template.
      context_dict: (dict) A dictionary to augment the standard template
        dictionary.
      package: (LibraryPackage) output package.
      output_path: (str) file path in the package.

    Returns:
      None
    """
    output_dir, file_name = os.path.split(output_path)

    def WriteFileInPackage(path, content):
      """Writes content to a path in our current package writer."""
      if isinstance(content, unicode):
        content = content.encode('utf-8', errors='ignore')
      out = package.StartFile(os.path.join(output_dir, path))
      out.write(content)
      package.EndFile()

    try:
      context_dict[template_helpers.FILE_WRITER] = WriteFileInPackage
      content = self.RenderTemplate(template_path, context_dict)
      WriteFileInPackage(file_name, content)
    except template_helpers.Halt:
      pass
    del context_dict[template_helpers.FILE_WRITER]
def RenderTemplateToFile ( self , template_path , context_dict , package , output_path ) : output_dir , file_name = os . path . split ( output_path ) def WriteFileInPackage ( path , content ) : """Writes content to a path in our current package writer.""" if isinstance ( content , unicode ) : content = content . encode ( 'utf-8' , errors = 'ignore' ) out = package . StartFile ( os . path . join ( output_dir , path ) ) out . write ( content ) package . EndFile ( ) try : context_dict [ template_helpers . FILE_WRITER ] = WriteFileInPackage content = self . RenderTemplate ( template_path , context_dict ) WriteFileInPackage ( file_name , content ) except template_helpers . Halt : pass del context_dict [ template_helpers . FILE_WRITER ]