[ZCM] [ZC] 1691/ 1 Request "TALES repeat/variable/letter skips aa-az values"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Fri Feb 4 07:50:52 EST 2005


Issue #1691 Update (Request) "TALES repeat/variable/letter skips aa-az values"
 Status Pending, Zope/bug low
To followup, visit:
  http://collector.zope.org/Zope/1691

==============================================================
= Request - Entry #1 by arnarl on Feb 4, 2005 7:50 am

The specification for TALES repeat variables Products/PageTemplates/Help/tal-repeat.txt specifies the following:

    *letter* - repetition number as a lower-case letter: "a" -
    "z", "aa" - "az", "ba" - "bz", ..., "za" - "zz", "aaa" - "aaz",
    and so forth.

It seems like the "aa" - "az" part is skipped. It is the same for the uppercase Letter feature.

Some simple test code:

 <ul>
   <li tal:repeat="number python:xrange(100)" tal:content="string:${number} - ${repeat/number/letter}" />
 </ul>
 <ul>
   <li tal:repeat="number python:xrange(100)" tal:content="string:${number} - ${repeat/number/Letter}" />
 </ul>

repeat/number seems to be an iterator whose baseclass is ZTUtils.Iterator.Iterator. This class has two methods called letter and Letter.


    def letter(self, base=ord('a'), radix=26):
        index = self.index
        s = ''
        while 1:
            index, off = divmod(index, radix)
            s = chr(base + off) + s
            if not index: return s

    def Letter(self):
        return self.letter(base=ord('A'))


Not sure if it is supposed to be this way, but AFAICS it is not the way it is documented and it is not the way that coloumns are numbered in spreadsheet applications like Excel.
==============================================================



More information about the Zope-Collector-Monitor mailing list