gavo.formal.twistedpatch module

Code to add some basic nevow functionality back to twisted.

This needs to be imported as early as possible after importing twisted.web for the first time.

The features were adding include:

  • have nevow tag[] syntax again.

  • swallow attributes with None values in tags

  • (Ab)use slotData to manage what was nevow:data, pass it into the render method as tag.slotData

  • functions are allowed as render values

class gavo.formal.twistedpatch.Raw[source]

Bases: object

a thing to stick into stan trees that can write whatever it wants into the serialised result.

Just override getContent and return a byte string from it.

getContent(destFile)[source]
class gavo.formal.twistedpatch.Tag(tagName, attributes=None, children=None, render=None, filename=None, lineNumber=None, columnNumber=None, data=None)[source]

Bases: twisted.web._stan.Tag

clone(deep=True, newData=<class 'gavo.formal.twistedpatch._NoData'>)[source]

Return a clone of this tag. If deep is True, clone all of this tag’s children. Otherwise, just shallow copy the children list without copying the children themselves.

gavo.formal.twistedpatch.patchTwTemplate(name, obj)[source]

monkeypatches whatever module holds the twisted.web.template definitions.