Re: [Zope] Python method for getting contents of a sub-folder
Something like:
l = [] for obj in container.First_Folder.objectValues(): url = obj.absolute_url() title = obj.title l.append((url, title)) return l
Thank you very much for your response. I've been playing around with the code and now have it so that it returns the data with the specified id. Do you happen to know how to get the url and title values printed out using DTML? <dtml-with expr="get_staff_info('first_person')"> <A HREF="<dtml-var sequence_item[0]>"><dtml-var sequence_item[1]></A> </dtml-with> ..gave me a key error. <dtml-with expr="l=get_staff_info('first_person')"> <A HREF="<dtml-var l[0]>"><dtml-var l[1]></A> </dtml-with> .. gave me a syntax error. Thanks again! Ron
Then you may want to use a mapping and take a parameter, and do it slightly differently. The following is untested: #parameter: id try: obj = container.First_Folder[id] url = obj.absolute_url() title = obj.title return (url, title) except KeyError: return None <dtml-with expr="get_staff_info('first_person')"> <A HREF="<dtml-var sequence-key url_quoted>"><dtml-var sequence-item></A> </dtml-with> Florent Guillaume Nuxeo
participants (2)
-
complaw@hal-pc.org -
Florent Guillaume