Re: [Zope] sorting ids in python

2008-12-11 Thread robert rottermann
Garry Saddington schrieb:
 On Tuesday 09 December 2008 03:15, Andreas Jung wrote:
 On 08.12.2008 21:11 Uhr, robert rottermann wrote:
 Garry Saddington schrieb:
 Can anyone help me sort the following by id in a python script?

 for object in context.objectValues(['Folder', 'DTML
 Document','ZipFolder','File','Image']):
 objs=context.objectValues(['Folder',
 'DTMLDocument','ZipFolder','File','Image']) objs.sort()
 for o in objs:
   ..
 huh? Afaik there is no sort order defined on a per-object basis.

 This is my final working solution:
 
 ids = context.objectIds(['Folder', 'DTMLDocument','ZipFolder','File','Image'])
 ids.sort()
 for object in ids:
 object=context.restrictedTraverse(object)
 path=object.absolute_url()
 ...
I think you can have it a little bit easier:
use context.objectItems instead of objectIds
context.objectItems returns (id, object) tuples.

so your solution wold be:
objs = context.objectItems(['Folder', 
'DTMLDocument','ZipFolder','File','Image'])
objs.sort()
for id, object in objs:
 path=object.absolute_url()
robert
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sorting ids in python

2008-12-11 Thread Peter Bengtsson
2008/12/11 robert rottermann [EMAIL PROTECTED]:
 Garry Saddington schrieb:
 On Tuesday 09 December 2008 03:15, Andreas Jung wrote:
 On 08.12.2008 21:11 Uhr, robert rottermann wrote:
 Garry Saddington schrieb:
 Can anyone help me sort the following by id in a python script?

 for object in context.objectValues(['Folder', 'DTML
 Document','ZipFolder','File','Image']):
 objs=context.objectValues(['Folder',
 'DTMLDocument','ZipFolder','File','Image']) objs.sort()
 for o in objs:
   ..
 huh? Afaik there is no sort order defined on a per-object basis.

 This is my final working solution:

 ids = context.objectIds(['Folder', 
 'DTMLDocument','ZipFolder','File','Image'])
 ids.sort()
 for object in ids:
 object=context.restrictedTraverse(object)
 path=object.absolute_url()
 ...
 I think you can have it a little bit easier:
 use context.objectItems instead of objectIds
 context.objectItems returns (id, object) tuples.

 so your solution wold be:
 objs = context.objectItems(['Folder', 
 'DTMLDocument','ZipFolder','File','Image'])
 objs.sort()
 for id, object in objs:
 path=object.absolute_url()
 robert

Personally I prefer to always use objectValues(). Sorting isn't
objectXXX()'s problem. It's something you do in your view.
objs = list(self.objectValues())
objs.sort(lambda x,y: cmp(x.id, y.id))

It's only a matter of time until you need something more advanced
and then you shouldn't
have to change how you use the objectXXX() iterator. E.g.:
objs.sort(lambda x,y: cmp(x.title_or_id().lower(), y.title_or_id().lower()))


-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sorting ids in python

2008-12-11 Thread Andreas Jung

On 11.12.2008 12:28 Uhr, Peter Bengtsson wrote:


Personally I prefer to always use objectValues(). Sorting isn't
objectXXX()'s problem. It's something you do in your view.
objs = list(self.objectValues())
objs.sort(lambda x,y: cmp(x.id, y.id))


Never ever use obj.id. The official API is obj.getId() - nothing
else.

Andreas
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd.  Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:[EMAIL PROTECTED]
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sorting ids in python

2008-12-09 Thread Garry Saddington
On Tuesday 09 December 2008 03:15, Andreas Jung wrote:
 On 08.12.2008 21:11 Uhr, robert rottermann wrote:
  Garry Saddington schrieb:
  Can anyone help me sort the following by id in a python script?
 
  for object in context.objectValues(['Folder', 'DTML
  Document','ZipFolder','File','Image']):
 
  objs=context.objectValues(['Folder',
  'DTMLDocument','ZipFolder','File','Image']) objs.sort()
  for o in objs:
..

 huh? Afaik there is no sort order defined on a per-object basis.

This is my final working solution:

ids = context.objectIds(['Folder', 'DTMLDocument','ZipFolder','File','Image'])
ids.sort()
for object in ids:
object=context.restrictedTraverse(object)
path=object.absolute_url()
...
.
Thanks everyone
Regards
Garry

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sorting ids in python

2008-12-09 Thread Andreas Jung

On 09.12.2008 8:45 Uhr, Garry Saddington wrote:

On Tuesday 09 December 2008 03:15, Andreas Jung wrote:

On 08.12.2008 21:11 Uhr, robert rottermann wrote:

Garry Saddington schrieb:

Can anyone help me sort the following by id in a python script?

for object in context.objectValues(['Folder', 'DTML
Document','ZipFolder','File','Image']):

objs=context.objectValues(['Folder',
'DTMLDocument','ZipFolder','File','Image']) objs.sort()
for o in objs:
   ..

huh? Afaik there is no sort order defined on a per-object basis.


This is my final working solution:

ids = context.objectIds(['Folder', 'DTMLDocument','ZipFolder','File','Image'])
ids.sort()
for object in ids:
 object=context.restrictedTraverse(object)
 path=object.absolute_url()
...



You were asking about IDs in the first place, so use objectIds().
If you are interested in the object themselves, use objectItems() as RR
suggested.

-aj
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd.  Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:[EMAIL PROTECTED]
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sorting ids in python

2008-12-08 Thread Andreas Jung

On 08.12.2008 18:18 Uhr, Garry Saddington wrote:

Can anyone help me sort the following by id in a python script?

for object in context.objectValues(['Folder', 'DTML
Document','ZipFolder','File','Image']):




ids = context.objectIds()
ids.sort()

-aj
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd.  Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:[EMAIL PROTECTED]
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sorting ids in python

2008-12-08 Thread Andreas Jung

On 08.12.2008 19:23 Uhr, Andreas Jung wrote:

On 08.12.2008 18:18 Uhr, Garry Saddington wrote:

Can anyone help me sort the following by id in a python script?

for object in context.objectValues(['Folder', 'DTML
Document','ZipFolder','File','Image']):




ids = context.objectIds()


Possibly you need

ids = list(context.objectIds())

-aj


ids.sort()
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd.  Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:[EMAIL PROTECTED]
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sorting ids in python

2008-12-08 Thread robert rottermann
Garry Saddington schrieb:
 Can anyone help me sort the following by id in a python script?
 
 for object in context.objectValues(['Folder', 'DTML 
 Document','ZipFolder','File','Image']):

objs=context.objectValues(['Folder', 'DTMLDocument','ZipFolder','File','Image'])
objs.sort()
for o in objs:
 ..

robert

 
 Import of sequence is not authorised in my python scripts, I am presuming 
 (probably wrongly) that sequence is needed for sort.
 Regards
 Garry
 ___
 Zope maillist  -  Zope@zope.org
 http://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists - 
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope-dev )
 
 

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sorting ids in python

2008-12-08 Thread Andreas Jung

On 08.12.2008 21:11 Uhr, robert rottermann wrote:

Garry Saddington schrieb:

Can anyone help me sort the following by id in a python script?

for object in context.objectValues(['Folder', 'DTML
Document','ZipFolder','File','Image']):


objs=context.objectValues(['Folder', 'DTMLDocument','ZipFolder','File','Image'])
objs.sort()
for o in objs:
  ..


huh? Afaik there is no sort order defined on a per-object basis.

-aj
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd.  Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:[EMAIL PROTECTED]
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sorting ids in python

2008-12-08 Thread robert rottermann
Andreas Jung schrieb:
 On 08.12.2008 21:11 Uhr, robert rottermann wrote:
 Garry Saddington schrieb:
 Can anyone help me sort the following by id in a python script?

 for object in context.objectValues(['Folder', 'DTML
 Document','ZipFolder','File','Image']):

 objs=context.objectValues(['Folder',
 'DTMLDocument','ZipFolder','File','Image'])
 objs.sort()
 for o in objs:
   ..
 
 huh? Afaik there is no sort order defined on a per-object basis.wh
I *allways* mixup objecItems with objectValues
so its objecItems(..).sort() ..
robert
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sorting

2007-01-25 Thread Andreas Jung



--On 25. Januar 2007 15:03:19 -0500 Kate Legere [EMAIL PROTECTED] wrote:



values=ao.objectItems(items)

values.sort(lambda a,b: cmp(a[0],b[0]))

Error Type: AttributeError
Error Value: 'tuple' object has no attribute 'sort'



This error message is self-explaining. You can only sort lists, not tuples.




Obviously, id isn't really what I wanted to sort by anyway but since I
can't even do that I can't really go on to try to


Look at the 'sequence' module and the 'sequence.sort' method as documented
in the Zope Book 2.7 Edition.

-aj

pgpFjiNhysTd5.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sorting is broken with UTF-8?

2005-04-14 Thread Andreas Jung

--On Donnerstag, 14. April 2005 12:20 Uhr +0200 Daniel Dekany 
[EMAIL PROTECTED] wrote:

I have a Zope 2.7.0(+Plone) instance that uses utf-8 encoding
everywhere. The problem is that alphabetical sorting (like with
DocumentTemplate.sequence.sort(seq, 'locale', ...)) is broken
everywhere: accented letters come after all US-ASCII characters. I have
locale=hu_HU.UTF-8 in zope.conf, still it seems that the collation
algorithm can't handle UTF-8 encoded strings correctly, and since 0x80
is higher than the code of the US-ASCII characters, a character that is
out of the US-ASCII range will be later than the US-ASCII ones. Actually
Python can't sort UTF-8 with strcoll either (at least I couldn't achieve
that), I guess the root of the problem is there.
Right. This is not a Zope problem so better ask the Python world or file a
Python bug report.
So, what should I do now? UTF-8 charset doesn't work in reality with
Zope so I should forget it and switch to ISO-8859-x?
sequence.sort() accepts also custom comparison methods. So you could write
your own method *somehow*.
-aj

pgpFnNNmaocdn.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sorting 'in'

2000-11-06 Thread Daniel Rusch

If it's a database query sorting with sql first. i.e. ORDER BY X,Y

HTH

Dan
 Yvonne Totty wrote:
 
 Hi!
 
 I need a query sorted by 2-3 different attributes. The
 'in' sort only lets me do it by one. Is there a way to
 get around it?
 
 TIA
 -y
 ~~~
 Yvonne Totty
 Database Engineer
 -
 Wolverine: You actually go outside in these things?
 Cyclops: Well, what would you prefer? Yellow spandex?


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




RE: [Zope] Sorting 'in'

2000-11-06 Thread Yvonne Totty

Yes, that is what I am doing, however was wanting
to not have to write several Z SQL Methods. 8)

~~~
Yvonne Totty
Database Engineer
-
Wolverine: You actually go outside in these things?
Cyclops: Well, what would you prefer? Yellow spandex?


 If it's a database query sorting with sql first. i.e. ORDER BY X,Y
 
 HTH
 
 Dan
  Yvonne Totty wrote:
  
  Hi!
  
  I need a query sorted by 2-3 different attributes. The
  'in' sort only lets me do it by one. Is there a way to
  get around it?
  
  TIA
  -y
  ~~~
  Yvonne Totty
  Database Engineer
  -
  Wolverine: You actually go outside in these things?
  Cyclops: Well, what would you prefer? Yellow spandex?
 
 

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Sorting 'in'

2000-11-06 Thread Gregory Haley

hi yvonne,

in your zsql method, you can order by several variables in the same
method call.
so you can do it all in one method.

ciao!
greg.

Gregory Haley
Venaca.com

Yvonne Totty wrote:
 
 Yes, that is what I am doing, however was wanting
 to not have to write several Z SQL Methods. 8)
 
 ~~~
 Yvonne Totty
 Database Engineer
 -
 Wolverine: You actually go outside in these things?
 Cyclops: Well, what would you prefer? Yellow spandex?
 
  If it's a database query sorting with sql first. i.e. ORDER BY X,Y
 
  HTH
 
  Dan
   Yvonne Totty wrote:
  
   Hi!
  
   I need a query sorted by 2-3 different attributes. The
   'in' sort only lets me do it by one. Is there a way to
   get around it?
  
   TIA
   -y
   ~~~
   Yvonne Totty
   Database Engineer
   -
   Wolverine: You actually go outside in these things?
   Cyclops: Well, what would you prefer? Yellow spandex?
  
 
 
 ___
 Zope maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists -
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope-dev )

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Sorting 'in'

2000-11-06 Thread Steve Spicklemire


Hi Yvonne,

   You could use Zieve, (http://www.zope.org/Members/sspickle/Zieve)
or you could render the 'order by' part of your clause from a variable
in the name space, or possibly the REQUEST itself. There was also a 
patch submitting at one point that allows variable (and I think multiple)
sort keys...

-steve

 "Yvonne" == Yvonne Totty [EMAIL PROTECTED] writes:

Yvonne Yes, that is what I am doing, however was wanting to not
Yvonne have to write several Z SQL Methods. 8)

Yvonne ~~~ Yvonne Totty
Yvonne Database Engineer - Wolverine: You
Yvonne actually go outside in these things?  Cyclops: Well, what
Yvonne would you prefer? Yellow spandex?


 If it's a database query sorting with sql first. i.e. ORDER BY
 X,Y
 
 HTH
 
 Dan  Yvonne Totty wrote:
  
  Hi!
  
  I need a query sorted by 2-3 different attributes. The  'in'
 sort only lets me do it by one. Is there a way to  get around
 it?
  
  TIA  -y  ~~~  Yvonne
 Totty  Database Engineer
  -
  Wolverine: You actually go outside in these things?  
 Cyclops: Well, what would you prefer? Yellow spandex?
 
 

Yvonne ___ Zope
Yvonne maillist - [EMAIL PROTECTED]
Yvonne http://lists.zope.org/mailman/listinfo/zope ** No cross
Yvonne posts or HTML encoding!  ** (Related lists -
Yvonne http://lists.zope.org/mailman/listinfo/zope-announce
Yvonne http://lists.zope.org/mailman/listinfo/zope-dev )



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Sorting 'in'

2000-11-06 Thread Andy McKay

Put an argument as sort_order and then your statement as:

SELECT * FROM Foo ORDER BY dtml-var sort_order ASC


--
  Andy McKay, Developer.
  ActiveState.
- Original Message - 
From: "Yvonne Totty" [EMAIL PROTECTED]
To: "Daniel Rusch" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, November 06, 2000 8:17 AM
Subject: RE: [Zope] Sorting 'in'


 Yes, that is what I am doing, however was wanting
 to not have to write several Z SQL Methods. 8)
 
 ~~~
 Yvonne Totty
 Database Engineer
 -
 Wolverine: You actually go outside in these things?
 Cyclops: Well, what would you prefer? Yellow spandex?
 
 
  If it's a database query sorting with sql first. i.e. ORDER BY X,Y
  
  HTH
  
  Dan
   Yvonne Totty wrote:
   
   Hi!
   
   I need a query sorted by 2-3 different attributes. The
   'in' sort only lets me do it by one. Is there a way to
   get around it?
   
   TIA
   -y
   ~~~
   Yvonne Totty
   Database Engineer
   -
   Wolverine: You actually go outside in these things?
   Cyclops: Well, what would you prefer? Yellow spandex?
  
  
 
 ___
 Zope maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope-dev )
 


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Sorting and accessing elements in the

2000-10-03 Thread Andy McKay

You need to let item=sequence-item since sequence-item is interpreted in
python as a mathemtical operation sequence minus item.

dtml-var standard_html_header

dtml-call "REQUEST.set('keys', REQUEST.form.keys())"
dtml-call "keys.sort()"

dtml-in keys
dtml-let item=sequence-itemdtml-var item:
dtml-var "REQUEST.form[item]"
/dtml-let
/dtml-in
dtml-var standard_html_footer


- Original Message -
From: "Max Møller Rasmussen" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 03, 2000 8:05 AM
Subject: [Zope] Sorting and accessing elements in the


 I am making a mailer zClass where it will only be nessecary to make the
form
 fields with the values you want to send, then the zClass will give you a
 reply on the webpage and send a nicely formatted e-mail.

 The problem is that the form elements are unknown but they need to be set
up
 in predictable order to format the output automatically.

 To do this I need the form values in a sorted order. I can then give the
 form fields names like this:

 input type=text name="1) First Name" value="Max M"
 input type=text name="2) Last Name" value ="Rasmussen"

 

 Then the mail can be automatically formatted like this:

 1) First Name
 Max M

 2) Last Name
 Rasmussen

 etc

 

 I have tried to use the sequence-item as a key in REQUEST.form, but it
 doesn't work like I want it to.

 -

 dtml-var standard_html_header

 dtml-var webReplyp
 dtml-call "REQUEST.set('keys', REQUEST.form.keys())"
 dtml-call "keys.sort()"

 dtml-in keys
 dtml-var sequence-item:br
 dtml-var "REQUEST.form[sequence-item]"p   THIS IS WHAT DOESNT
 WORK
 /dtml-in

 dtml-var standard_html_footer

 -

 Regards Max M


 ___
 Zope maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists -
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope-dev )



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope-dev] Re: [Zope] Sorting a list

2000-07-10 Thread Dieter Maurer

RC Compaan writes:
  I have a list:
  mylist=[('R',31),('I',80),('A',80),('S',23),('E',35),('C',21)]
  
  I want to rebuild the list sorted from high to low on the sequence-item.
  
  When i call  dtml-in mylist sort=sequence-item reverse the list gets
  sorted on the sequence-key not the sequence-item.  As I understand the
  alphabetical characters are the sequence-keys and the float values are the
  sequence-items.
  
  Where do misunderstand?
What you see is caused by the following code in
"DocumentTemplate.DT_In.InClass.__init__":

if has_key('sort'):
self.sort=sort=args['sort']
if sort=='sequence-item': self.sort=''


This means, "dtml-in sort=sequence-item" does not sort
by "sequence-item" but by the complete tuple (key,item).

I think, the special treatment of lists of pairs is
altogether a slight misfeature. It would probably
have been better to use a special "dict" attribute
in analogy to the "mapping" attribute to call
for the special pair interpretation.
'sequence-item' should then still be the complete item
and 'sequence-value' the second pair component.
Probably, it is too late by now to change this.


Dieter

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope] Sorting a list

2000-07-10 Thread Dieter Maurer

RC Compaan writes:
  I have a list:
  mylist=[('R',31),('I',80),('A',80),('S',23),('E',35),('C',21)]
  
  I want to rebuild the list sorted from high to low on the sequence-item.
  
  When i call  dtml-in mylist sort=sequence-item reverse the list gets
  sorted on the sequence-key not the sequence-item.  As I understand the
  alphabetical characters are the sequence-keys and the float values are the
  sequence-items.
  
  Where do misunderstand?
What you see is caused by the following code in
"DocumentTemplate.DT_In.InClass.__init__":

if has_key('sort'):
self.sort=sort=args['sort']
if sort=='sequence-item': self.sort=''


This means, "dtml-in sort=sequence-item" does not sort
by "sequence-item" but by the complete tuple (key,item).

I think, the special treatment of lists of pairs is
altogether a slight misfeature. It would probably
have been better to use a special "dict" attribute
in analogy to the "mapping" attribute to call
for the special pair interpretation.
'sequence-item' should then still be the complete item
and 'sequence-value' the second pair component.
Probably, it is too late by now to change this.


Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




RE: [Zope] Sorting a list descending using dtml-in

2000-07-04 Thread Pieter Claerhout

Seems to work fine in Zope 2.1.6...

Pieter


-Original Message-
From: Jerome Alet [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 04, 2000 3:48 PM
To: Pieter Claerhout
Cc: '[EMAIL PROTECTED]'
Subject: Re: [Zope] Sorting a list descending using dtml-in


On Tue, 4 Jul 2000, Pieter Claerhout wrote:

 if I'm iterating over a list using the dtml-in tag, is it then possible
 to sort the items descending?

IIRC:

!-- UNTESTED --
dtml-in mylist sort=id reverse
/dtml-in

bye,

Jerome ALET - [EMAIL PROTECTED] - http://cortex.unice.fr/~jerome
Faculte de Medecine de Nice - http://noe.unice.fr - Tel: 04 93 37 76 30 
28 Avenue de Valombrose - 06107 NICE Cedex 2 - FRANCE

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )