hmm i think i know what happen, there is a major difference between
velocity and other script languages binding: the VelocityContext is
filled at request startup and ScriptContext is filled the first time
it's used, so the first time a groovy macro is used for example.

So in groovy macro "doc" binding is provided by looking at the context
each time a groovy macro is executed. That is to make sure the binding
is properly synchronized with the context.

Only real solution i can see is to fix
http://jira.xwiki.org/jira/browse/XWIKI-4262 (and have the proper
current document in the context instead of the current hack) and
provide a $context.macro.document (this should be done anyway even
before XWIKI-4262 is fixed since it's part of the macro informations).

Asiri in the meantime i think you should set "sdoc" in context instead
of "doc". I far as i can see in the code hasProgrammingRights do the
following:
* try sdoc content author
* if no sdoc try doc content author
* if no doc try current user

On Fri, Mar 19, 2010 at 16:20, Alaina <[email protected]> wrote:
> On Fri, Mar 19, 2010 at 7:52 AM, Asiri Rathnayake
> <[email protected]> wrote:
>> Can you try something like:
>>
>> {{groovy}}
>> def currentDoc = xcontext.vcontext.doc;
>> {{/groovy}}
>>
>> (in macro code)
>>
>> I'm just guessing, need to investigate later.
>>
>> - Asiri
>
> Hi Asiri,
>
> Thanks, I tried your suggestion, it works as intended.
>
> --Alaina
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
>



-- 
Thomas Mortagne
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to