tino's <dtml-in> improvements
At http://www.zope.org/Members/tino/in_tag_patch, member tino has a patched version of dtml-in that solves two problems: * having to use ugly syntax for python expressions using sequence vars such as <dtml-if "_['sequence-item'] > 40">. The patch allows <dtml-if "sequence_item > 40"> * allowing you to set a prefix="books" attrib to <dtml-in>, so that instead of sequence-item, you can reference books-item, or books-next, etc. This is nice syntactic sugar, but especially nice for nested <dtml-in> tags, allowing you to easily refer to seq. variables in the outer dtml-loop, while in the inner loop. However, the product isn't updated perfectly for 2.3--the sequence variables for '-number' aren't working (the less helpful '-index' ones are). It seems like patches like this need to get into the Zope core if they're going to make it in the long run. Has anyone updated this for 2.3 -number vars? Can we get consensus that this should join the Zope core? -- Joel Burton <jburton@scw.org> Director of Information Systems, Support Center of Washington
At http://www.zope.org/Members/tino/in_tag_patch, member tino has a patched version of dtml-in that solves two problems:
<snip>
Has anyone updated this for 2.3 -number vars? Can we get consensus that this should join the Zope core?
I think that being able to use sequence_number instead of sequence-number and others sounds interesting. In the last year I have seen many people complaining about this with DC doing anything about it. Makes you think! DC are pretty skilled py-engineers. If they don't want to use sequence-item, then with what reason?? So, DC, people what's so cool about sequence-item that you can't get with sequence_item?? What's the underlying reasoning here?
-- Joel Burton <jburton@scw.org> Director of Information Systems, Support Center of Washington
_______________________________________________ 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 )
Peter Bengtsson wrote:
DC are pretty skilled py-engineers. If they don't want to use sequence-item, then with what reason?? So, DC, people what's so cool about sequence-item that you can't get with sequence_item?? What's the underlying reasoning here?
You'll probably get some waffle back about poluting the namespace. Personally, I find _[_['sequence-item']] a lot mroe offensive than losing one possible name out of an infinite namespace. ;-) cheers, Chris
In the last year I have seen many people complaining about this with DC doing anything about it. Makes you think!
That's not quite true - there have been several discussions of this in the past, and we have not ignored it. There were (and still are - more below) concerns about namespace pollution and stomping on variables that people may have currently defined in applications. Some alternatives have been proposed, though so far none have been implemented: http://www.zope.org/Members/4am/DTMLWiki/NamedDTMLInLoop http://dev.zope.org/Wikis/DevSite/Proposals/DTMLExpressionSyntax
DC are pretty skilled py-engineers. If they don't want to use sequence-item, then with what reason?? So, DC, people what's so cool about sequence-item that you can't get with sequence_item?? What's the underlying reasoning here?
Largely a concern that the DTML namespace is too much like the wild west already, and that the changed names could break apps that have already defined "sequence_item" or similar names, either for their own simplification or for totally other purposes. That said, I think that this has come up enough recently, clearly has support, and provides enough of a simplification win that it should go on the plan for Zope 2.4. For those wondering "why not 2.3.1?", 2.3.1 is a bug-fix release, and this will be a feature with a non-trivial documentation impact. For more info see the Zope release policy: http://dev.zope.org/Resources/ZopeReleasePolicy.html Putting it in the next feature release will allow us to make sure the documentation is updated accordingly, and give people who may be stepped on by the namespace change a chance to assess their apps before upgrading. People who need the change "Right Now" can continue to use the patch - in fact I'd encourage people to so we can shake out any problems. We should also make a project area on dev.zope.org so that we can have a common area to plan what still needs to be done (it sounds like the patch is close, but not 100%) and what collateral activities need to be done (what documentation artifacts need to be updated, etc.) The 2.4 release will be largely about getting Zope on Python 2.1 and I am intentionally keeping the 2.4 plan relatively small so that we can get it out in Q2. I've added the DTML namespace changes to the plan at: http://dev.zope.org/Resources/zope_240_plan.html I'll need one person to volunteer to be the point man on this, to coordinate with me on integration and keep the project area up to date. Brian Lloyd brian@digicool.com Software Engineer 540.371.6909 Digital Creations www.digicool.com
Peter Bengtsson wrote:
At http://www.zope.org/Members/tino/in_tag_patch, member tino has a patched version of dtml-in that solves two problems:
<snip>
Has anyone updated this for 2.3 -number vars? Can we get consensus that this should join the Zope core?
I think that being able to use sequence_number instead of sequence-number and others sounds interesting.
Me too.
In the last year I have seen many people complaining about this with DC doing anything about it. Makes you think!
About what?
DC are pretty skilled py-engineers. If they don't want to use sequence-item, then with what reason?? So, DC, people what's so cool about sequence-item that you can't get with sequence_item?? What's the underlying reasoning here?
The argument for sequence-item is not as strong as it one was, but it is still valid. In any case, changing this risks breaking existing working code. The original rational goes as follows: The basic fear is that someone might have a user-defined variable, such as a Python attribute or a SQL column name that conflicted with a generated name. So we (I :) generated names that could not conflict with user-defined names (at the time). At the time, we didn't allow Python expressions in DTML and, at the time, we didn't allow user-defined names that weren't legal Python names, so the generated names were safe from conflicts. I agree that _['sequence-item'] is painfull. My problem with allowing names like sequence_item as aliases is not just that they may cause name conflicts in new DTML, but that they may cause existing DTML code to break. One could argue that the chance of this is low, but I think that a user-defined name like 'sequence_number' is not that unlikely. I think that there are better ways to solve this problem than providing the aliases, but DC has, admittedly been slow to act. I like the prefix part of tino's patch. It makes the alias part of the patch unnecessary (assuming that the prefix was applied to generated names like count-xxx, as in prefix_count_xxx). FWIW, I'm very much for adding the prefix feature, but am opposed to the alias for fear of breaking old DTML code. Jim -- Jim Fulton mailto:jim@digicool.com Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org
Joel Burton wrote:
At http://www.zope.org/Members/tino/in_tag_patch, member tino has a patched version of dtml-in that solves two problems:
[snip]
Can we get consensus that this should join the Zope core?
You've got my vote! -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
You've got my vote to! Jose' Casey Duncan wrote:
Joel Burton wrote:
At http://www.zope.org/Members/tino/in_tag_patch, member tino has a patched version of dtml-in that solves two problems:
[snip]
Can we get consensus that this should join the Zope core?
You've got my vote!
-- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
_______________________________________________ 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 )
Hi all, I think I found a bug on tino's patch, I don't know where to send the bug report maybe someone can redirect this message to the right person. TYPE: KeyError VALUE: next-sequence-start-number MESSAGE: TRACE: Traceback (innermost last): File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/lib/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: sta_bovini) File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: sta_bovini) File /usr/lib/zope/lib/python/OFS/DTMLDocument.py, line 189, in __call__ (Object: sta_bovini) File /usr/lib/zope/lib/python/DocumentTemplate/DT_String.py, line 549, in __call__ (Object: sta_bovini) File /usr/lib/zope/lib/python/DocumentTemplate/DT_In.py, line 733, in renderwob (Object: qry.dati_utente(username=REQUEST.cookies.get('USER_NAME'))) File /usr/lib/zope/lib/python/DocumentTemplate/DT_In.py, line 645, in renderwb (Object: qry.stalla()) KeyError: next-sequence-start-number -------------------------------------------------------------------------------- REQUEST: formcookieszmi_use_css '1' dtpref_cols '101' zmi_top_frame '' dtpref_rows '22' USER_NAME 'ALL3' otherAUTHENTICATION_PATH 'ALLEVATORI' USER_NAME 'ALL3' col 'lightgrey' dtpref_rows '22' PUBLISHED <DTMLDocument instance at 866a8b8> zmi_use_css '1' SERVER_URL 'http://www.allevatori.com' zmi_top_frame '' URL 'http://www.allevatori.com/ALLEVATORI/frm/sta_bovini' AUTHENTICATED_USER ALL3 TraversalRequestNameStack [] dtpref_cols '101' URL0 http://www.allevatori.com/ALLEVATORI/frm/sta_bovini URL1 http://www.allevatori.com/ALLEVATORI/frm URL2 http://www.allevatori.com/ALLEVATORI URL3 http://www.allevatori.com BASE0 http://www.allevatori.com BASE1 http://www.allevatori.com BASE2 http://www.allevatori.com/ALLEVATORI BASE3 http://www.allevatori.com/ALLEVATORI/frm BASE4 http://www.allevatori.com/ALLEVATORI/frm/sta_bovini environHTTP_ACCEPT_ENCODING gzip, deflate REMOTE_HOST adsl-169-11.38-151.net24.it GATEWAY_INTERFACE CGI/1.1 SERVER_PORT 80 PATH_TRANSLATED /ALLEVATORI/frm/sta_bovini HTTP_ACCEPT */* HTTP_VIA 1.0 proxy.sferacarta.com:3128 (Squid/2.2.STABLE5) HTTP_ACCEPT_LANGUAGE it HTTP_X_FORWARDED_FOR 10.0.0.5 REMOTE_ADDR 151.38.11.169 SERVER_NAME bender.allevatori.com HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt) CONNECTION_TYPE keep-alive channel.creation_time 985341769 SERVER_PROTOCOL 1.0 PATH_INFO /ALLEVATORI/frm/sta_bovini HTTP_HOST www.allevatori.com REQUEST_METHOD GET SCRIPT_NAME SERVER_SOFTWARE Zope/Zope 2.3.0 (source release, python 1.5.2, linux2) ZServer/1.1b1 HTTP_CACHE_CONTROL max-age=259200 HTTP_COOKIE dtpref_rows="22"; dtpref_cols="101"; zmi_use_css="1"; zmi_top_frame=""; USER_NAME="ALL3"; bottone HTTP_PRAGMA no-cache HTTP_REFERER http://www.allevatori.com/ALLEVATORI/frm/menu_stalla --------------------------------------------------------------------------------
You've got my vote to! Jose'
Casey Duncan wrote:
Joel Burton wrote:
At http://www.zope.org/Members/tino/in_tag_patch, member tino has a patched version of dtml-in that solves two problems:
[snip]
Can we get consensus that this should join the Zope core?
You've got my vote!
-- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
_______________________________________________ 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 )
_______________________________________________ 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 )
Hi Jose, maybe you send it to me? ;) Ok, I got it now :) This weekend is bugfix time Tino Jose Soares wrote:
Hi all, I think I found a bug on tino's patch, I don't know where to send the bug report maybe someone can redirect this message to the right person.
TYPE: KeyError
VALUE: next-sequence-start-number
MESSAGE:
TRACE: Traceback (innermost last): File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 171, in publish
File /usr/lib/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: sta_bovini) File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: sta_bovini) File /usr/lib/zope/lib/python/OFS/DTMLDocument.py, line 189, in __call__ (Object: sta_bovini) File /usr/lib/zope/lib/python/DocumentTemplate/DT_String.py, line 549, in __call__ (Object: sta_bovini) File /usr/lib/zope/lib/python/DocumentTemplate/DT_In.py, line 733, in renderwob (Object: qry.dati_utente(username=REQUEST.cookies.get('USER_NAME'))) File /usr/lib/zope/lib/python/DocumentTemplate/DT_In.py, line 645, in renderwb (Object: qry.stalla()) KeyError: next-sequence-start-number
--------------------------------------------------------------------------------
REQUEST: formcookieszmi_use_css '1' dtpref_cols '101' zmi_top_frame '' dtpref_rows '22' USER_NAME 'ALL3' otherAUTHENTICATION_PATH 'ALLEVATORI' USER_NAME 'ALL3' col 'lightgrey' dtpref_rows '22' PUBLISHED <DTMLDocument instance at 866a8b8> zmi_use_css '1' SERVER_URL 'http://www.allevatori.com' zmi_top_frame '' URL 'http://www.allevatori.com/ALLEVATORI/frm/sta_bovini' AUTHENTICATED_USER ALL3 TraversalRequestNameStack [] dtpref_cols '101' URL0 http://www.allevatori.com/ALLEVATORI/frm/sta_bovini URL1 http://www.allevatori.com/ALLEVATORI/frm URL2 http://www.allevatori.com/ALLEVATORI URL3 http://www.allevatori.com BASE0 http://www.allevatori.com BASE1 http://www.allevatori.com BASE2 http://www.allevatori.com/ALLEVATORI BASE3 http://www.allevatori.com/ALLEVATORI/frm BASE4 http://www.allevatori.com/ALLEVATORI/frm/sta_bovini environHTTP_ACCEPT_ENCODING gzip, deflate REMOTE_HOST adsl-169-11.38-151.net24.it GATEWAY_INTERFACE CGI/1.1 SERVER_PORT 80 PATH_TRANSLATED /ALLEVATORI/frm/sta_bovini HTTP_ACCEPT */* HTTP_VIA 1.0 proxy.sferacarta.com:3128 (Squid/2.2.STABLE5) HTTP_ACCEPT_LANGUAGE it HTTP_X_FORWARDED_FOR 10.0.0.5 REMOTE_ADDR 151.38.11.169 SERVER_NAME bender.allevatori.com HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt) CONNECTION_TYPE keep-alive channel.creation_time 985341769 SERVER_PROTOCOL 1.0 PATH_INFO /ALLEVATORI/frm/sta_bovini HTTP_HOST www.allevatori.com REQUEST_METHOD GET SCRIPT_NAME SERVER_SOFTWARE Zope/Zope 2.3.0 (source release, python 1.5.2, linux2) ZServer/1.1b1 HTTP_CACHE_CONTROL max-age=259200 HTTP_COOKIE dtpref_rows="22"; dtpref_cols="101"; zmi_use_css="1"; zmi_top_frame=""; USER_NAME="ALL3"; bottone HTTP_PRAGMA no-cache HTTP_REFERER http://www.allevatori.com/ALLEVATORI/frm/menu_stalla
--------------------------------------------------------------------------------
You've got my vote to! Jose'
Casey Duncan wrote:
Joel Burton wrote:
At http://www.zope.org/Members/tino/in_tag_patch, member tino has a patched version of dtml-in that solves two problems:
[snip]
Can we get consensus that this should join the Zope core?
You've got my vote!
-- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
_______________________________________________ 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 )
_______________________________________________ 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 )
_______________________________________________ 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 )
Joel Burton wrote:
At http://www.zope.org/Members/tino/in_tag_patch, member tino has a patched version of dtml-in that solves two problems:
* having to use ugly syntax for python expressions using sequence vars such as <dtml-if "_['sequence-item'] > 40">. The patch allows <dtml-if "sequence_item > 40">
* allowing you to set a prefix="books" attrib to <dtml-in>, so that instead of sequence-item, you can reference books-item, or books-next, etc. This is nice syntactic sugar, but especially nice for nested <dtml-in> tags, allowing you to easily refer to seq. variables in the outer dtml-loop, while in the inner loop.
However, the product isn't updated perfectly for 2.3--the sequence variables for '-number' aren't working (the less helpful '-index' ones are). It seems like patches like this need to get into the Zope core if they're going to make it in the long run.
Has anyone updated this for 2.3 -number vars?
Thank you for reporting. I will check this over the weekend. Regards Tino
participants (8)
-
Brian Lloyd -
Casey Duncan -
Chris Withers -
Jim Fulton -
Joel Burton -
Jose Soares -
Peter Bengtsson -
Tino Wildenhain