Ignore:
Timestamp:
30/03/10 17:16:31 (11 years ago)
Author:
pjkersha
Message:
  • Added marshalling function for condition <Apply> to marshall inputs for given functionId.
  • implemented string-at-least-one-member-of function.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/NDG_XACML/ndg/xacml/core/functions/__init__.py

    r6780 r6790  
    286286        """Force function entries to derive from AbstractFunction and IDs to 
    287287        be string type 
    288         """ 
    289         def keyFilter(key): 
    290             """Enforce string type keys""" 
    291             if not isinstance(key, basestring): 
    292                 raise TypeError('Expecting %r type for key; got %r' %  
    293                                 (basestring, type(key)))  
    294             return True  
    295          
    296         def valueFilter(value): 
    297             """Enforce AbstractFunction derived types for match functions""" 
    298  
    299             if not isinstance(value,  
    300                               (AbstractFunction, NotImplemented.__class__)): 
    301                 raise TypeError('Expecting %r derived type for value; got %r' %  
    302                                 (AbstractFunction, type(value)))  
    303             return True  
    304                       
    305         super(FunctionMap, self).__init__(keyFilter, valueFilter) 
    306          
     288        """         
     289        # Filters are defined as staticmethods but reference via self here to  
     290        # enable derived class to override them as standard methods without 
     291        # needing to redefine this __init__ method             
     292        super(FunctionMap, self).__init__(self.keyFilter, self.valueFilter) 
     293         
     294    @staticmethod 
     295    def keyFilter(key): 
     296        """Enforce string type keys""" 
     297        if not isinstance(key, basestring): 
     298            raise TypeError('Expecting %r type for key; got %r' %  
     299                            (basestring, type(key)))  
     300        return True  
     301     
     302    @staticmethod 
     303    def valueFilter(value): 
     304        """Enforce AbstractFunction derived types for match functions""" 
     305 
     306        if not isinstance(value,  
     307                          (AbstractFunction, NotImplemented.__class__)): 
     308            raise TypeError('Expecting %r derived type for value; got %r' %  
     309                            (AbstractFunction, type(value)))  
     310        return True  
     311            
    307312    def load(self): 
    308313        """Load function map with implementations from the relevant function 
Note: See TracChangeset for help on using the changeset viewer.