[Zope] Accessing CURRENT property
Hello, if I have a folder1 in a folder2 and my folder 1 has a certain property. If I want to know if folder2 has the property I use hasattr() method on folder2, but it returns true because it looks down the hierarchy and sees the property in folder1. is there a way to check for the property in folder2 ONLY without checking the ancestor folders?. Thanks! __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.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 )
[Zope] DTML-tree Custom sort
Hello, I am trying to do a custom sort. I am using: dtml-tree branches_expr=objectValues(['Folder']) sort=orderInt skip_unauthorized orderInt is an integer property of some folders. I would like the dtml-tree tag to look up the property of the current folder and sort based on the integer value, but if the property does not exist I would like it to be excluded from the tree. Is there a way to do it? Thanks for any help! __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.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] DTML-tree Custom sort
Thanks for your help AJ I get this: Error Type: SyntaxError Error Value: invalid syntax (line 1) dtml-tree branches_expr=[o for o in objectValues(['Folder'] if hasattr('orderInt'))] sort=orderInt skip_unauthorized It doesn't like how I put spaces in objectValues() attributes for if hasattr... Is the syntax a bit different? Thanks! --- Andreas Jung [EMAIL PROTECTED] wrote: --On 2. Oktober 2005 09:43:02 -0700 Alex Renier [EMAIL PROTECTED] wrote: dtml-tree branches_expr=objectValues(['Folder']) sort=orderInt skip_unauthorized perhaps dtml-tree branches_expr=[o for o in objectValues(['Folder'] if hasattr('orderInt')]) sort=orderInt skip_unauthorized -aj __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.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] Re: DTML-tree Custom sort
Great thank you both!!! I never knew you could do if-statements like that. --- Chris Beaven [EMAIL PROTECTED] wrote: Alex Renier wrote: Thanks for your help AJ I get this: Error Type: SyntaxError Error Value: invalid syntax (line 1) dtml-tree branches_expr=[o for o in objectValues(['Folder'] if hasattr('orderInt'))] sort=orderInt skip_unauthorized I think that Andreas meant dtml-tree branches_expr=[o for o in objectValues(['Folder']) if hasattr(o,'orderInt')] sort=orderInt skip_unauthorized ___ 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 ) __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.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 )