Whoops, I forgot the $ The if line was for checking that the first command succeeded so it checks that the value is not null. try this.
{{velocity}} #set($renamedDoc = $xwiki.getDocument("Blog.AB5/CD6")) #if($renamedDoc) $renamedDoc.rename("Blog.safeDocName") Looks like it Worked! [[Blog.safeDocName]] #else Failed to get doc do you have enough permissions? #end {{/velocity}} Caleb Michael Beetz wrote: > Caleb, > > Thanks, however it leads to my second problem: I am running a wiki farm, > therefore I am getting > "Failed to execute macro: velocity" > I am running it as admin. > > What rights do I have to set? > > Is there HowTo for to set rights in a wiki farm? > > Thanks > mb > > > It works for > > {{velocity}} > #set($renamedDoc = $xwiki.getDocument("Blog.AB5/CD6")) > {{/velocity}} > > It fails for > > {{velocity}} > #set($renamedDoc = $xwiki.getDocument("Blog.AB5/CD6")) > #if(renamedDoc) > ## $renamedDoc.rename("Blog.safeDocName") > ## Looks like it Worked! [[Blog.safeDocName]] #else > ## Failed to get doc do you have enough permissions? > #end > {{/velocity}} > > and fails also running > > {{velocity}} > #set($renamedDoc = $xwiki.getDocument("Blog.AB5/CD6")) > #if(renamedDoc) > $renamedDoc.rename("Blog.safeDocName") > Looks like it Worked! [[Blog.safeDocName]] #else > Failed to get doc do you have enough permissions? > #end > {{/velocity}} > > -----Original Message----- > From: users-boun...@xwiki.org [mailto:users-boun...@xwiki.org] On Behalf Of > Caleb James DeLisle > Sent: Donnerstag, 24. Dezember 2009 04:01 > To: XWiki Users > Subject: Re: [xwiki-users] renaming caused an unreachable page > > You should be able to get hold of the Document using velocity > or groovy code, something like: > > {{velocity}} > #set($renamedDoc = $xwiki.getDocument("Blog.AB5/CD6")) > #if(renamedDoc) > $renamedDoc.rename("Blog.safeDocName") > Looks like it Worked! [[Blog.safeDocName]] > #else > Failed to get doc do you have enough permissions? > #end > {{/velocity}} > > > Caleb > > Michael Beetz wrote: >> Hi all, >> >> I've done a mistake: Renaming a (blog) page to a page having a "/" in the >> name: "AB5 / CD6". >> >> The page is listed in the blog overview and in the document index. However >> I am not able to access / delete / rename that page. >> >> I am using 2.1.1. >> >> Any hints? (except exporting the wiki, deleting it from that file - it's a >> subdirectory within that file, dropping wiki and importing it again) >> Thanks >> mb >> >> ... and by the way: Thanks to all for that great version 2! Merry >> Christmas and a lot of fun & success in 2010 >> _______________________________________________ >> 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 > _______________________________________________ > 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