TALES repeat/variable/letter skips aa-az values

Bug #143313 reported by Arnar Lundesgaard on 2005-02-04
2
Affects Status Importance Assigned to Milestone
zope.tal
Invalid
Low
Unassigned

Bug Description

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.

affects: zope2 → zope.tal
Colin Watson (cjwatson) wrote :

The zope.tal project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope.tal.

Changed in zope.tal:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers