# This is a generated file. Do not edit.
from StringIO import StringIO
from string import Template
from miro.xhtmltools import urlencode
from miro.frontends.html.template import Handle, fillAttr, quoteAndFillAttr, fillStaticTemplate
from miro.util import quoteattr, escape
from miro import app
from miro import views
from miro import sorts
from miro import indexes
from miro import filters
from miro.platform import resources
from miro import gtcache
_ = gtcache.gettext
def fillTemplate(domHandler, dtvPlatform, eventCookie, bodyTagExtra, *args, **kargs):
    # Start of handle

    # Start user code
    
    replace = "<span>This is a database replace</span>"
    # End user code

    localvars = locals()
    localvars.update(globals())
    handle = Handle(domHandler, localvars, onUnlink = lambda:None)

    # Start of handle

    # Start user code
    # End user code

    localvars = locals()
    localvars.update(globals())
    handle_0 = Handle(domHandler, localvars, onUnlink = lambda:None)

    handle.addSubHandle(handle_0)
    # Start of handle

    # Start user code
    # End user code

    localvars = locals()
    localvars.update(globals())
    handle_1 = Handle(domHandler, localvars, onUnlink = lambda:None)

    handle.addSubHandle(handle_1)


    out = StringIO()
    out.write(u"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n")
    out.write(u'<html dtvPlatform="')
    out.write(quoteattr(urlencode(dtvPlatform)))
    out.write(u'" eventCookie="')
    out.write(quoteattr(urlencode(eventCookie)))
    out.write(u'" xmlns:t="http://www.participatorypolitics.org/" xmlns="http://www.w3.org/1999/xhtml">\n<head>\n<meta content="text/html; charset=utf-8" http-equiv="content-type"></meta>\n\n</head>\n<body')
    out.write(u" " + bodyTagExtra)
    out.write(u'>\n<h1>hide test template</h1>\n')
    if not (True):
        out.write(u'<div>\nhideIf:True\n<span>This is an include</span>\n')
        out.write(u'\n<span>This is a template include</span>\n')
        out.write(u'\n<span>')
        out.write(escape(replace))
        out.write(u'</span>\n<span>')
        out.write(replace)
        out.write(u'</span>\n</div>')
    out.write(u'\n')
    if not (False):
        out.write(u'<div>\nhideIf:False\n<span>This is an include</span>\n')
        out.write(u'\n<span>This is a template include</span>\n')
        out.write(u'\n<span>')
        out.write(escape(replace))
        out.write(u'</span>\n<span>')
        out.write(replace)
        out.write(u'</span>\n</div>')
    out.write(u'\n</body>\n</html>')
    out.seek(0)


    return (out, handle)
