Last change
on this file since 1591 was
1,
checked in by myroslav, 18 years ago
|
Building directory structure
|
-
Property svn:eol-style set to
native
|
File size:
794 bytes
|
Line | |
---|
1 | ## Script (Python) "getPageTitle" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters= category='portal_tabs' |
---|
8 | ##title= |
---|
9 | ## |
---|
10 | |
---|
11 | from Products.CMFCore.utils import getToolByName |
---|
12 | from Products.qPloneTabs.config import PROPERTY_SHEET, FIELD_NAME |
---|
13 | |
---|
14 | portal_props = getToolByName(context, 'portal_properties') |
---|
15 | |
---|
16 | default_title = 'Plone \'%s\' Configuration' % category |
---|
17 | |
---|
18 | if not hasattr(portal_props, PROPERTY_SHEET): |
---|
19 | return default_title |
---|
20 | |
---|
21 | sheet = getattr(portal_props, PROPERTY_SHEET) |
---|
22 | |
---|
23 | if not hasattr(sheet, FIELD_NAME): |
---|
24 | return default_title |
---|
25 | |
---|
26 | field = sheet.getProperty(FIELD_NAME) |
---|
27 | dict = {} |
---|
28 | |
---|
29 | for line in field: |
---|
30 | cat, title = line.split('|', 2) |
---|
31 | dict[cat] = title |
---|
32 | |
---|
33 | return dict.get(category, None) or default_title |
---|
Note: See
TracBrowser
for help on using the repository browser.