Ticket #11 (closed bug: fixed)

Opened 12 years ago

Last modified 12 years ago

repeat argument looks like a 1 (one) even though it is an l (letter l)

Reported by: metaperl Owned by: apoirier
Priority: minor Component: uncategorized
Version: 0.1.0 Keywords:


Re: http://www.nagare.org/trac/wiki/PresentationTier

The example for repeat is a bit confusing. When I saw this:

for (element, line) in root.findmeld('alist').repeat(l):

I thought it meant 'repeat 1 time'

perhaps the letter l could be expanded to the word list or something.

Change History

comment:1 Changed 12 years ago by metaperl

I went ahead and made it more readable:

from nagare.namespaces import xhtml
h = xhtml.Renderer()

root = h.parse_xmlstring('''<ul xmlns:meld="http://www.plope.com/software/meld3">
<li meld:id="alist" align="center">A line example</li>

list = ['Item %d' % i for i in range(3)]

for (element, list_item) in root.findmeld('alist').repeat(list):
    element.text = list_item

print root.write_xmlstring()

comment:2 Changed 12 years ago by apoirier

  • Status changed from new to closed
  • Resolution set to fixed

comment:3 Changed 12 years ago by apoirier

(list being a Python builtin, it's better to define a local variable with a different name)

Note: See TracTickets for help on using tickets.