Back to index

plone3  3.1.7
getUniqueWidgetAttr.py
Go to the documentation of this file.
00001 ## Script (Python) "getUniqueWidgetAttr"
00002 ##title=Edit content
00003 ##bind container=container
00004 ##bind context=context
00005 ##bind namespace=
00006 ##bind script=script
00007 ##bind subpath=traverse_subpath
00008 ##parameters=fields, attr
00009 ##
00010 
00011 order = []
00012 
00013 for f in fields:
00014     widget = f.widget
00015     helper = getattr(widget, attr, None)
00016     # We expect the attribute value to be a iterable.
00017     if helper:
00018         # I love list comprehension ;)
00019         [order.append(item) for item in helper
00020          if item not in order]
00021 
00022 return order