AmbiguousMethods exception for presentation tier

6 views
Skip to first unread message

Terrence Brannon

unread,
May 12, 2015, 8:59:12 PM5/12/15
to nagare...@googlegroups.com
I created two presentation models for instances of the class
BodyTextEditor. A default one:
and an edit one:

I had no problems before this. But now, my app is dying with the error:

"""
AmbiguousMethods: ([Method(<function render at 0x7f8f940c6ed8>,
Signature([Test(IsInstance(Local('self')), Class(<class
'obflparserui.app.BodyTextEditor'>, True)),
Test(IsInstance(Local('renderer')), Class(<type 'object'>, True)),
Test(IsInstance(Local('comp')), Class(<type 'object'>, True)),
Test(IsInstance(Local('model')), Class(<type 'NoneType'>, True))]),
115, None), Method(<function render at 0x7f8f940ca140>,
Signature([Test(IsInstance(Local('self')), Class(<class
'obflparserui.app.BodyTextEditor'>, True)),
Test(IsInstance(Local('renderer')), Class(<type 'object'>, True)),
Test(IsInstance(Local('comp')), Class(<type 'object'>, True)),
Test(IsInstance(Local('model')), Class(<type 'NoneType'>, True))]),
116, None)], (<obflparserui.app.BodyTextEditor object at
0x7f8f74bc69d0>, <nagare.namespaces.xhtml.Renderer object at
0x7f8f74bc6f50>, <component with default model at 0x7f8f74bc6a10 on
object <obflparserui.app.BodyTextEditor object at 0x7f8f74bc69d0>>,
None), {})
"""

the reason this is happening is on line 831 we see:

    h << self.body

and self.body is instantiated to a component.Component() instance
whose object is a BodyTextEditor() and whose presentation model is set
to None (hence the default one):

Therefore the default rendering method for BodyTextEditor on line 359
should be the obvious one to choose. But for some reason, nagare is
confused and thinks there is some possibility that the method on line
388 (the alternative presentation model named 'edit') could be a
candidate as well. Why is this?

Terrence Brannon

unread,
May 13, 2015, 2:01:51 PM5/13/15
to nagare...@googlegroups.com
This problem still exists. I have a workaround. as I said, there are two presentation models for instances of the class
When the default one has a decorator like this:
@presentation.render_for(BodyTextEditor)
then the AmbiguousMethods exception is thrown.

When the default decorator looks like this:
@presentation.render_for(BodyTextEditor, model='normal')

then the program seems to work fine. But the default view in the Counter example does not have a model name added to it:

and it works just fine.

Sylvain Prat

unread,
May 13, 2015, 2:14:01 PM5/13/15
to nagare...@googlegroups.com
Hi,

Your gist file show 2 different lines (359, 388) with:
@presentation.render_for(BodyTextEditor)

That's why you get an "ambiguous method" error message. How can nagare know which render function it should use when rendering the default view of a BodyTextEditor instance?

Sylvain



--
You received this message because you are subscribed to the Google Groups "Nagare users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nagare-users...@googlegroups.com.
To post to this group, send email to nagare...@googlegroups.com.
Visit this group at http://groups.google.com/group/nagare-users.
For more options, visit https://groups.google.com/d/optout.



--
Sylvain PRAT
+33 06 78 71 51 21
Reply all
Reply to author
Forward
0 new messages