Back to index

plone3  3.1.7
collectKeywords.py
Go to the documentation of this file.
00001 ## Script (Python) "collectKeywords"
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=name, index, vocab_source='portal_catalog'
00009 REQUEST=context.REQUEST
00010 
00011 
00012 ## With the advent of multi-cataloging we need to pass an optional
00013 ## catalog id to use for the widget.
00014 
00015 allowed, enforce = context.Vocabulary(name)
00016 catalog = getattr(container, vocab_source)
00017 previous = catalog.uniqueValuesFor(index)
00018 
00019 if enforce:
00020     result = allowed
00021 else:
00022     result = allowed + previous
00023 
00024 result = result.sortedByValue()
00025 
00026 return result