Ticket #67 (closed bug: fixed)

Opened 10 years ago

Last modified 10 years ago

The serializer can't serialize a list of DOMs

Reported by: apoirier Owned by: apoirier
Priority: major Component: presentation tier
Version: 0.3.0 Keywords:


Exception :

NoApplicableMethods: (([<Element div at 2a9f0a0>, <Element div at 2a9f0d8>], 'text/html', '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', False), {})

with this code:

from nagare import presentation, ajax

class C:

@presentation.render_for(C, model='async')
def render(self, h, *args):
    h << h.div('foo')
    h << h.div('bar')
    return h.root  # Returning a list of 2 DOMs

def render(self, h, comp, *args):
    h << h.div(id='async_div')
    h << h.a('Click me').action(ajax.Update(
                              render=lambda h: comp.render(h, model='async'),
    return h.root

Change History

comment:1 Changed 10 years ago by apoirier

  • Status changed from new to closed
  • Resolution set to fixed

comment:2 Changed 10 years ago by bertrand.croq

I still get the exception.

Changing serialize.py:111 from:

@peak.rules.when(serialize, ((list, tuple),))


@peak.rules.when(serialize, 'isinstance(output, (list, tuple))')

fixes the exception.

comment:3 Changed 10 years ago by bertrand.croq

Updating PEAK-Rules fixes the problem with trunk/nagare/core/nagare/serializer.py@315#L111.

Note: See TracTickets for help on using tickets.