[Twisted-web] docFactory at Nevow Elements

Juanjo Conti jjconti at gmail.com
Sat Oct 10 09:13:41 EDT 2009

2009/10/7 Juanjo Conti <jjconti at gmail.com>:
> Can I change doc_factory in the __init__ method of MyLiveElement?

Yes. It' ok.

class TempElement(LiveElement):

    #docFactory = xmlfile(sibpath(__file__, 'ter.html'))
    jsClass = u'TempDisplay.TempWidget'

    def __init__(self, sitio='', robot=''):
        self.sitio = sitio
        self.robot = robot
        self.client = [c for c in factory.clients.values() if
c['sitio'].ccc == robot.sitio.ccc][0]['self']

        configuracion = robot.robotconfig_set.all()
        entradasanalogicas = [c for c in configuracion if c.tipoio.esEA()]
        registros = [c for c in configuracion if c.tipoio.esRE()]
        salidasdigitales = [c for c in configuracion if c.tipoio.esSD()]
        entradasdigitales = [c for c in configuracion if
        s = render_to_string('tero.html', {'robot': self.robot,
                                           'registros': registros,
                                           'salidasdigitales': salidasdigitales,
        self.docFactory = loaders.xmlstr(s)
        super(TempElement, self).__init__()

Juanjo Conti
blog: http://www.juanjoconti.com.ar

More information about the Twisted-web mailing list