Hi Arnaud, I have indeed repeated this problem. It appears that I have introduced a bug when I fixed http://jira.xwiki.org/jira/browse/XWIKI-5405. This bug nolonger exists on the 2.6 trunk due to additional refactoring and I will work on a targeted patch for v2.5.1 Terribly sorry for the inconvenience and thank you for the report!
Caleb On 10/28/2010 06:25 PM, [Ricardo Rodriguez] eBioTIC. wrote: > Hi! > > Arnaud bourree wrote: >> Hello >> >> I put a file Text.txt as attachment in a page: Sandbox.Page1 >> I in an other page Sandbox.Page2, I write the following script: >> {{groovy}} >> def mydoc=xwiki.getDocument('Sandbox.Page1') >> def myfile=mydoc.getAttachment('Text.txt') >> println "|"+mydoc+"|"+myfile >> {{/goovy}} >> The result is >> |Sandbox.Page1|null >> >> If I put the same script in Sandbox.Page2, the result become: >> |Sandbox.Page1|com.xpn.xwiki.api.attachm...@331be8 >> > > I don't understand the situation: do you have two documents? One having > an attachment, and another one without it? In any case, myfile gets an > array: classname (com.xpn.xwiki.api.Attachment) and an object ID. I > can't explain why it varies though. >> Why cannot get attachments from other document? >> > > Check this... > > http://ebiotic.net/bin/ICT/HasAttachment#Attachments > http://ebiotic.net/bin/ICT/GetAttachment#Attachments > > This should help: > > http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/com/xpn/xwiki/platform/xwiki-core/2.5/xwiki-core-2.5-javadoc.jar/!/com/xpn/xwiki/api/Attachment.html > > Please, take into account that I'm not a maven! I've just picked up some > ideas here and there. Please, consider critically this message! Thanks. >> I run XWiki 2.5 with Tomcat 6.0.28, Mysql 5.1.49, Ubuntu 10.10 >> >> Arnaud. >> _______________________________________________ >> users mailing list >> users@xwiki.org >> http://lists.xwiki.org/mailman/listinfo/users >> >> > _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users