Changeset 3205
- Timestamp:
- 07/23/08 16:43:01 (5 years ago)
- Files:
-
- 1 modified
-
branch/PacketManipulator/Backend/__init__.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branch/PacketManipulator/Backend/__init__.py
r3198 r3205 2 2 3 3 from umpa import protocols 4 from umpa.protocols. baseimport Protocol4 from umpa.protocols._ import Protocol 5 5 6 6 # Globals UMPA protocols … … 16 16 def load_gprotocols(): 17 17 path = protocols.__path__[0] 18 glob = [] 18 19 19 20 for fname in os.listdir(path): 20 if not fname.lower().endswith(".py") :21 if not fname.lower().endswith(".py") or fname[0] == "_": 21 22 continue 22 23 23 24 try: 24 25 # We'll try to load this 25 module = __import__("%s.%s" % (protocols.__name__, 26 fname.replace(".py", ""))) 26 module = __import__( 27 "%s.%s" % (protocols.__name__, fname.replace(".py", "")), 28 fromlist=[protocols] 29 ) 30 31 glob.extend( 32 filter(lambda x: not isinstance(x, Protocol), module.protocols) 33 ) 34 27 35 except Exception, err: 28 36 print "Ignoring exception", err 29 37 30 # This is a dirty hack becouse we could have multiple 31 # objects that derives protocols but aren't protocols 32 # like private classes. 33 return Protocol.__subclasses__() 38 return glob 34 39 35 40 def get_protocols(): … … 71 76 return field.__doc__ 72 77 78 def get_flag_keys(flag_inst): 79 for key in flag_inst._ordered_fields: 80 yield key 81 73 82 gprotos = load_gprotocols()
