Leticia Larrosa wrote:
Hi
all:
I
want to order a sequence using the Sequence sorting module from a
Python script.
I
have the following code:
"
seq = [['Bruzon', 'CUB'], ['Anand', 'IND'], ['Kasparov', 'RUS']]
def test(oneElem, twoElem):
if oneElem[0] == twoElem[0]:
return 0
--On Sonntag, 24. April 2005 17:36 Uhr -0400 Leticia Larrosa
[EMAIL PROTECTED] wrote:
sort_on =(('self', test, 'desc'))
As documented the 'sort_on_ parameter must be a *sequence* of sorting
definitions and a *single* sorting
definition. This should work:
sort_on =(('self', test, 'desc'),)
-aj
seb writes:
If you do:
dtml-in "objectValues('Foo Thing')"
dtml-let thing=sequence-item
dtml-var "thing.id()"
/dtml-let
/dtml-in
"sequence-item" is not a string.
However, dtml-let ... xxx=name ...
calls "name" (if callable) like any name argument to a
"dtml"
If you do:
dtml-in "objectValues('Foo Thing')"
dtml-let thing=sequence-item
dtml-var "thing.id()"
/dtml-let
/dtml-in
You get TypeError: it claims thing is a string, so you can't perform any
kind of function call against it.
Some id attributes of Zope objects are methods, some are
seb wrote:
If you do:
dtml-in "objectValues('Foo Thing')"
dtml-let thing=sequence-item
dtml-var "thing.id()"
/dtml-let
/dtml-in
You get TypeError: it claims thing is a string, so you can't perform any
kind of function call against it.
Welcome to
Jonothan Farr wrote:
There's a much cooler and more elegant solution in the pipe for 2.2.
http://www.zope.org/Members/4am/DTMLWiki/NamedDTMLInLoop
I don't think this landed for 2.2...
Chris
___
Zope maillist - [EMAIL PROTECTED]
Diego Rodrigo Neufert wrote:
Why I cant use dtml-var "sequence-item"??
Because anything inside quotes is evaluated as a Python expression.
It's trying to subtract 'item' from 'sequence.'
Try:
dtml-var "_['sequence-item']"
-CJ
___
Zope maillist
"Christopher J. Kucera" wrote:
Try:
dtml-var "_['sequence-item']"
or
dtml-var "_getitem('sequence-item',0)"
If you don't want the object to be called ebfore being displayed...
cheers,
Chris
___
Zope maillist - [EMAIL PROTECTED]
Diego Rodrigo Neufert writes:
Hi ppl...
Why I cant use dtml-var "sequence-item"??
Because, as I understand it, anything within "" gets treated as Python code
by the DTML interpreter. Thus "sequence-item" is parsed as an expression:
sequence _minus_ item. A dash is not a valid variable
worse than Python because people wanted it worse."
Larry Wall, 14 Oct 1998
- Original Message -
From: Rob Miller [EMAIL PROTECTED]
To: Diego Rodrigo Neufert [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, July 18, 2000 1:30 PM
Subject: Re: [Zope] sequence-item and "&quo
Hello again
I´m still testing the usability and reliability of Zope. To accomplish this
goal I am developing a very very simple shopping cart. But I got troubled by
something aparently simple. This is the code:
dtml-in "SESSION['cartItems']"
dtml-in
Fabio Akita schrieb:
[ sequence-item in a python expression ]
Error Type: NameError
Error Value: sequence
Anyone knows what is going on? I think this must be a simple thing.
Everything in quotes is taken as a python expression, therefore Zope
wants to evaluate "sequence - item"; this
Many of these variables cause problems for those starting out with Zope.
Why not create alternate names such as sequence_* and degrade the
former?
Gotta agree with this :-)
Here's the patch. I'll submit it to the collector too. Enjoy.
13 matches
Mail list logo