Show
Ignore:
Timestamp:
07/04/08 18:45:23 (5 years ago)
Author:
getxsick
Message:

Added set_fields() method for Protocol and few utils functions

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branch/UMPA/umpa/protocols/base.py

    r3073 r3082  
    2020# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
    2121 
     22import utils 
     23 
    2224class Protocol: 
    23     pass 
     25    def set_fields(self, *args, **kwargs): 
     26        '''You can use this method to set fields of the protocol. 
     27        There are 2 ways to do that with using tuple or dict-style. 
     28        ''' 
     29 
     30        # converting args list to the dict and update our kwargs 
     31        kwargs.update(utils.dict_from_sequence(args)) 
     32 
     33        for key in kwargs: 
     34            self.fields[key].set(kwargs[key]) 
    2435 
    2536class Layer4(Protocol):