You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Claude Brisson (JIRA)" <ji...@apache.org> on 2006/11/16 10:35:37 UTC

[jira] Created: (VELOCITY-496) Allow periods in references secondary keys.

Allow periods in references secondary keys.
-------------------------------------------

                 Key: VELOCITY-496
                 URL: http://issues.apache.org/jira/browse/VELOCITY-496
             Project: Velocity
          Issue Type: Improvement
          Components: Engine
    Affects Versions: 1.6
            Reporter: Claude Brisson
            Priority: Minor


This is a quite prospective proposal that emerged from a discussion in a VelocityTools JIRA issue (https://issues.apache.org/jira/browse/VELTOOLS-69).

Its goal is to have the short syntax $map.foo.bar chek the existence of $map.get("foo.bar") when $map.foo is null.

Backward compatibility is 99%, since it only breaks templates that rely on $map.foo.bar being an invalid reference while having foo.bar as key in map.

The implementation doesn't look obvious, and we must ensure that there are no other side effects, yet this behaviour can be quite usefull when dealing with HTML field names that contain a period.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-496) Allow periods in references secondary keys.

Posted by "Claude Brisson (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-496?page=comments#action_12453922 ] 
            
Claude Brisson commented on VELOCITY-496:
-----------------------------------------

Warning, last commits broke this patch.

Also, I suggested a less hackish way of achieving this in https://issues.apache.org/jira/browse/VELTOOLS-69 (but only for the tools).


> Allow periods in references secondary keys.
> -------------------------------------------
>
>                 Key: VELOCITY-496
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-496
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.6
>            Reporter: Claude Brisson
>            Priority: Minor
>         Attachments: identifiers-merging.patch
>
>
> This is a quite prospective proposal that emerged from a discussion in a VelocityTools JIRA issue (https://issues.apache.org/jira/browse/VELTOOLS-69).
> Its goal is to have the short syntax $map.foo.bar chek the existence of $map.get("foo.bar") when $map.foo is null.
> Backward compatibility is 99%, since it only breaks templates that rely on $map.foo.bar being an invalid reference while having foo.bar as key in map.
> The implementation doesn't look obvious, and we must ensure that there are no other side effects, yet this behaviour can be quite usefull when dealing with HTML field names that contain a period.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-496) Allow periods in references secondary keys.

Posted by "Claude Brisson (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-496?page=comments#action_12450770 ] 
            
Claude Brisson commented on VELOCITY-496:
-----------------------------------------

IMHO the ${map.{foo.bar}.baz}schmoo syntax is precise but may a bit complex for template writers so I think we should support the easier version where two successive identifiers can be merged. 

Anyhow, I don't feel like digging into the parser for now... It doesn't prevent someone else to give it a try to implement Christoph's idea.

So I followed the track of  $a.b.c checking for $a.get("b.c") if $a.b is null.

The proposed patch does it as follow: when an ASTIdentifier is followed by another ASTIdentifier, the execute( ) method of the first one checks an alternate merged identifier whenever the natural identifier doesn't give any result. A new TemplateTestCase is provided.



> Allow periods in references secondary keys.
> -------------------------------------------
>
>                 Key: VELOCITY-496
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-496
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.6
>            Reporter: Claude Brisson
>            Priority: Minor
>         Attachments: identifiers-merging.patch
>
>
> This is a quite prospective proposal that emerged from a discussion in a VelocityTools JIRA issue (https://issues.apache.org/jira/browse/VELTOOLS-69).
> Its goal is to have the short syntax $map.foo.bar chek the existence of $map.get("foo.bar") when $map.foo is null.
> Backward compatibility is 99%, since it only breaks templates that rely on $map.foo.bar being an invalid reference while having foo.bar as key in map.
> The implementation doesn't look obvious, and we must ensure that there are no other side effects, yet this behaviour can be quite usefull when dealing with HTML field names that contain a period.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-496) Allow periods in references secondary keys.

Posted by "Byron Foster (JIRA)" <de...@velocity.apache.org>.
    [ https://issues.apache.org/jira/browse/VELOCITY-496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12687997#action_12687997 ] 

Byron Foster commented on VELOCITY-496:
---------------------------------------

I wonder if VELOCITY-406 is good enough for this since in 1.7 you can now do:

$a["b.c"]


> Allow periods in references secondary keys.
> -------------------------------------------
>
>                 Key: VELOCITY-496
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-496
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.6
>            Reporter: Claude Brisson
>            Priority: Minor
>         Attachments: identifiers-merging.patch
>
>
> This is a quite prospective proposal that emerged from a discussion in a VelocityTools JIRA issue (https://issues.apache.org/jira/browse/VELTOOLS-69).
> Its goal is to have the short syntax $map.foo.bar chek the existence of $map.get("foo.bar") when $map.foo is null.
> Backward compatibility is 99%, since it only breaks templates that rely on $map.foo.bar being an invalid reference while having foo.bar as key in map.
> The implementation doesn't look obvious, and we must ensure that there are no other side effects, yet this behaviour can be quite usefull when dealing with HTML field names that contain a period.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-496) Allow periods in references secondary keys.

Posted by "Christoph Reck (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-496?page=comments#action_12450329 ] 
            
Christoph Reck commented on VELOCITY-496:
-----------------------------------------

For completeness: the implementation should also consider that a property access after the map access might be used:
  $map.foo.bar.baz
meaning
  $map.get("foo.bar") .getBaz()

So a descision is needed if this feature will be supported.

Also consider having eplicit syntaxt for a map access with a dotted key: 
  $map.{foo.bar}.baz and ${map.{foo.bar}.baz}schmoo
which would resolve this issue and my completeness request

> Allow periods in references secondary keys.
> -------------------------------------------
>
>                 Key: VELOCITY-496
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-496
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.6
>            Reporter: Claude Brisson
>            Priority: Minor
>
> This is a quite prospective proposal that emerged from a discussion in a VelocityTools JIRA issue (https://issues.apache.org/jira/browse/VELTOOLS-69).
> Its goal is to have the short syntax $map.foo.bar chek the existence of $map.get("foo.bar") when $map.foo is null.
> Backward compatibility is 99%, since it only breaks templates that rely on $map.foo.bar being an invalid reference while having foo.bar as key in map.
> The implementation doesn't look obvious, and we must ensure that there are no other side effects, yet this behaviour can be quite usefull when dealing with HTML field names that contain a period.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-496) Allow periods in references secondary keys.

Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-496?page=comments#action_12450525 ] 
            
Will Glass-Husain commented on VELOCITY-496:
--------------------------------------------

makes sense to me.  if someone writes a patch ASAP (with unit tests), we'll put in 1.5.  Otherwise probably 1.6.

> Allow periods in references secondary keys.
> -------------------------------------------
>
>                 Key: VELOCITY-496
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-496
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.6
>            Reporter: Claude Brisson
>            Priority: Minor
>
> This is a quite prospective proposal that emerged from a discussion in a VelocityTools JIRA issue (https://issues.apache.org/jira/browse/VELTOOLS-69).
> Its goal is to have the short syntax $map.foo.bar chek the existence of $map.get("foo.bar") when $map.foo is null.
> Backward compatibility is 99%, since it only breaks templates that rely on $map.foo.bar being an invalid reference while having foo.bar as key in map.
> The implementation doesn't look obvious, and we must ensure that there are no other side effects, yet this behaviour can be quite usefull when dealing with HTML field names that contain a period.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Updated: (VELOCITY-496) Allow periods in references secondary keys.

Posted by "Claude Brisson (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELOCITY-496?page=all ]

Claude Brisson updated VELOCITY-496:
------------------------------------

    Attachment: identifiers-merging.patch

> Allow periods in references secondary keys.
> -------------------------------------------
>
>                 Key: VELOCITY-496
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-496
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.6
>            Reporter: Claude Brisson
>            Priority: Minor
>         Attachments: identifiers-merging.patch
>
>
> This is a quite prospective proposal that emerged from a discussion in a VelocityTools JIRA issue (https://issues.apache.org/jira/browse/VELTOOLS-69).
> Its goal is to have the short syntax $map.foo.bar chek the existence of $map.get("foo.bar") when $map.foo is null.
> Backward compatibility is 99%, since it only breaks templates that rely on $map.foo.bar being an invalid reference while having foo.bar as key in map.
> The implementation doesn't look obvious, and we must ensure that there are no other side effects, yet this behaviour can be quite usefull when dealing with HTML field names that contain a period.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


[jira] Commented: (VELOCITY-496) Allow periods in references secondary keys.

Posted by "Christoph Reck (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-496?page=comments#action_12450686 ] 
            
Christoph Reck commented on VELOCITY-496:
-----------------------------------------

Claudes request affects the ueberspector, but has a minor BC issue.

The ${map.{foo.bar}.baz}schmoo syntax is a parser change - and could make it into 1.5 if it is a minor change. Who can check if the parser can be updated for this syntatic upgrade? Please note that the unit tests must pass after a parser change.

Patches are welcome as Will states!


> Allow periods in references secondary keys.
> -------------------------------------------
>
>                 Key: VELOCITY-496
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-496
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.6
>            Reporter: Claude Brisson
>            Priority: Minor
>
> This is a quite prospective proposal that emerged from a discussion in a VelocityTools JIRA issue (https://issues.apache.org/jira/browse/VELTOOLS-69).
> Its goal is to have the short syntax $map.foo.bar chek the existence of $map.get("foo.bar") when $map.foo is null.
> Backward compatibility is 99%, since it only breaks templates that rely on $map.foo.bar being an invalid reference while having foo.bar as key in map.
> The implementation doesn't look obvious, and we must ensure that there are no other side effects, yet this behaviour can be quite usefull when dealing with HTML field names that contain a period.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org