[Best practice] Test for Object in Class sheets

Vincent Massol vincent at massol.net
Mon Apr 16 23:03:42 CEST 2007


Hi,

I'd like to propose the following best practice: to test for Object  
existence in class sheets. For example:

#set($obj = $doc.getObject("XWiki.XWikiUsers"))
#if($obj)

...

#else
   This stylesheet must be applied on a document containing a  
XWiki.XWikiUsers object.
#end

If you're all ok I'll add it to the dev guide on http://www.xwiki.org/ 
xwiki/bin/view/DevGuide/BestPractices (I'll remove what's in there  
and send each best practice separately to this list for agreement as  
this is old stuff).

Thanks
-Vincent





More information about the devs mailing list