Changeset 193

Show
Ignore:
Timestamp:
Thu Mar 2 10:50:00 2006
Author:
drew
Message:

ready for v1.0.2

Files:

Legend:

Unmodified
Added
Removed
Modified
  • branches/utils/utiltests.py

    r187 r193  
      1 import xix.utils.config  
    1 2 import xix.utils.console  
    2 3 import xix.utils.string  
     
    11 12  
    12 13 util_doctests = (  
      14     xix.utils.config,  
    13 15     xix.utils.console,  
    14 16     xix.utils.string,  
  • branches/utils/xix/utils/config.py

    r175 r193  
    73 73     '''Config is a configuration variable holder  
    74 74     '''  
      75      
    75 76     implements(IConfig)  
      77      
    76 78     def __init__(self, lookup=None):  
    77 79         self.__dict__["_lookup"] = lookup or {}  
      80          
    78 81     def __getattr__(self, name):  
    79 82         '''  
     
    89 92         >>> print cfg.tiger, cfg.lion.pride  
    90 93         27 54  
      94  
      95         Bug Test:  
      96  
      97         >>> cfg = Config()  
      98         >>> int(cfg.__class__ == Config)  
      99         1  
    91 100          
    92 101         '''  
    93 102         if name in self.__dict__["_lookup"]:  
    94 103             return self.__dict__["_lookup"][name]  
      104         elif self.__dict__.has_key(name):  
      105             return self.__dict__[name]  
      106              
    95 107     def __setattr__(self, name, value):  
    96 108         '''  
     
    101 113         >>> print cfg.property  
    102 114         test  
      115         >>> int(hasattr(cfg, 'property'))  
      116         1  
    103 117          
    104 118         '''  
    105 119         self.__dict__["_lookup"][name] = value  
      120          
      121     def __getitem__(self, name):  
      122         """Example usage:  
      123  
      124         >>> cfg = Config()  
      125         >>> cfg.property = 'test'  
      126         >>> print cfg['property']  
      127         test  
      128         """  
      129         return getattr(self, name)  
      130  
      131     def __setitem__(self, name, value):  
      132         """Example usage:  
      133  
      134         >>> cfg = Config()  
      135         >>> cfg['property'] = 'test'  
      136         >>> print cfg.property  
      137         test  
      138         """  
      139         return setattr(self, name, value)  
    106 140  
    107 141  
  • branches/utils/xix/utils/tools/options.py

    r187 r193  
    208 208             if name == 'value':  
    209 209                 continue  
      210             if name == 'type' and hasattr(opt, 'action') \  
      211                      and opt.action in ('store_true', 'store_false'):  
      212                 continue  
    210 213             if name == 'short_desc':  
    211 214                 args[0] = value