[xwiki-users] xwiki.getDocument( "fulldocname") never returns null
Hi, In XE 2.7.2 and 3.1, using Groovy in a wiki page, a call to - xwiki.getDocument( "Main.WebHome") returns the correct document object - xwiki.getDocument( "WebHome") returns the WebHome doc object of the current space (not really documented in the javadoc) - xwiki.getDocument( "NotExistingDocName") returns a Document object (a empty one I suppose) instead of a null Is it a bug or do I miss something ? Is there another way to test that a page, specified by its name, exists ? Thanks Maxime Sinclair
Hi, On Aug 22, 2011, at 5:41 PM, Maxime Sinclair wrote:
Hi,
In XE 2.7.2 and 3.1, using Groovy in a wiki page, a call to - xwiki.getDocument( "Main.WebHome") returns the correct document object - xwiki.getDocument( "WebHome") returns the WebHome doc object of the current space (not really documented in the javadoc) - xwiki.getDocument( "NotExistingDocName") returns a Document object (a empty one I suppose) instead of a null
Is it a bug or do I miss something ?
It's a feature. It creates a doc if it doesn't exist (but not saved).
Is there another way to test that a page, specified by its name, exists ?
xwiki.getDocument( "NotExistingDocName").isNew(). Thanks -Vincent
Thank you for you prompt reply and for the tip. It's a code feature but a javadoc issue : http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org... and this link was found on http://platform.xwiki.org/xwiki/bin/view/DevGuide/API Hope this help to enhance xwiki documentation :) 2011/8/22 Vincent Massol <vincent@massol.net>:
Hi,
On Aug 22, 2011, at 5:41 PM, Maxime Sinclair wrote:
Hi,
In XE 2.7.2 and 3.1, using Groovy in a wiki page, a call to - xwiki.getDocument( "Main.WebHome") returns the correct document object - xwiki.getDocument( "WebHome") returns the WebHome doc object of the current space (not really documented in the javadoc) - xwiki.getDocument( "NotExistingDocName") returns a Document object (a empty one I suppose) instead of a null
Is it a bug or do I miss something ?
It's a feature. It creates a doc if it doesn't exist (but not saved).
Is there another way to test that a page, specified by its name, exists ?
xwiki.getDocument( "NotExistingDocName").isNew().
Thanks -Vincent
_______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
On Aug 23, 2011, at 9:33 AM, Maxime Sinclair wrote:
Thank you for you prompt reply and for the tip.
It's a code feature but a javadoc issue : http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org... and this link was found on http://platform.xwiki.org/xwiki/bin/view/DevGuide/API
Hope this help to enhance xwiki documentation :)
A patch would have been awesome but yes it helps ;) I've fixed it: https://github.com/xwiki/xwiki-platform/commit/fb701a4caf9dcfc77415d19756627... Thanks -Vincent
2011/8/22 Vincent Massol <vincent@massol.net>:
Hi,
On Aug 22, 2011, at 5:41 PM, Maxime Sinclair wrote:
Hi,
In XE 2.7.2 and 3.1, using Groovy in a wiki page, a call to - xwiki.getDocument( "Main.WebHome") returns the correct document object - xwiki.getDocument( "WebHome") returns the WebHome doc object of the current space (not really documented in the javadoc) - xwiki.getDocument( "NotExistingDocName") returns a Document object (a empty one I suppose) instead of a null
Is it a bug or do I miss something ?
It's a feature. It creates a doc if it doesn't exist (but not saved).
Is there another way to test that a page, specified by its name, exists ?
xwiki.getDocument( "NotExistingDocName").isNew().
Thanks -Vincent
participants (2)
-
Maxime Sinclair -
Vincent Massol