Patch to avoid hypenation variables and more
Hi there, finally I want to release my patch for the in-tag. I hope it finds its way into the source-tree. I was sick writing such ugly constructs as _[_['sequence-item']] and so on, so I patched DT_In.py and DT_InSV.py (in lib/python/DocumentTemplate) to use sequence_item as well. All hypenation variables have now a second representation with underscores instead of hypenation. I hope, some time we can drop these hypenation variables. The second problem is if you put one in-tag into another. You have to use <dtml-let> oder REQUEST.set() with variables of the outher in-tag to be able to reference them in the inner loop. The code becomes very ugly this way. So my idea was to give the in-tag an optional argument, called "prefix" to prefix all the sequence-variables with a custom identifier. So you can write: <dtml-in some_sequence prefix="outer_"> <dtml-in some_other_sequence> <dtml-var outer_sequence_item>:<dtml-var sequence_item> </dtml-in the inner sequence> </dtml-in the outer sequence> What do you think about this? Attached are the patch files (g-zipped) They are a bit of size, but I choosed to send them as diff, as requested to avoid flames ;) (Althought the original files would be similar in size) If someone wants the whole files, feel free to write to me) Regards Tino
Hi Chris, Chris Withers schrieb:
Tino Wildenhain wrote:
finally I want to release my patch for the in-tag. I hope it finds its way into the source-tree.
Looks very cool :-)
Is it in the collector yet?
I've put it on the collector, but I'm not very sure I did it the right way ;-) But lets hope we can have it in the next release... Regards Tino
On Mon, 4 Dec 2000, Tino Wildenhain wrote:
Hi there,
finally I want to release my patch for the in-tag. I hope it finds its way into the source-tree. I was sick writing such ugly constructs as _[_['sequence-item']] and so on, so I patched DT_In.py and DT_InSV.py (in lib/python/DocumentTemplate) to use sequence_item as well. All hypenation variables have now a second representation with underscores instead of hypenation. I hope, some time we can drop these hypenation variables.
Or drop DTML entirely.
The second problem is if you put one in-tag into another. You have to use <dtml-let> oder REQUEST.set() with variables of the outher in-tag to be able to reference them in the inner loop. The code becomes very ugly this way. So my idea was to give the in-tag an optional argument, called "prefix" to prefix all the sequence-variables with a custom identifier. So you can write:
<dtml-in some_sequence prefix="outer_"> <dtml-in some_other_sequence> <dtml-var outer_sequence_item>:<dtml-var sequence_item> </dtml-in the inner sequence> </dtml-in the outer sequence>
What do you think about this?
It's cool. Your patches are big and therefore, naturally, are a bit worrisome to us in terms of checking them into the core. Do you have a set of test DTML scripts that verify your patch? Say, a set of scripts that verifies backwards compatibity, and a set of scripts that verifies the new functionality? I would suggest even investigating "ZUnit" and creating DTML unit tests. Then we would *really* love you. ;) -Michel
----- Original Message ----- From: "Michel Pelletier" <michel@digicool.com> To: "Tino Wildenhain" <tino@wildenhain.de> Cc: <zope@zope.org> Sent: Monday, December 04, 2000 7:10 PM Subject: Re: [Zope] Patch to avoid hypenation variables and more [...]
It's cool.
Yes !. It is _very_ cool and very long awaited. Thank you Tino :) Maybe also is a good time to mix and apply my old patch for 'sort' attribute with Tino's patch ?. Please, take a look at: http://classic.zope.org:8080/Collector/1542/view http://classic.zope.org:8080/Collector/1541/view Regards Adam Karpierz karpierz@alpha.pl
I've had patches for this for some time at http://www.zope.org/Members/jfarr/Patches/Patches/dtml-in-sv I was told they weren't being considered for inclusion because they will be superceded by the named dtml-in construct (which would also supercede your second patch). No word on when or if named dtml-in will actually happen, though. --jfarr ----- Original Message ----- From: "Adam Karpierz" <karpierz@itl.pl> To: "Michel Pelletier" <michel@digicool.com> Cc: "Zope Mail List" <zope@zope.org> Sent: Monday, December 04, 2000 5:36 PM Subject: Re: [Zope] Patch to avoid hypenation variables and more
----- Original Message ----- From: "Michel Pelletier" <michel@digicool.com> To: "Tino Wildenhain" <tino@wildenhain.de> Cc: <zope@zope.org> Sent: Monday, December 04, 2000 7:10 PM Subject: Re: [Zope] Patch to avoid hypenation variables and more
[...]
It's cool.
Yes !. It is _very_ cool and very long awaited. Thank you Tino :)
Maybe also is a good time to mix and apply my old patch for 'sort' attribute with Tino's patch ?. Please, take a look at: http://classic.zope.org:8080/Collector/1542/view http://classic.zope.org:8080/Collector/1541/view
Regards
Adam Karpierz karpierz@alpha.pl
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Michel Pelletier schrieb:
The second problem is if you put one in-tag into another. You have to use <dtml-let> oder REQUEST.set() with variables of the outher in-tag to be able to reference them in the inner loop. The code becomes very ugly this way. So my idea was to give the in-tag an optional argument, called "prefix" to prefix all the sequence-variables with a custom identifier. So you can write:
<dtml-in some_sequence prefix="outer_"> <dtml-in some_other_sequence> <dtml-var outer_sequence_item>:<dtml-var sequence_item> </dtml-in the inner sequence> </dtml-in the outer sequence>
What do you think about this?
It's cool. Your patches are big and therefore, naturally, are a bit worrisome to us in terms of checking them into the core. Do you have a set of test DTML scripts that verify your patch? Say, a set of scripts that verifies backwards compatibity, and a set of scripts that verifies the new functionality? I would suggest even investigating "ZUnit" and creating DTML unit tests. Then we would *really* love you. ;)
Have to find this ZUnit... ;) Ok, I made some further tests and improvements. There was a mistake (ok, it comes from variables spilled randomly over DT_In.py and DT_InSV.py ;) with the prefix. In some cases it wasnt there as supposed. Now all the prefix-handling should be ok. I've made an yet simple test-suite, all available thru http://www.zope.org/Members/tino/ (See "Patch for <dtml-in>" there) Note: the prefix prepends only the in-tags own variables. Any attribute coming from the sequence is untouched. This is also true for statistic variables and the magic "mapping" symbol. While it could easy be implemented, I think prefixing all attributes is not such a good idea. If you are ilterating over database queries you can rename the attributes there. Regards Tino
Hi again, anybody had time to test this? Chances for next zope release? Any remarks? Alternatively, btw. would be a name attribut, which defaults to "sequence". Regards Tino Tino Wildenhain schrieb:
Michel Pelletier schrieb:
The second problem is if you put one in-tag into another. You have to use <dtml-let> oder REQUEST.set() with variables of the outher in-tag to be able to reference them in the inner loop. The code becomes very ugly this way. So my idea was to give the in-tag an optional argument, called "prefix" to prefix all the sequence-variables with a custom identifier. So you can write:
<dtml-in some_sequence prefix="outer_"> <dtml-in some_other_sequence> <dtml-var outer_sequence_item>:<dtml-var sequence_item> </dtml-in the inner sequence> </dtml-in the outer sequence>
What do you think about this?
It's cool. Your patches are big and therefore, naturally, are a bit worrisome to us in terms of checking them into the core. Do you have a set of test DTML scripts that verify your patch? Say, a set of scripts that verifies backwards compatibity, and a set of scripts that verifies the new functionality? I would suggest even investigating "ZUnit" and creating DTML unit tests. Then we would *really* love you. ;)
Have to find this ZUnit... ;) Ok, I made some further tests and improvements. There was a mistake (ok, it comes from variables spilled randomly over DT_In.py and DT_InSV.py ;) with the prefix. In some cases it wasnt there as supposed.
Now all the prefix-handling should be ok. I've made an yet simple test-suite, all available thru http://www.zope.org/Members/tino/ (See "Patch for <dtml-in>" there)
Note: the prefix prepends only the in-tags own variables. Any attribute coming from the sequence is untouched. This is also true for statistic variables and the magic "mapping" symbol.
While it could easy be implemented, I think prefixing all attributes is not such a good idea. If you are ilterating over database queries you can rename the attributes there.
Hi, anybody had time for testing? May be we could have it in the next zope release. Any comments, remarks? How about an alternatively or extra "name"-attribute wich defaults to "sequence" ? Another issue: what about an alias for <dtml-var> called something like: <dtml-print> <dtml-output> or <dtml-out> ? Just for the ones that lern zope. Since I often see the missunderstood meaning of <dtml-var> in such constructs like: <dtml-var "somelist[<dtml-var indexvar>]"> you know what I mean? I think it would be more obvious, if the tag would usually be called <dtml-out> or something. Regards Tino Tino Wildenhain schrieb:
Michel Pelletier schrieb:
The second problem is if you put one in-tag into another. You have to use <dtml-let> oder REQUEST.set() with variables of the outher in-tag to be able to reference them in the inner loop. The code becomes very ugly this way. So my idea was to give the in-tag an optional argument, called "prefix" to prefix all the sequence-variables with a custom identifier. So you can write:
<dtml-in some_sequence prefix="outer_"> <dtml-in some_other_sequence> <dtml-var outer_sequence_item>:<dtml-var sequence_item> </dtml-in the inner sequence> </dtml-in the outer sequence>
What do you think about this?
It's cool. Your patches are big and therefore, naturally, are a bit worrisome to us in terms of checking them into the core. Do you have a set of test DTML scripts that verify your patch? Say, a set of scripts that verifies backwards compatibity, and a set of scripts that verifies the new functionality? I would suggest even investigating "ZUnit" and creating DTML unit tests. Then we would *really* love you. ;)
Have to find this ZUnit... ;) Ok, I made some further tests and improvements. There was a mistake (ok, it comes from variables spilled randomly over DT_In.py and DT_InSV.py ;) with the prefix. In some cases it wasnt there as supposed.
Now all the prefix-handling should be ok. I've made an yet simple test-suite, all available thru http://www.zope.org/Members/tino/ (See "Patch for <dtml-in>" there)
Note: the prefix prepends only the in-tags own variables. Any attribute coming from the sequence is untouched. This is also true for statistic variables and the magic "mapping" symbol.
While it could easy be implemented, I think prefixing all attributes is not such a good idea. If you are ilterating over database queries you can rename the attributes there.
Tino Wildenhain wrote:
Hi,
anybody had time for testing? May be we could have it in the next zope release. Any comments, remarks? How about an alternatively or extra "name"-attribute wich defaults to "sequence" ?
Another issue: what about an alias for <dtml-var> called something like: <dtml-print> <dtml-output> or <dtml-out> ? Just for the ones that lern zope. Since I often see the missunderstood meaning of <dtml-var> in such constructs like: <dtml-var "somelist[<dtml-var indexvar>]"> you know what I mean? I think it would be more obvious, if the tag would usually be called <dtml-out> or something.
Yes. I vote for <dtml-print some_var>
Regards Tino
Tino Wildenhain schrieb:
Michel Pelletier schrieb:
The second problem is if you put one in-tag into another. You have to use <dtml-let> oder REQUEST.set() with variables of the outher in-tag to be able to reference them in the inner loop. The code becomes very ugly this way. So my idea was to give the in-tag an optional argument, called "prefix" to prefix all the sequence-variables with a custom identifier. So you can write:
<dtml-in some_sequence prefix="outer_"> <dtml-in some_other_sequence> <dtml-var outer_sequence_item>:<dtml-var sequence_item> </dtml-in the inner sequence> </dtml-in the outer sequence>
What do you think about this?
It's cool. Your patches are big and therefore, naturally, are a bit worrisome to us in terms of checking them into the core. Do you have a set of test DTML scripts that verify your patch? Say, a set of scripts that verifies backwards compatibity, and a set of scripts that verifies the new functionality? I would suggest even investigating "ZUnit" and creating DTML unit tests. Then we would *really* love you. ;)
Have to find this ZUnit... ;) Ok, I made some further tests and improvements. There was a mistake (ok, it comes from variables spilled randomly over DT_In.py and DT_InSV.py ;) with the prefix. In some cases it wasnt there as supposed.
Now all the prefix-handling should be ok. I've made an yet simple test-suite, all available thru http://www.zope.org/Members/tino/ (See "Patch for <dtml-in>" there)
Note: the prefix prepends only the in-tags own variables. Any attribute coming from the sequence is untouched. This is also true for statistic variables and the magic "mapping" symbol.
While it could easy be implemented, I think prefixing all attributes is not such a good idea. If you are ilterating over database queries you can rename the attributes there.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Monday 04 December 2000 17:07, Tino Wildenhain wrote:
Hi there,
finally I want to release my patch for the in-tag. I hope it finds its way into the source-tree. I was sick writing such ugly constructs as _[_['sequence-item']] and so on, so I patched DT_In.py and DT_InSV.py (in lib/python/DocumentTemplate) to use sequence_item as well. All hypenation variables have now a second representation with underscores instead of hypenation. I hope, some time we can drop these hypenation variables.
<insert raucous applause here> Thank you for finding the time to do what I did not have the time to. (o8 As I have said several times on this list, this is well overdue. Hopefuly the '-' tags can migrate their way out of Zope the way <!--# has.
The second problem is if you put one in-tag into another. You have to use <dtml-let> oder REQUEST.set() with variables of the outher in-tag to be able to reference them in the inner loop. The code becomes very ugly this way. So my idea was to give the in-tag an optional argument, called "prefix" to prefix all the sequence-variables with a custom identifier. So you can write:
<dtml-in some_sequence prefix="outer_"> <dtml-in some_other_sequence> <dtml-var outer_sequence_item>:<dtml-var sequence_item> </dtml-in the inner sequence> </dtml-in the outer sequence>
What do you think about this?
I like! I like it a lot! This is, imho, quite an elegant solution to an ugly problem. I know these two were considered 'minor' problems, and thus not given much attention, but they're just one more niggling problem that will no longer elicit the same old newbie questions to this list. Have a better one, Curtis Maloney.
participants (8)
-
Adam Karpierz -
Chris Withers -
Curtis Maloney -
Jonothan Farr -
Jose Soares -
Michel Pelletier -
Tino Wildenhain -
Tino Wildenhain