Back to index

plone3  3.1.7
Functions
plone.portlets.utils Namespace Reference

Functions

def registerPortletType
def unregisterPortletType
def hashPortletInfo
def unhashPortletInfo

Function Documentation

Creates a hash from the portlet information.

This is a bidirectional function. The hash must only contain characters
acceptable as part of a html id.

info is the portlet info dictionary. Hash is put into info, and
also returned.

Definition at line 37 of file utils.py.

00037 
00038 def hashPortletInfo(info):
00039     """Creates a hash from the portlet information.
00040 
00041     This is a bidirectional function. The hash must only contain characters
00042     acceptable as part of a html id.
00043 
00044     info is the portlet info dictionary. Hash is put into info, and
00045     also returned.
00046     """
00047     concat_txt = '%(manager)s\n%(category)s\n%(key)s\n%(name)s' % info
00048     info['hash'] = binascii.b2a_hex(concat_txt)
00049     return info['hash']

Here is the caller graph for this function:

def plone.portlets.utils.registerPortletType (   site,
  title,
  description,
  addview,
  for_ = [Interface] 
)
Register a new type of portlet.

site should be the local site where the registration should be made. The 
title and description should be meaningful metadata about the portlet for 
the UI.

The addview should be the name of an add view registered, and must be 
unique.

Definition at line 7 of file utils.py.

00007 
00008 def registerPortletType(site, title, description, addview, for_=[Interface]):
00009     """Register a new type of portlet.
00010     
00011     site should be the local site where the registration should be made. The 
00012     title and description should be meaningful metadata about the portlet for 
00013     the UI.
00014     
00015     The addview should be the name of an add view registered, and must be 
00016     unique.
00017     """
00018     sm = getSiteManager(site)
00019     
00020     portlet = PortletType()
00021     portlet.title = title
00022     portlet.description = description
00023     portlet.addview = addview
00024     portlet.for_ = for_
00025     
00026     sm.registerUtility(component=portlet, provided=IPortletType, name=addview)
    
Creates the portlet info from the hash.

Output is the info dictionary (containing only the 
hashed fields).

Definition at line 50 of file utils.py.

00050 
00051 def unhashPortletInfo(hash):
00052     """Creates the portlet info from the hash.
00053 
00054     Output is the info dictionary (containing only the 
00055     hashed fields).
00056     """
00057     concat_txt = binascii.a2b_hex(hash)
00058     manager, category, key, name = concat_txt.splitlines()
00059     info = dict(manager=manager, category=category, key=key, name=name, hash=hash)
00060     return info

Here is the call graph for this function:

Here is the caller graph for this function:

def plone.portlets.utils.unregisterPortletType (   site,
  addview 
)
Unregister a portlet type.

site is the local site where the registration was made. The addview 
should is used to uniquely identify the portlet.

Definition at line 27 of file utils.py.

00027 
00028 def unregisterPortletType(site, addview):
00029     """Unregister a portlet type.
00030     
00031     site is the local site where the registration was made. The addview 
00032     should is used to uniquely identify the portlet.
00033     """
00034     
00035     sm = getSiteManager(site)
00036     sm.unregisterUtility(provided=IPortletType, name=addview)