Last change
on this file since 3555 was
3555,
checked in by vmaksymiv, 12 years ago
|
PPP fixes
|
File size:
1.0 KB
|
Rev | Line | |
---|
[1572] | 1 | """Somme utility functions for common use""" |
---|
| 2 | from Products.CMFCore.utils import getToolByName |
---|
| 3 | |
---|
[3555] | 4 | |
---|
[1572] | 5 | def getStylesVocabulary(context): |
---|
| 6 | pp = getToolByName(context, 'portal_properties', None) |
---|
| 7 | styles = None |
---|
| 8 | if pp is not None: |
---|
| 9 | sheet = getattr(pp, 'qcollectionportlet_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: |
---|
[3555] | 16 | values = filter(lambda x: x.strip(), line.split('|', 1)) |
---|
[1572] | 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.