Changeset 9842

Show
Ignore:
Timestamp:
06/26/08 13:30:13 (5 months ago)
Author:
asterix
Message:

remove duplicate function, simplify logic

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/xmpp/debug.py

    r9487 r9842  
    284284            self._fh.write( '%s%s%s' % ( pre, s, suf )) 
    285285        self._fh.flush() 
    286              
    287286                 
    288     def is_active( self, flag ): 
    289         'If given flag(s) should generate output.' 
    290  
    291         # try to abort early to quicken code 
    292         if not self.active: 
    293             return 0 
    294         if not flag or flag in self.active: 
    295             return 1 
    296         else: 
    297             # check for multi flag type: 
    298             if type( flag ) in ( type(()), type([]) ): 
    299                 for s in flag: 
    300                     if s in self.active: 
    301                         return 1 
    302         return 0 
    303  
    304      
    305287    def active_set( self, active_flags = None ): 
    306288        "returns 1 if any flags where actually set, otherwise 0." 
     
    412394    def is_active( self, flag ): 
    413395        if not self.active: return 0 
    414         if not flag or flag in self.active and DBG_ALWAYS not in self.active or flag not in self.active and DBG_ALWAYS in self.active : return 1 
     396        if not flag or ((flag in self.active) ^ (DBG_ALWAYS in self.active)) : return 1 
    415397        return 0 
    416398