Being a beginner with Turbogears, I bumped into a problem while trying
to generate some WML pages. The client device (a mobile phone, but also
Firefox with the WML extension) does not recognise the generated page
as WML.
Looking at the output of Turbogears I noticed the DOCTYPE tag is
different. Instead of the required:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
the page comes out like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
Reading some threads in this forum and other sources, it seems the
problem is the serializer of Kid: is there set it so it passes the
DOCTYPE specified in the .kid page or, at least, to bypass it?
Of course I tried to play with the kid.outputformat in app.cfg, but
with no results, as all the flavours of serializer available don't fit
my needs.
Thanks for any help you can give me!
Kid output can be tweaked easily in regard to xml flavor and formatting.
Though WML is not one of the predefined formats, you can easily create
it like that:
wml_doctype = ('wml', "-//WAPFORUM//DTD WML 1.1//EN",
"http://www.wapforum.org/DTD/wml_1.1.xml")
format_wml = kid.XMLSerializer(doctype=wml_doctype)
Then, you would use it like this:
@expose(template="rooster.templates.welcome", format=format_wml)
I have added WML as a predefined output method to Kid now, so in Kid
0.9.5 you will be able to write format='wml' or configure it globally
with kid.outputformat="wml" in your app.cfg file.
-- Christoph
Thanks, it works!
ppdo