On Jul 20, 2012, at 02:45 PM, George Chatzisofroniou wrote:
For my metrics app (GSoC project), I'm currently using a MM3 simulator for testing purposes. Proceeding with the development, i think it's time to implement a connection with a real MM3 environment.
For the current version of the app, the only information i need is who posted what to which list on what date. So, as we have already discussed, the IArchiver should be the origin of the interface.
But i know nothing on how to implement this. How will i add my app to the active IA modules? Is there any code that extends the IArchiver and will help me understand how it works? (I guess HK extends it to inject the messages into the archiver.)
There isn't too much boilerplate you need to write in order to implement IArchiver, or any interface. You can look at the existing implementations in src/mailman/archiving/*.py for examples, but I'll briefly outline what you need here.
from zope.interface import implementer from mailman.interfaces.archiver import IArchiver
@implementer(IArchiver) class MyArchiver: """This is the docstring."""
name = 'myarchiver' @staticmethod def list_url(mlist): """See `IArchiver`.""" # do something @staticmethod def permalink(mlist, msg): """See `IArchiver`.""" # do something @staticmethod def archive_message(mlist, message): """See `IArchiver`.""" # do something
You probably only care about archive_message(). For methods list_url() and
permalink() which you don't care about, you can just
That's about it! Of course the details of archive_message() are up to you.
I was wondering what is the best way to test an IArchive implementation. Are there any built in test modes that will allow me to send sample messages? I only care about the processing of the messages through my IArchive implementation rather than actually sending them out.