Back to index

plone3  3.1.7
Classes | Functions
plone.app.portlets.portlets.navigation Namespace Reference

Classes

class  INavigationPortlet
class  Assignment
class  Renderer
class  AddForm
class  EditForm
class  QueryBuilder
class  NavtreeStrategy

Functions

def getRootPath

Function Documentation

def plone.app.portlets.portlets.navigation.getRootPath (   context,
  currentFolderOnly,
  topLevel,
  root 
)
Helper function to calculate the real root path

Definition at line 323 of file navigation.py.

00323 
00324 def getRootPath(context, currentFolderOnly, topLevel, root):
00325     """Helper function to calculate the real root path
00326     """
00327     context = aq_inner(context)
00328     if currentFolderOnly:
00329         folderish = getattr(aq_base(context), 'isPrincipiaFolderish', False) and not INonStructuralFolder.providedBy(context)
00330         parent = aq_parent(context)
00331         
00332         is_default_page = False
00333         browser_default = IBrowserDefault(parent, None)
00334         if browser_default is not None:
00335             is_default_page = (browser_default.getDefaultPage() == context.getId())
00336         
00337         if not folderish or is_default_page:
00338             return '/'.join(parent.getPhysicalPath())
00339         else:
00340             return '/'.join(context.getPhysicalPath())
00341 
00342     rootPath = getNavigationRoot(context, relativeRoot=root)
00343 
00344     # Adjust for topLevel
00345     if topLevel > 0:
00346         contextPath = '/'.join(context.getPhysicalPath())
00347         if not contextPath.startswith(rootPath):
00348             return None
00349         contextSubPathElements = contextPath[len(rootPath)+1:]
00350         if contextSubPathElements:
00351             contextSubPathElements = contextSubPathElements.split('/')
00352             if len(contextSubPathElements) < topLevel:
00353                 return None
00354             rootPath = rootPath + '/' + '/'.join(contextSubPathElements[:topLevel])
00355         else:
00356             return None
00357     
00358     return rootPath

Here is the call graph for this function:

Here is the caller graph for this function: