You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by "Stephen Solka (JIRA)" <ji...@apache.org> on 2007/12/26 19:04:44 UTC

[jira] Created: (JSPWIKI-114) VariableManger does not check "RealPage" for variables during variable lookup

VariableManger does not check "RealPage" for variables during variable lookup
-----------------------------------------------------------------------------

                 Key: JSPWIKI-114
                 URL: https://issues.apache.org/jira/browse/JSPWIKI-114
             Project: JSPWiki
          Issue Type: Bug
          Components: Core & storage
    Affects Versions: 2.6.0, 2.4.104, 2.6.1, 2.8, 3.0
            Reporter: Stephen Solka
            Priority: Minor


When one sets a page variable jspwiki attaches that variable to the realpage variable which exists in the engine's context. But when looking up a variable reference only page is checked for that variable. The result is when realpage and page differ all previously defined variables vanish from scope. This can be seen when defining a variable then using the insertpage plugin. the inserted page can not see any variables defined in the inserter page and thus returns a variable not found error. 

Initial Conversation on HowToUseAVariable which lead to bug:
========
Lets pretend the code on one page called TestPage is

Hello [{$tname}]

Then the code for another page called Tester is

[{SET tname='Stephen'}]
[{InsertPage page='TestPage'}]

It doesnt seem to be working as I would expect. I would expect the output to be

Hello Stephen

but instead I get

Hello No such variable: No variable tname defined.

What am I doing wrong? Why is InsertPage parsing the content of the inserted page prior to insertion? --Stephen

The tname variable is referring to the page variable called "tname" on page "Tester". Variables are always interpreted in the context of the including page, not the included page. This allows you to e.g. create templates which you can insert and control with page variables.

-- JanneJalkanen

If variables are interpreted in the context of the including page why does Tester claim not to know what tname is when inserting a page that references that variable? Controlling a inserted page through page variables is EXACTLY what I am trying to do. But if all page variables defined in the including page lose scope prior to insertion then I fail to see how this is possible? Is it possible to directly manipulate the variables for a page prior to insertion?

-- Stephen 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-114) VariableManger does not check "RealPage" for variables during variable lookup

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12554966 ] 

Janne Jalkanen commented on JSPWIKI-114:
----------------------------------------

Could you also please add an Unit test which allows replication of this issue?

> VariableManger does not check "RealPage" for variables during variable lookup
> -----------------------------------------------------------------------------
>
>                 Key: JSPWIKI-114
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-114
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.4.104, 2.6.0
>            Reporter: Stephen Solka
>            Priority: Minor
>         Attachments: RealPageVariables.patch
>
>
> When one sets a page variable jspwiki attaches that variable to the realpage variable which exists in the engine's context. But when looking up a variable reference only page is checked for that variable. The result is when realpage and page differ all previously defined variables vanish from scope. This can be seen when defining a variable then using the insertpage plugin. the inserted page can not see any variables defined in the inserter page and thus returns a variable not found error. 
> Initial Conversation on HowToUseAVariable which lead to bug:
> ========
> Lets pretend the code on one page called TestPage is
> Hello [{$tname}]
> Then the code for another page called Tester is
> [{SET tname='Stephen'}]
> [{InsertPage page='TestPage'}]
> It doesnt seem to be working as I would expect. I would expect the output to be
> Hello Stephen
> but instead I get
> Hello No such variable: No variable tname defined.
> What am I doing wrong? Why is InsertPage parsing the content of the inserted page prior to insertion? --Stephen
> The tname variable is referring to the page variable called "tname" on page "Tester". Variables are always interpreted in the context of the including page, not the included page. This allows you to e.g. create templates which you can insert and control with page variables.
> -- JanneJalkanen
> If variables are interpreted in the context of the including page why does Tester claim not to know what tname is when inserting a page that references that variable? Controlling a inserted page through page variables is EXACTLY what I am trying to do. But if all page variables defined in the including page lose scope prior to insertion then I fail to see how this is possible? Is it possible to directly manipulate the variables for a page prior to insertion?
> -- Stephen 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-114) VariableManger does not check "RealPage" for variables during variable lookup

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12554470 ] 

Janne Jalkanen commented on JSPWIKI-114:
----------------------------------------

...forgot to add "...because those versions have not yet been released."

