|
Last change
on this file since 996 was
1,
checked in by myroslav, 21 years ago
|
|
Building directory structure
|
-
Property svn:eol-style set to
native
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | from Acquisition import aq_base, aq_inner, aq_parent |
|---|
| 2 | from Products.CMFCore.utils import getToolByName |
|---|
| 3 | |
|---|
| 4 | def isDefaultPage(context): |
|---|
| 5 | plone_utils = getToolByName(context, 'plone_utils') |
|---|
| 6 | return plone_utils.isDefaultPage(context) |
|---|
| 7 | |
|---|
| 8 | def getDefaultPage(context): |
|---|
| 9 | plone_utils = getToolByName(context, 'plone_utils') |
|---|
| 10 | return plone_utils.getDefaultPage(context) |
|---|
| 11 | |
|---|
| 12 | def isStructuralFolder(context): |
|---|
| 13 | plone_utils = getToolByName(context, 'plone_utils') |
|---|
| 14 | return plone_utils.isStructuralFolder(context) |
|---|
| 15 | |
|---|
| 16 | def getParentObject(context): |
|---|
| 17 | return aq_parent(aq_inner(context)) |
|---|
| 18 | |
|---|
| 19 | def getCurrentFolder(context): |
|---|
| 20 | if isStructuralFolder(context) and not isDefaultPage(context): |
|---|
| 21 | return context |
|---|
| 22 | return getParentObject(context) |
|---|
| 23 | |
|---|
| 24 | def isFolderOrFolderDefaultPage(context): |
|---|
| 25 | if isStructuralFolder(context) or isDefaultPage(context): |
|---|
| 26 | return True |
|---|
| 27 | return False |
|---|
| 28 | |
|---|
| 29 | def 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.