Back to index

plone3  3.1.7
Functions
plone.app.portlets.assignable Namespace Reference

Functions

def localPortletAssignmentMappingAdapter

Function Documentation

Zope 2 version of the localPortletAssignmentMappingAdapter factory.

Definition at line 18 of file assignable.py.

00018 
00019 def localPortletAssignmentMappingAdapter(context, manager):
00020     """Zope 2 version of the localPortletAssignmentMappingAdapter factory.
00021     """
00022     annotations = IAnnotations(context)
00023     local = annotations.get(CONTEXT_ASSIGNMENT_KEY, None)
00024     if local is None:
00025         local = annotations[CONTEXT_ASSIGNMENT_KEY] = OOBTree()
00026     portlets = local.get(manager.__name__, None)
00027     if portlets is None:
00028         portlets = local[manager.__name__] = PortletAssignmentMapping(manager=manager.__name__,
00029                                                                       category=CONTEXT_CATEGORY)
00030 
00031     # XXX: For graceful migration
00032     if not getattr(portlets, '__manager__', ''):
00033         portlets.__manager__ = manager.__name__
00034     if not getattr(portlets, '__category__', ''):
00035         portlets.__category__ = CONTEXT_CATEGORY
00036     
    return portlets