source: products/qSiloGroup/trunk/utils.py @ 199

Last change on this file since 199 was 199, checked in by chervol, 18 years ago

new portlets lyout, time formating updated

File size: 1.1 KB
Line 
1from Acquisition import aq_base, aq_inner, aq_parent
2from Products.CMFCore.utils import getToolByName
3
4def isDefaultPage(context):
5    plone_utils = getToolByName(context, 'plone_utils')
6    return plone_utils.isDefaultPage(context)
7
8def getDefaultPage(context):
9    plone_utils = getToolByName(context, 'plone_utils')
10    return plone_utils.getDefaultPage(context)
11
12def isStructuralFolder(context):
13    plone_utils = getToolByName(context, 'plone_utils')
14    return plone_utils.isStructuralFolder(context)
15
16def getParentObject(context):
17    return aq_parent(aq_inner(context))
18
19def getCurrentFolder(context):
20    if isStructuralFolder(context) and not isDefaultPage(context):
21        return context
22    return getParentObject(context)
23
24def isFolderOrFolderDefaultPage(context):
25    if isStructuralFolder(context) or isDefaultPage(context):
26        return True
27    return False
28
29def isPortalOrPortalDefaultPage(context):
30    portal = getToolByName(context, 'portal_url').getPortalObject()
31    if aq_base(context) is aq_base(portal) or \
32        (aq_base(getParentObject(context)) is aq_base(portal) and
33        isDefaultPage(context)):
34        return True
35    return False
Note: See TracBrowser for help on using the repository browser.