Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class GeneralHolder:
- def __init__(self, node, textname):
- self.node = node
- self.textname = textname
- self.value = node.findtext(textname)
- def __eq__(self, other):
- return self.__value.upper() == other.upper()
- @property
- def value(self):
- return self.__value
- @value.setter
- def value(self, v):
- self.__value = v
- self.node.find(self.textname).text = v
- def like(self, ls):
- return ls.upper() in self.__value.upper()
- class BtHolder(GeneralHolder):
- BLOODTYPES = {"O", "A", "B", "A1", "A1B", "non-A1", "non-A1B", "AB"}
- #def __eq__(self, other):
- # return self.__value.upper() == other.upper()
- @property
- def value(self):
- return self.__value
- @value.setter
- def value(self, v):
- if v not in self.BLOODTYPES:
- raise AttributeError("bad bloodtype value: " + v + ", candidates are: " + str(sorted(self.BLOODTYPES)))
- self.__value = v
- self.node.find(self.textname).text = v
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement