Details
-
Bug
-
Resolution: Fixed
-
Major
-
1.9, 2.0 M1
-
None
-
any
-
display
-
Unit
-
Unknown
-
Description
doc.display( fieldName ) ends up in:
public String display(String fieldname, String type, BaseObject obj, XWikiContext context) { return display(fieldname, type, "", obj, context.getWiki().getCurrentContentSyntaxId(getSyntaxId(), context), context); }
while doc.display( fieldName, mode ) ends up in:
public String display(String fieldname, String mode, String prefix, XWikiContext context) { try { BaseObject object = getxWikiObject(); if (object == null) { object = getFirstObject(fieldname, context); } if (object == null) { return ""; } else { return display(fieldname, mode, prefix, object, context.getDoc() != null ? context.getDoc().getSyntaxId() : getSyntaxId(), context); } } catch (Exception e) { return ""; } }
Both finally call the same method but the way the syntax parameter is determined differs. This can lead to different results even when the display methods are executed in the same context. Here are the steps:
- create a blog article
- change its syntax to xwiki/2.0 and set its content to
{{velocity}}{{html}}#includeForm("X.Y"){{/html}}{{/velocity}}
- edit the article object and put some xwiki/2.0 content
- create the X.Y page in xwiki/1.0 syntax and set its content to
$doc.display("content") ---------- $doc.display("content", "view")
- view the blog article