[ZPT] batching and sorting in one go
Jim Kutter
jim@ebizq.net
Thu, 27 Jun 2002 14:18:02 -0400
Hi, not sure if this is correct, but it was my experience that calling =
methods with parameters, all the parameters must be passed by name.
i.e.
here.adv_sort(results,arg=3D'born',mode=3D'up')
make into
here.adv_sort(results=3Dresuts,arg=3D'born',mode=3D'up')
Like I said, I've had similar problems when I didn't specify each =
parameter explicity, but don't quote it as the rule. I'm kind of new too =
;)
-jim
----- Original Message -----=20
From: "Michal Kurowski" <michal@genesilico.pl>
To: <zpt@zope.org>
Sent: Thursday, June 27, 2002 2:12 PM
Subject: [ZPT] batching and sorting in one go
> Hi,
>=20
> I'm rather a newcomer to Zope and I'm afraid I try to do something I'm
> not quite up to.
>=20
> There's a lot of nice guides on sorting and batching but I'm still I'm
> having a lot of trouble to put the pieces together.
>=20
> What I've got:
>=20
> A rather simple ZSQL method which is supposed to be displayed in the
> table. There are links on that page to sort results based on some
> criteria and there're batching links.
>=20
> I decided to do this like this: Do everything in a Py script which has
> parameters both from the ZSQl method and from those sorting links.
> My script is a stolen one from the zopelabs example by cduncan.
>=20
> I try to modify it to accept additional parameters to enable sorting
> like this:
>=20
> <td width=3D"15%" align=3D"right"><a tal:attributes=3D"href python:
> here.adv_sort(results,arg=3D'born',mode=3D'up')" href=3D"up"><span
> tal:replace=3D"structure root/meta/images/up">up</span></a></td>
> =20
> <td width=3D"15%" align=3D"right"><a tal:attributes=3D"href python:
> here.adv_sort(results,arg=3Dborn,mode=3D'down')" href=3D"down"><span
> tal:replace=3D"structure root/meta/images/down">down</span></a></td>
>=20
> etc.
>=20
> and in the script:
>=20
> batch =3D Batch(results, size, start, 0, orphan, overlap)
>=20
> if arg is not None and mode is not None:
> if mode =3D=3D 'up':
> out =3D batch.sort(arg, 'asc')
> elif mode =3D=3D 'down':
> out =3D batch.sort(arg, 'desc')
> else:
> out =3D batch
>=20
> Something is wrong in here - I've errors like
>=20
> Error Type: TALESError
> Error Value: exceptions.AttributeError on sort in "", at line 46, =
column 34
>=20
> Could you please explain it me ?
>=20
> --=20
> Michal Kurowski
> <michal@genesilico.pl>
>=20
>=20
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt
>=20