How do I add a doctype using stan?
Okay, I have searched but have not found an answer and I am sure it is obvious. I am using nevow tags and want to have the doctype so that validation works. I am not using xmlfile or xmlstr. I tried to do the following. docFactory = stan.loaders( tags.xml('DOCTYPE etc etc'), tags.html[ tags.head[tags.title['Help']], tags.body['How do I add a doctype'] ] ) and of course it failed. Any help appreciated. Thanks Michael
Michael M wrote:
Okay, I have searched but have not found an answer and I am sure it is obvious. I am using nevow tags and want to have the doctype so that validation works. I am not using xmlfile or xmlstr.
I tried to do the following. docFactory = stan.loaders( tags.xml('DOCTYPE etc etc'), tags.html[ tags.head[tags.title['Help']], tags.body['How do I add a doctype'] ] )
loaders.stan only takes one arg so put the tags.xml and the tags.html top node in a tuple or list. The second arg is the name of the pattern to extract from the template in the first arg. docFactory = loaders.stan( ( tags.xml('DOCTYPE etc etc'), tags.html[ tags.head[tags.title['Help']], tags.body['How do I add a doctype'] ] ) ) - Matt -- __ / \__ Matt Goodall, Pollenation Internet Ltd \__/ \ w: http://www.pollenation.net __/ \__/ e: matt@pollenation.net / \__/ \ t: +44 (0)113 2252500 \__/ \__/ / \ Any views expressed are my own and do not necessarily \__/ reflect the views of my employer.
Matt Goodall wrote: [...]
loaders.stan only takes one arg so put the tags.xml and the tags.html top node in a tuple or list. The second arg is the name of the pattern to extract from the template in the first arg.
Wow, managed to contradict myself in a single paragraph! Ignore the paragraph and look at the method signature instead: class stan(object): ... def __init__(self, stan=None, pattern=None): ... Sorry about that and I hope the problem is clearer now. - Matt -- __ / \__ Matt Goodall, Pollenation Internet Ltd \__/ \ w: http://www.pollenation.net __/ \__/ e: matt@pollenation.net / \__/ \ t: +44 (0)113 2252500 \__/ \__/ / \ Any views expressed are my own and do not necessarily \__/ reflect the views of my employer.
Hi, your solution worked. I gather that what you are correcting is that stan will take two arguments, stan=(tags.X etc) and pattern=whatever. I would still have to enclose my tag tree in a tuple/list anyway as far as I can tell. Thanks again for your help. Michael On 2/9/06, Matt Goodall <matt@pollenation.net> wrote:
Matt Goodall wrote: [...]
loaders.stan only takes one arg so put the tags.xml and the tags.html top node in a tuple or list. The second arg is the name of the pattern to extract from the template in the first arg.
Wow, managed to contradict myself in a single paragraph!
Ignore the paragraph and look at the method signature instead:
class stan(object): ... def __init__(self, stan=None, pattern=None): ...
Sorry about that and I hope the problem is clearer now.
- Matt
-- __ / \__ Matt Goodall, Pollenation Internet Ltd \__/ \ w: http://www.pollenation.net __/ \__/ e: matt@pollenation.net / \__/ \ t: +44 (0)113 2252500 \__/ \__/ / \ Any views expressed are my own and do not necessarily \__/ reflect the views of my employer.
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
Thanks Matt, that did the trick. When I get a moment I will stick it on the nevow wiki. Michael
loaders.stan only takes one arg so put the tags.xml and the tags.html top node in a tuple or list. The second arg is the name of the pattern to extract from the template in the first arg.
docFactory = loaders.stan( ( tags.xml('DOCTYPE etc etc'), tags.html[ tags.head[tags.title['Help']], tags.body['How do I add a doctype'] ] ) )
- Matt
-- __ / \__ Matt Goodall, Pollenation Internet Ltd \__/ \ w: http://www.pollenation.net __/ \__/ e: matt@pollenation.net / \__/ \ t: +44 (0)113 2252500 \__/ \__/ / \ Any views expressed are my own and do not necessarily \__/ reflect the views of my employer.
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
participants (2)
-
Matt Goodall
-
Michael M