source: products/quintagroup.portlet.static/trunk/quintagroup/portlet/static/utils.py @ 3218

Last change on this file since 3218 was 616, checked in by fenix, 17 years ago

fixed view template for campaign content type and increment product version

  • Property svn:eol-style set to native
File size: 1.0 KB
Line 
1"""Some utility functions for common use"""
2
3from Products.CMFCore.utils import getToolByName
4
5def getVocabulary(context):
6    pp = getToolByName(context, 'portal_properties', None)
7    styles = None
8    if pp is not None:
9        sheet = getattr(pp, 'staticportlet_properties', None)
10        if sheet is not None:
11            dropdown_list = sheet.getProperty('portlet_dropdown', None)
12            if dropdown_list is not None:
13                styles = []
14                value_list = []
15                for line in dropdown_list:
16                    values = filter(lambda x:x.strip(), line.split('|', 1))
17                    if len(values) == 0:
18                        continue
19                    elif len(values) == 1:
20                        value = title = values[0]
21                    else:
22                        value = values[0]
23                        title = values[1]
24                    if value not in value_list:
25                        value_list.append(value)
26                        styles.append((value, title))
27    return styles
Note: See TracBrowser for help on using the repository browser.