On Fri, May 03, 2002 at 10:39:29AM +0100, Tom Nixon wrote:
| > python:sequence.sort(thelist,(('bobobase_modification_time','d
| > esc'),))">
|
| Thanks for your help. I get an error when I try this though:
|
| Error Type: TALESError
| Error Value: exceptions.AttributeError on 'None' object has no attribute
| 'getitem' in "", at line 160, column 3
>>> l = [ 3 , 2 ]
>>> print l
[3, 2]
>>> print l.sort()
None
>>> print l
[2, 3]
>>>
The sort() method modifies the list in-place and returns None. You
are trying to iterate over the return value of sort(), which doesn't
have a getitem method.
The simplest solution is to sort the list after you have a reference
to it. Eg:
tal:define="l python:[3,2] ; foo l.sort()"
As a side effect it creates 'foo' as a reference to None, but that
isn't significant.
-D
--
An anxious heart weighs a man down,
but a kind word cheers him up.
Proverbs 12:25
GnuPG key : http://dman.ddts.net/~dman/public_key.gpg
Attachment:
pgpduYNuNpI8o.pgp
Description: PGP signature