On Sat, Apr 4, 2009 at 2:45 PM, mgm <mgm7...@gmail.com> wrote: > > That did the trick! > > I apologize for the hubris of a newbie, but I think this is a bug in > LiftWeb. > > It was getting executed, but I guess with out the declaration, the > result was not getting implicitly converted from List[Node] to > NodeSeq. > The framework was finding & executing the method, but because the > returned value was not NodeSeq, it did not replace the HTML, I'm > guessing. > > Lift should check & replace if the result any Seq[Node], not just > NodeSeq. > > Should I report this as a bug?
This is not a bug. There are only so many return types that Lift can check for... and some get eliminated by type erasure. So, there's no way to check if something is a List[Node] without checking each member of the List and that's a real challenge in the particularly gnarly code that does snippet dispatch by convention (see net.liftweb.http.LiftSession.scala:724). The convention is that the method must return a NodeSeq. Alternatively, you can snippet handlers on a page-by-page basis with SiteMap or globally through LiftRules. > > > > On Apr 4, 4:26 pm, Derek Chen-Becker <dchenbec...@gmail.com> wrote: > > Change your list def to > > > > def list(xhtml : NodeSeq) : NodeSeq = { ... > > > > If you don't explicitly set the return type to NodeSeq, sometimes things > > don't get properly applied. > > > > Derek > > > > On Sat, Apr 4, 2009 at 2:55 PM, mgm <mgm7...@gmail.com> wrote: > > > > > I added some more debug prints. The list method appears to be doing > > > what I expected, though the empty list elements are odd. > > > > > ============ AP.scala (extract) > > > def list(xhtml: NodeSeq) = { > > > System.err.println("*************** list: " + xhtml) > > > val r = Airport.findAll.flatMap(ap => { > > > System.err.println("ap=" + ap) > > > bind("ap", xhtml, > > > "code" -> ap.code, "lat" -> ap.lattitude, "lon" -> > > > ap.longitude) > > > }) > > > System.err.println("*** r=" + r) > > > r > > > } > > > > > ============ console log =========== > > > *************** list: > > > <tr> > > > <td><ap:code>XYZ</ap:code></td> > > > <td><ap:lat>0</ap:lat></td> > > > <td><ap:lon>To Do</ap:lon></td> > > > </tr> > > > > > ap=com.flyspy.bf.model.Airport= > > > {id=1,code=ORD,lattitude=50.0,longitude=-60.0} > > > ap=com.flyspy.bf.model.Airport= > > > {id=2,code=MSP,lattitude=40.0,longitude=-60.0} > > > *** r=List( > > > , <tr> > > > <td>ORD</td> > > > <td>50.0</td> > > > <td>-60.0</td> > > > </tr>, > > > , > > > , <tr> > > > <td>MSP</td> > > > <td>40.0</td> > > > <td>-60.0</td> > > > </tr>, > > > ) > > > WARN - Snippet Failure: SnippetFailure(/airports -> ParsePath(List > > > (airports),,true,false),Full(AP.list),Method Not Found) > > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---