> VariableManger does not check "RealPage" for variables during variable lookup
> -----------------------------------------------------------------------------
>
>                 Key: JSPWIKI-114
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-114
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.4.104, 2.6.0
>            Reporter: Stephen Solka
>            Priority: Minor
>         Attachments: RealPageVariables.patch
>
>
> When one sets a page variable jspwiki attaches that variable to the realpage variable which exists in the engine's context. But when looking up a variable reference only page is checked for that variable. The result is when realpage and page differ all previously defined variables vanish from scope. This can be seen when defining a variable then using the insertpage plugin. the inserted page can not see any variables defined in the inserter page and thus returns a variable not found error. 
> Initial Conversation on HowToUseAVariable which lead to bug:
> ========
> Lets pretend the code on one page called TestPage is
> Hello [{$tname}]
> Then the code for another page called Tester is
> [{SET tname='Stephen'}]
> [{InsertPage page='TestPage'}]
> It doesnt seem to be working as I would expect. I would expect the output to be
> Hello Stephen
> but instead I get
> Hello No such variable: No variable tname defined.
> What am I doing wrong? Why is InsertPage parsing the content of the inserted page prior to insertion? --Stephen
> The tname variable is referring to the page variable called "tname" on page "Tester". Variables are always interpreted in the context of the including page, not the included page. This allows you to e.g. create templates which you can insert and control with page variables.
> -- JanneJalkanen
> If variables are interpreted in the context of the including page why does Tester claim not to know what tname is when inserting a page that references that variable? Controlling a inserted page through page variables is EXACTLY what I am trying to do. But if all page variables defined in the including page lose scope prior to insertion then I fail to see how this is possible? Is it possible to directly manipulate the variables for a page prior to insertion?
> -- Stephen 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JSPWIKI-114) VariableManger does not check "RealPage" for variables during variable lookup

Posted by "Stephen Solka (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JSPWIKI-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12554477 ] 

Stephen Solka commented on JSPWIKI-114:
---------------------------------------

Ooops. Chalk it up to my first submition. Thanks for the information.

> VariableManger does not check "RealPage" for variables during variable lookup
> -----------------------------------------------------------------------------
>
>                 Key: JSPWIKI-114
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-114
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.4.104, 2.6.0
>            Reporter: Stephen Solka
>            Priority: Minor
>         Attachments: RealPageVariables.patch
>
>
> When one sets a page variable jspwiki attaches that variable to the realpage variable which exists in the engine's context. But when looking up a variable reference only page is checked for that variable. The result is when realpage and page differ all previously defined variables vanish from scope. This can be seen when defining a variable then using the insertpage plugin. the inserted page can not see any variables defined in the inserter page and thus returns a variable not found error. 
> Initial Conversation on HowToUseAVariable which lead to bug:
> ========
> Lets pretend the code on one page called TestPage is
> Hello [{$tname}]
> Then the code for another page called Tester is
> [{SET tname='Stephen'}]
> [{InsertPage page='TestPage'}]
> It doesnt seem to be working as I would expect. I would expect the output to be
> Hello Stephen
> but instead I get
> Hello No such variable: No variable tname defined.
> What am I doing wrong? Why is InsertPage parsing the content of the inserted page prior to insertion? --Stephen
> The tname variable is referring to the page variable called "tname" on page "Tester". Variables are always interpreted in the context of the including page, not the included page. This allows you to e.g. create templates which you can insert and control with page variables.
> -- JanneJalkanen
> If variables are interpreted in the context of the including page why does Tester claim not to know what tname is when inserting a page that references that variable? Controlling a inserted page through page variables is EXACTLY what I am trying to do. But if all page variables defined in the including page lose scope prior to insertion then I fail to see how this is possible? Is it possible to directly manipulate the variables for a page prior to insertion?
> -- Stephen 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JSPWIKI-114) VariableManger does not check "RealPage" for variables during variable lookup

Posted by "Janne Jalkanen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JSPWIKI-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Janne Jalkanen resolved JSPWIKI-114.
------------------------------------

    Resolution: Fixed

Fixed in 2.6.1-cvs-8

> VariableManger does not check "RealPage" for variables during variable lookup
> -----------------------------------------------------------------------------
>
>                 Key: JSPWIKI-114
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-114
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.4.104, 2.6.0
>            Reporter: Stephen Solka
>            Priority: Minor
>             Fix For: 2.6.1
>
>         Attachments: RealPageVariables.patch
>
>
> When one sets a page variable jspwiki attaches that variable to the realpage variable which exists in the engine's context. But when looking up a variable reference only page is checked for that variable. The result is when realpage and page differ all previously defined variables vanish from scope. This can be seen when defining a variable then using the insertpage plugin. the inserted page can not see any variables defined in the inserter page and thus returns a variable not found error. 
> Initial Conversation on HowToUseAVariable which lead to bug:
> ========
> Lets pretend the code on one page called TestPage is
> Hello [{$tname}]
> Then the code for another page called Tester is
> [{SET tname='Stephen'}]
> [{InsertPage page='TestPage'}]
> It doesnt seem to be working as I would expect. I would expect the output to be
> Hello Stephen
> but instead I get
> Hello No such variable: No variable tname defined.
> What am I doing wrong? Why is InsertPage parsing the content of the inserted page prior to insertion? --Stephen
> The tname variable is referring to the page variable called "tname" on page "Tester". Variables are always interpreted in the context of the including page, not the included page. This allows you to e.g. create templates which you can insert and control with page variables.
> -- JanneJalkanen
> If variables are interpreted in the context of the including page why does Tester claim not to know what tname is when inserting a page that references that variable? Controlling a inserted page through page variables is EXACTLY what I am trying to do. But if all page variables defined in the including page lose scope prior to insertion then I fail to see how this is possible? Is it possible to directly manipulate the variables for a page prior to insertion?
> -- Stephen 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.