Changeset 798 for vanHelsing/trunk/src/resource.py
- Timestamp:
- Oct 14, 2009, 4:03:57 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vanHelsing/trunk/src/resource.py
r775 r798 7 7 8 8 class Resource(object): 9 DIRECTIVE="" 9 10 10 def __init__(self ):11 def __init__(self, level=0): 11 12 self.items = [] 12 13 self.comments = [] 14 self._recurselevel = level 13 15 14 16 def __str__(self): 15 17 s = "\n".join(self.comments) 16 s += self. __name__+ "{\n"18 s += self.DIRECTIVE + "{\n" 17 19 for d in self.items: 18 20 s += " " + str(d) + "\n" … … 24 26 comment = "# " + comment 25 27 self.comments.append(comment) 28 29 def add_item(self, item): 30 self.items.append(item) 26 31 27 32 class Director(Resource): 33 DIRECTIVE="Director" 28 34 pass 29 35 … … 54 60 55 61 class Messages(Resource): 56 DIRECTIVE=" "62 DIRECTIVE="Messages" 57 63 58 64 class Console(Resource): 59 DIRECTIVE=" "65 DIRECTIVE="Console" 60 66 61 67 class Counter(Resource): 62 DIRECTIVE=" "68 DIRECTIVE="Counter" 63 69 64 70 class Device(Resource): 65 DIRECTIVE=" "71 DIRECTIVE="Device" 66 72 67 73 class Autochanger(Resource): 68 DIRECTIVE="" 74 DIRECTIVE="Autochanger" 75 76 __cls = locals().copy() 77 78 directives = [v.DIRECTIVE for k,v in __cls.iteritems() 79 if k != "Resource" and getattr(v, "DIRECTIVE", None)]
Note:
See TracChangeset
for help on using the changeset viewer.