Back to index

plone3  3.1.7
Namespaces | Functions
five.localsitemanager Namespace Reference

Namespaces

namespace  browser
namespace  registry
namespace  tests
namespace  utils

Functions

def make_site
def make_objectmanager_site
def find_next_sitemanager
def update_sitemanager_bases
def update_sitemanager_bases_handler

Function Documentation

Find the closest sitemanager that is not the specified site's
sitemanager.

Definition at line 41 of file __init__.py.

00041 
00042 def find_next_sitemanager(site):
00043     """Find the closest sitemanager that is not the specified site's
00044     sitemanager.
00045     """
00046     container = site
00047     sm = None
00048     while sm is None:
00049         if IContainmentRoot.providedBy(container):
00050             # We are at the root site, return None
00051             return None
00052 
00053         try:
00054             container = get_parent(container)
00055             if container is None:
00056                 return None
00057         except TypeError:
00058             # There was not enough context; probably run from a test
00059             return None
00060 
00061         if ISite.providedBy(container):
00062             sm = container.getSiteManager()
00063     return sm
00064 

Here is the call graph for this function:

Here is the caller graph for this function:

Just a bit of sugar coating to make an unnofficial objectmanager
based site.

Definition at line 34 of file __init__.py.

00034 
00035 def make_objectmanager_site(obj):
00036     """Just a bit of sugar coating to make an unnofficial objectmanager
00037     based site.
00038     """
00039     make_site(obj, IObjectManagerSite)
00040 

Here is the call graph for this function:

Here is the caller graph for this function:

def five.localsitemanager.make_site (   obj,
  iface = ISite 
)
Give the specified object required qualities to identify it as a proper
ISite.

Definition at line 11 of file __init__.py.

00011 
00012 def make_site(obj, iface=ISite):
00013     """Give the specified object required qualities to identify it as a proper
00014     ISite.
00015     """
00016     if ISite.providedBy(obj):
00017         raise ValueError('This is already a site')
00018     
00019     next = find_next_sitemanager(obj)
00020     if next is None:
00021         next = base
00022 
00023     enableSite(obj, iface=iface)
00024 
00025     name = 'five'
00026     path = getattr(obj, 'getPhysicalPath', None)
00027     if path is not None and callable(path):
00028         name = '/'.join(path())
00029 
00030     components = PersistentComponents(name=name, bases=(next,))
00031     obj.setSiteManager(components)
00032     components.__parent__ = aq_base(obj)
00033 

Here is the call graph for this function:

Here is the caller graph for this function:

Formulate the most appropriate __bases__ value for a site's site manager
by asking find_next_sitemanager what the next appropriate site manager
is.  After this call, the __bases__ is guaranteed to have one and only
one value in the __bases__ list/tuple.

Definition at line 65 of file __init__.py.

00065 
00066 def update_sitemanager_bases(site):
00067     """Formulate the most appropriate __bases__ value for a site's site manager
00068     by asking find_next_sitemanager what the next appropriate site manager
00069     is.  After this call, the __bases__ is guaranteed to have one and only
00070     one value in the __bases__ list/tuple.
00071     """
00072     next = find_next_sitemanager(site)
00073     if next is None:
00074         next = base
00075     sm = site.getSiteManager()
00076     sm.__bases__ = (next, )
00077 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 78 of file __init__.py.

Here is the call graph for this function: