Changeset 3817

Show
Ignore:
Timestamp:
06/10/08 13:20:05 (5 months ago)
Author:
k0s
Message:

adding JS backend for a few new comparitors

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ticketsubmitpolicyplugin/0.11/ticketsubmitpolicy/ticketsubmitpolicy.py

    r3765 r3817  
    132132    policies = ExtensionPoint(ITicketSubmitPolicy) 
    133133 
    134     comparitors =  {'!=': 'is', '==': 'isNot'} 
     134    comparitors =  {'!=': 'is',  
     135                    '==': 'isNot', 
     136                    'in': 'isIn', 
     137                    'not in': 'isNotIn' } 
    135138 
    136139    def policy_dict(self): 
     
    181184    def filter_stream(self, req, method, filename, stream, data): 
    182185 
    183         # temporary staging ground for ticket policy behavior 
    184         # XXX things here should be abstracted 
    185 #        policies = [ {'contingentfield': 'type', 'value': 'defect',  
    186 #                      'function': 'requires', 'args': [ 'version' ]}, 
    187 #                     {'contingentfield': 'type', 'value': 'defect',  
    188 #                      'function': 'excludes', 'args': [ 'version' ]}, 
    189 #                     ] 
    190  
    191186        if filename == 'ticket.html': 
    192187 
     
    310305return (x != y); 
    311306} 
     307 
     308function isIn(x, y) 
     309{ 
     310for (index in y) 
     311{ 
     312 
     313if(x == y[index]) 
     314{ 
     315return true; 
     316} 
     317 
     318} 
     319return false; 
     320} 
     321 
     322function isNotIn(x, y) 
     323{ 
     324return !isIn(x,y); 
     325} 
     326 
    312327""" 
    313328        return string