Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import sys
- import jinja2
- #import codecs
- #Do some pre-processing here that is later used to populate the context variables in the menu
- menu_info={}
- #Render the menu in the output
- #With codecs, in case it was the UTF-8 that was causing problems
- #T = jinja2.Template(codecs.open("./resourcesMenu.xml","rt","utf-8").read())
- T = jinja2.Template(open("./resourcesMenu.xml","rb").read())
- #With stdout.write of the rendered template
- sys.stdout.write(T.render(info=menu_info))
- #With print of the rendered template
- #print(T.render())
- #Bare open (in binary) and dump
- #L = open("./resourcesMenu.xml","rb").read()
- #sys.stdout.write(L)
- # With print
- #print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
- #print("<openbox_pipe_menu>")
- #print(" <item label=\"blah\"/>")
- #print("</openbox_pipe_menu>")
Advertisement
Add Comment
Please, Sign In to add comment