Changeset 1574 in products


Ignore:
Timestamp:
Jan 21, 2010 12:28:18 PM (14 years ago)
Author:
mylan
Message:

#246: Add importing black-lists for portlet step

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/portlets.py

    r1573 r1574  
    114114                child.setAttribute('manager', manager_name) 
    115115                child.setAttribute('category', category) 
    116                 child.setAttribute('location', '/'.join(obj.getPhysicalPath())) 
    117116             
    118117                status = assignable.getBlacklistStatus(category) 
     
    164163                    if elem.nodeName == 'assignment': 
    165164                        self.importAssignment(obj, elem) 
    166                     #elif elem.nodeName == 'blacklist': 
    167                         #self.importBlacklist(obj, elem) 
     165                    elif elem.nodeName == 'blacklist': 
     166                        self.importBlacklist(obj, elem) 
    168167 
    169168            yield item 
     
    204203        assignment_handler = IPortletAssignmentExportImportHandler(assignment) 
    205204        assignment_handler.import_assignment(portlet_interface, node) 
     205 
     206    def importBlacklist(self, obj, node): 
     207        """ Import a blacklist from a node 
     208        """ 
     209        manager = node.getAttribute('manager') 
     210        category = node.getAttribute('category') 
     211        status = node.getAttribute('status') 
     212         
     213        manager = getUtility(IPortletManager, name=manager) 
     214         
     215        assignable = queryMultiAdapter((obj, manager), ILocalPortletAssignmentManager) 
     216         
     217        if status.lower() == 'block': 
     218            assignable.setBlacklistStatus(category, True) 
     219        elif status.lower() == 'show': 
     220            assignable.setBlacklistStatus(category, False) 
     221        elif status.lower() == 'acquire': 
     222            assignable.setBlacklistStatus(category, None) 
     223 
    206224 
    207225logger = logging.getLogger('quintagroup.transmogrifier.portletsimporter') 
Note: See TracChangeset for help on using the changeset viewer.