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
>
>   

-- 
Ricardo Rodríguez
CTO
eBioTIC.
Life Sciences, Data Modeling and Information Management Systems

_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to