On Mon, May 18, 2009 at 18:06, Thomas Mortagne <[email protected]> wrote: > Hi, > > On Mon, May 18, 2009 at 17:53, Thomas Eveilleau <[email protected]> wrote: >> Hello guys, >> >> I'm developing my first application in syntax 2 for a customer. >> I started on a 1.8.2 XE and just moved on a 1.8 Snapshot (the latest >> build - 05/16). >> >> Here is my problem : >> I have a little #if in a #foreach that works on my 1.8.2 but not on my >> 1.8 Snapshot and I totally don't know why. >> >> #set($tradliste = $doc.getObjects("RimayCode.Traduction")) >> #foreach($traduc in $tradliste) >> #if($!traduc.langue == "Francais") >> $!traduc.langue : $!traduc.traduction <br /> >> #end >> #end >> >> On my 1.8.2 the "foreach" returns all the objects with the good values, >> and the "if" is a filter to display the items with a "Francais" value in >> the "langue" field. >> On my 1.8 Snapshot the "foreach" returns all the objects with the good >> values, but the "if" doesn't work : not any result. >> >> There is probably a pb, something new to do to create a test like this >> but I can't see what... >> >> "langue" is a static list with 4 options (1=Francais|2=Tibetain|3=...) >> >> Any idea ? > > The problem is that com.xpn.xwiki.api.Object.get(String) call > XWikiDocument display internally and don't just return the value. > Since XWikiDocument display is supposed to return html, in 2.0 it's > always enclosed in a {{html}}{{/html}}. Maybe we should: > 1) put the {{html}}{{/html}} only if we find "<" or ">" in the content > 2) or just never put the {{html}} when it's a StringProperty. > > I think the best would be that Object.get does not use display but > return the value but it's too big change to be done on the old model > (something to thing about for the new one) so I would prefer 1) for > now. > > WDYT ?
Note that there is no way to get the value from com.xpn.xwiki.api.Object without using display() so it's kind of blocker for scripting. > >> >> Thomas >> >> _______________________________________________ >> devs mailing list >> [email protected] >> http://lists.xwiki.org/mailman/listinfo/devs >> > > > > -- > Thomas Mortagne > -- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

