source: products/qPloneTabs/tags/0.3.1/skins/qPloneTabs/getPageTitle.py @ 1591

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
11from Products.CMFCore.utils import getToolByName
12from Products.qPloneTabs.config import PROPERTY_SHEET, FIELD_NAME
13
14portal_props = getToolByName(context, 'portal_properties')
15
16default_title = 'Plone \'%s\' Configuration' % category
17
18if not hasattr(portal_props, PROPERTY_SHEET):
19    return default_title
20
21sheet = getattr(portal_props, PROPERTY_SHEET)
22
23if not hasattr(sheet, FIELD_NAME):
24    return default_title
25
26field = sheet.getProperty(FIELD_NAME)
27dict = {}
28
29for line in field:
30    cat, title = line.split('|', 2)
31    dict[cat] = title
32
33return dict.get(category, None) or default_title
Note: See TracBrowser for help on using the repository browser.