Mercurial > p > roundup > code
comparison roundup/mailgw.py @ 4469:90aae2faac72
Add parsedMessage class as class variable to MailGW to allow easier override
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Mon, 10 Jan 2011 16:04:09 +0000 |
| parents | 502a1a8620e6 |
| children | 9be284ce56b7 |
comparison
equal
deleted
inserted
replaced
| 4468:502a1a8620e6 | 4469:90aae2faac72 |
|---|---|
| 1148 return self.nodeid | 1148 return self.nodeid |
| 1149 | 1149 |
| 1150 | 1150 |
| 1151 | 1151 |
| 1152 class MailGW: | 1152 class MailGW: |
| 1153 | |
| 1154 # To override the message parsing, derive your own class from | |
| 1155 # parsedMessage and assign to parsed_message_class in a derived | |
| 1156 # class of MailGW | |
| 1157 parsed_message_class = parsedMessage | |
| 1153 | 1158 |
| 1154 def __init__(self, instance, arguments=()): | 1159 def __init__(self, instance, arguments=()): |
| 1155 self.instance = instance | 1160 self.instance = instance |
| 1156 self.arguments = arguments | 1161 self.arguments = arguments |
| 1157 self.default_class = None | 1162 self.default_class = None |
| 1444 | 1449 |
| 1445 Parse the message as per the module docstring. | 1450 Parse the message as per the module docstring. |
| 1446 The following code expects an opened database and a try/finally | 1451 The following code expects an opened database and a try/finally |
| 1447 that closes the database. | 1452 that closes the database. |
| 1448 ''' | 1453 ''' |
| 1449 parsed_message = parsedMessage(self, message) | 1454 parsed_message = self.parsed_message_class(self, message) |
| 1450 | 1455 |
| 1451 # Filter out messages to ignore | 1456 # Filter out messages to ignore |
| 1452 parsed_message.handle_ignore() | 1457 parsed_message.handle_ignore() |
| 1453 | 1458 |
| 1454 # Check for usage/help requests | 1459 # Check for usage/help requests |
