Re: [Zope] Order by property
I think you don't need ZClasses for that. <dtml-in objectValues sort=myprop> <dtml-var title_or_id><br> </dtml-in> This will do what you want. Just play a little with it. I tested it only quickly. myprop is just a property for each doc. Methods do not have own props, but they are displayed though. -- Lars Heber, mailto:Lars.Heber@t-systems.de TTTTTT TT T-Systems, debis Systemhaus GEI GmbH O TT O O O TT
Lars Thanks for that it has taken me part way as I can certainly now create an order for the items in the directory. Unfortunately if I try to change the code to <dtml-in objectValues sort=paraNum> <dtml-var sequence-item><br> </dtml-in> The code breaks telling me that Zope has encountered an error while publishing this resource. Error Type: KeyError Error Value: para1.paraNum the only change is the dtml-var for the display in the loop to sequence-item in order to, I thought, display the object? I suspect that this is a lack of knowledge of mine with the in built properties/methods of a DTML document but if you/anyone can put me right I would be very grateful. Andrew -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Lars Heber Sent: 08 March 2001 18:08 To: zope@zope.org Subject: Re: [Zope] Order by property I think you don't need ZClasses for that. <dtml-in objectValues sort=myprop> <dtml-var title_or_id><br> </dtml-in> This will do what you want. Just play a little with it. I tested it only quickly. myprop is just a property for each doc. Methods do not have own props, but they are displayed though. -- Lars Heber, mailto:Lars.Heber@t-systems.de TTTTTT TT T-Systems, debis Systemhaus GEI GmbH O TT O O O TT _______________________________________________ Zope maillist - Zope@zope.org 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 )
Andrew Fielden schrieb:
Lars
Thanks for that it has taken me part way as I can certainly now create an order for the items in the directory.
Unfortunately if I try to change the code to <dtml-in objectValues sort=paraNum> <dtml-var sequence-item><br> </dtml-in>
The code breaks telling me that Zope has encountered an error while publishing this resource.
Error Type: KeyError Error Value: para1.paraNum
Doesn't do that with my test... - it works!?! Perhaps try <dtml-var "_['sequence-item']"> But now I've got an idea: Through that construct _every_ doc / method in your folder is rendered! So I think the error occurs in one of your docs / methods, but not in that construct! This can be quite confusing! Also be aware that the method itself is rendered again - but for some (for me quite unclear) reasons it doesn't render the construct recursively - I think that is because the repeatedly rendered method doesn't have elements in objectValues. You can test that by inserting a line: <dtml-in objectValues sort=myprop> <dtml-var "_['sequence-item']"><br> <dtml-else>No elements in list to run through...<br> </dtml-in> It could also be the case that the error occurs in the method when rendered again. So just avoid to render "yourself" again: <dtml-in objectValues sort=myprop> <dtml-unless "_['document_id'] == _['id']"> <dtml-var sequence-item><p><br></p> </dtml-unless> <dtml-else>No elements in list to run through...<br> </dtml-in> Note to use the long winded _['...'] thing for getting a string instead of just "document_id == id" which are methods or somewhat... Don't know exactly. -- Lars Heber, mailto:Lars.Heber@t-systems.de TTTTTT TT T-Systems, debis Systemhaus GEI GmbH O TT O O O TT
Lars I now have it working - using all of the methods (including the simple one that didn't work for my directory). I have looked and looked at the original but cannot see how it is different! Anyhow thank you again for your help. Andrew -----Original Message----- From: Lars Heber [mailto:Lars.Heber@t-systems.de] Sent: 09 March 2001 11:50 To: andrew.fielden@emotion.co.uk Cc: zope@zope.org Subject: Re: [Zope] Order by property Andrew Fielden schrieb:
Lars
Thanks for that it has taken me part way as I can certainly now create an order for the items in the directory.
Unfortunately if I try to change the code to <dtml-in objectValues sort=paraNum> <dtml-var sequence-item><br> </dtml-in>
The code breaks telling me that Zope has encountered an error while publishing this resource.
Error Type: KeyError Error Value: para1.paraNum
Doesn't do that with my test... - it works!?! Perhaps try <dtml-var "_['sequence-item']"> But now I've got an idea: Through that construct _every_ doc / method in your folder is rendered! So I think the error occurs in one of your docs / methods, but not in that construct! This can be quite confusing! Also be aware that the method itself is rendered again - but for some (for me quite unclear) reasons it doesn't render the construct recursively - I think that is because the repeatedly rendered method doesn't have elements in objectValues. You can test that by inserting a line: <dtml-in objectValues sort=myprop> <dtml-var "_['sequence-item']"><br> <dtml-else>No elements in list to run through...<br> </dtml-in> It could also be the case that the error occurs in the method when rendered again. So just avoid to render "yourself" again: <dtml-in objectValues sort=myprop> <dtml-unless "_['document_id'] == _['id']"> <dtml-var sequence-item><p><br></p> </dtml-unless> <dtml-else>No elements in list to run through...<br> </dtml-in> Note to use the long winded _['...'] thing for getting a string instead of just "document_id == id" which are methods or somewhat... Don't know exactly. -- Lars Heber, mailto:Lars.Heber@t-systems.de TTTTTT TT T-Systems, debis Systemhaus GEI GmbH O TT O O O TT
participants (2)
-
Andrew Fielden -
Lars Heber