3 ms·
I attempted to make amends one comment below this. I will switch the library to using a decorator based approach -- it's as clean, and there's no reason for me
by BenjaminCoe 15y ago
I attempted to make amends one comment below this. I will switch the library to using a decorator based approach -- it's as clean, and there's no reason for me to break convention (I'll lash myself a few times to be safe too ;)
With regards to instance variables:
On a request, the main process forks and a new instance of the route object is instantiated. Trust me, instance variables won't leak between requests:
This is what happens when a request comes in, the parameters to process_message are described here: http://docs.python.org/library/smtpd.html http://docs.python.org/library/smtpd.html
@pytoad_decorator()
def process_message(self, peer, mailfrom, rcpttos, message_data):
for RouteClass in self.routes:
route = RouteClass(peer_ip=peer[0])
route.route(message_data)