Back to index

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

Classes

class  DefaultDashboard

Functions

def new_user

Function Documentation

def plone.app.portlets.dashboard.new_user (   principal,
  event 
)
Initialise the dashboard for a new user

Definition at line 16 of file dashboard.py.

00016 
00017 def new_user(principal, event):
00018     """Initialise the dashboard for a new user
00019     """
00020     defaults = IDefaultDashboard(principal, None)
00021     if defaults is None:
00022         return
00023     
00024     userid = principal.getId()
00025     portlets = defaults()
00026     
00027     for name in ('plone.dashboard1', 'plone.dashboard2', 'plone.dashboard3', 'plone.dashboard4'):
00028         assignments = portlets.get(name)
00029         if assignments:
00030             column = queryUtility(IPortletManager, name=name)
00031             if column is not None:
00032                 category = column.get(USER_CATEGORY, None)
00033                 if category is not None:
00034                     manager = category.get(userid, None)
00035                     if manager is None:
00036                         manager = category[userid] = UserPortletAssignmentMapping(manager=name,
00037                                                                                   category=USER_CATEGORY,
00038                                                                                   name=userid)
00039                     chooser = INameChooser(manager)
00040                     for assignment in assignments:
00041                         manager[chooser.chooseName(None, assignment)] = assignment