We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

GNU Mailman 3 and Django

00:00

Formal Metadata

Title
GNU Mailman 3 and Django
Title of Series
Part Number
13
Number of Parts
44
Author
Contributors
License
CC Attribution - ShareAlike 4.0 International:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
GNU Mailman, the popular mailing list manager has undergone a major redesign. One of the changes is the separation of the web user interfaces from the core engine and the use of Django for list management and archiving. This talk shows how these interfaces use Mailman's internal APIs, how they can be integrated into existing Django projects and how they can be customized and extended.
Arithmetic meanStatisticsScaling (geometry)Message passingFile archiverMoment (mathematics)User interfaceState of matterClient (computing)Computer architectureSet theoryBitProjective planeSource codeObject (grammar)Web 2.0Cartesian coordinate systemEmailStudent's t-testLength2 (number)Revision controlGenderMathematicsForm (programming)WordNumerical analysisInformationMusical ensembleMereologyGoogolData compressionComputer programmingPattern languageMassDataflowMixture modelElectronic mailing listDigitizingPosterior probabilityMobile appFamilyRepresentational state transferCore dumpData managementKeyboard shortcutUser interfaceLibrary (computing)Connectivity (graph theory)Graph (mathematics)Subject indexingWeb-DesignerExtension (kinesiology)SoftwareMultiplication signView (database)TouchscreenWeb pageSoftware developerPay televisionHypermediaHome page3 (number)HypercubeThread (computing)Front and back endsOpen sourceFormal languageLocal ringModule (mathematics)Computer animation
Web pageSet theoryView (database)Functional (mathematics)Client (computing)Context awarenessPay televisionForm (programming)CASE <Informatik>Descriptive statisticsMereologyFlow separationCategory of beingInstance (computer science)Object (grammar)Metropolitan area networkImaginary numberSocial classMessage passingElectronic mailing listInternet forumComputer fileIntegerMultiplication signMathematicsInstallation artSource codeHypercubeDomain nameVirtual machineWebsiteWaveStatement (computer science)Web 2.0Server (computing)Projective planePulse (signal processing)Business objectPosterior probabilityDifferent (Kate Ryan album)System callSpacetimePhysical systemHookingLocal ringPasswordDefault (computer science)Tablet computerNumerical analysisSoftware developerDemo (music)Cartesian coordinate systemGraphics tabletKeyboard shortcutOffice suiteLibrary (computing)Color confinementUniform resource locatorConfiguration spaceData managementMobile appRepresentational state transferGoogolSingle-precision floating-point formatNamespaceIncidence algebraLevel (video gaming)INTEGRALAddress spaceEmailComputer animation
Sheaf (mathematics)File archiverSocial classCategory of beingEmailSystem administratorElectronic mailing listOrder (biology)Power (physics)Message passingUser interfaceUser interfaceSummierbarkeitImplementationConfiguration spaceCovering spaceSoftware testingWikiDifferent (Kate Ryan album)Computer programmingStaff (military)InformationGenderDatabaseSet theoryTheoryUtility softwareIntegrated development environmentFunctional (mathematics)Software developerWeb pageVariable (mathematics)Centralizer and normalizerComputer fileGroup actionProjective planeWave packetMultiplication signError messageLine (geometry)Instance (computer science)Object (grammar)Complete metric spaceString (computer science)Source codeBuildingView (database)Module (mathematics)Context awarenessEndliche ModelltheorieRepresentation (politics)Open sourceoutputMeasurementRaw image formatCore dumpSinc functionRevision controlTraffic reportingData compressionFreewareLatent heatMobile appUniform resource locatorSelf-organizationWeb 2.0Computer animation
Computer animation
Transcript: English(auto-generated)
Thanks Okay, let's start. My name is Florian Fuchs and this talk is about Maimon 3 and Django I don't know if you have noticed that Maimon is you know only you know minutes or seconds just a few moments before a new version change to version 3
So this talk is specifically about Maimon 3 Some quick words about me. I I do a lot of work with Python and Django and but also quite a bit of work with front-end technologies I also do some open source work. I'm on the Maimon 3 dev team
which I joined a couple of years ago and As he said I mostly work on things that have to do with the web UI for the list management and the REST API Okay So what is this talk about? Well Maimon 3 has
two new web UIs for list management and archiving. List management meaning creating lists, subscribing people to them Archiving meaning making messages that get through sent through the system searchable and browsable and We decided to use Django for both of them
So I'd like to show you how you can use And how you can use and integrate on those Django apps that we have built and How you can use Maimon 3's internal API is to write to write your own Maimon related applications and Django So quick warning this Maimon 3 is still in beta state
But as I said, we're not not far away from a full release Okay Quick overview over the architecture of Maimon 3 from the view of a web developer Well, I have to tell when I joined the Maimon team a couple of years ago I'm to start working on a web interface from for version 3 um, the development of version 3 was already well in a way so most of the code was there and
When I started I had absolutely no idea what Maimon did internally And the good thing was I didn't have to know that because in Maimon 3 there are some very clearly Defined api's that you can use as a web developer to write any kind of interfaces you like
so Let's see what the actually components are. There's some modules some component that we call the Maimon core it's the actual Maimon Python package that gets imported imported when you start Maimon and
Well, it retrieves emails from list members or people sending emails to mailing lists and it distributes them to the list members Of course, it does a lot of other things internally and it's a really extensive piece of software and some But right now we don't need to know too much about what it does
Okay for list management Maimon 3 has a rest API that you can use it's JSON based and it's local. It's local API to so it's language agnostic and It's not intended to be used over a public network
But it speaks HTTP which is pretty nice And we also have some Python bindings. There's a library called Maimon client, which I will tell you something more a little later and You know, it turns all these HTTP calls to the rest API into nice Python objects that you can operate on
So This recipe I could can be used to manage lists meaning creating lists subscribing unsubscribing moderating messages changing preferences and so on the other internal API That is provided by the Maimon core is
The I archiver interface and this is a Python API It's based on soap interface. I don't know if you're familiar with soap interface or Interfaces in general and it's well, it sounds worse than it is pretty easy to use to Python the API that gives you access to every list post that leaves Maimon, so if someone sends a message to a mailing list and
The message gets through so it's not moderated. It's The person is legitimate legitimate sender to that email list This API will give you access to a copy of that email that gets sent out to all the list members
We have two Django applications that can be installed that use Maimon 3 One is called posterius. This is the app we use for list management the funny name has well, it's a mixture mixture of the fact that
Many people use jazz jazz music references for their when they name their pipe there They're Django apps also has to do with email and dead bass guitar players And What's worth noting about posters this and that it has been created in large parts by students who have been participated in the Google Summer of Code which is a
really nice program that Maimon has been participating in as a sub org of the Python software foundation and There have been a number of students during the last years who have implemented features for posterius, which is so kudos to all those students and Yeah, actually one of those students has given a DjangoCon talk at DjangoCon Europe about form sets because she used form sets Django form sets
In her posterius project. That's all if you don't know about form sets. You told you should totally check it out The other app Django application that that's there to use with Maimon is called hyper kitty and this is the new mailing list archiver
It has been created by a couple of people at fedora Who've done amazing work looks really nice has has a really nice UI Has some built-in statistics so you can see which which email lists get the most attention the threats are displayed very nicely and Also, you can post to
to mailing this directly from the archiver interface Which is great because some people just don't like to use the email clients all the time. So It's nice so Let me show you some some very random screens of The two interfaces. This is the posterius list index page Well has some I created some dummy lists today
a page to edit your subscription preferences whether you like to have To get daily delivery as a digest or immediate delivery stuff like that. So these are very random screens This is the archive index for hyper kitty
As you can see you can have nice little Graphs that show you The activity index of those lists This is a overview of all the threads of a certain list, by the way, these screens are taken from a
Demo that the fedora people have set up to test their hyper kitty development So if you want to check it out further, you have to google fedora and hyper kitty and demo So, how can you install and integrate those? applications well
There's One installer to get them all it's the maiman bundler. It lives on launchpad You can download this project and if you install it, it will download maiman posterius and hyper kitty with all their dependencies and will install it on your system and
It will make it pretty easy to hook it up to your to your local main server and to your web server This package also provides a separate Django project for which holds posterius and hyper kitty with all the settings they need So you might say well, I already have a Django site that I'm running on my server
And I don't want to put up another Django project. So could I just can I just please just integrate posterius and hyper kitty Of course you can both live on pip maiman 2 of course and You can just install them plus some settings that you have to add to your
existing settings file that Depending on whether you want to install both of them or only one of them. You can check out these two example projects To see to check on the necessary settings. Do you have to add? So other than that they're behaving just like pretty much
every other Reusable Django apps that you can just put it to your installed app setting and and you're good to go So one of the more interesting parts is how you can ride your own maiman apps, how can you actually use those? Those API's that I was talking about for list management and archiving
So say you have your existing Django site and now you have installed maiman and it's pretty running pretty smoothly and you have used posterius maybe to set up your lists and or You could use hyper kitty, but just on your on your site You want to have maybe a single view? Which you can edit yourself which holds a subscription form for a set for a certain list
How would you how would you be able to do that? Well? Maybe remember I was talking about maiman client the Python bindings library that does all the HTTP calls for you First of the first thing you have to do of course is install it. It looks Can find it up on the cheese shop as well?
and Then the next thing you do is you import the client class from the maiman client package By the way, this is not a typo it the project is called maiman doc client But the package is made is called maiman client because it doesn't sit in the maiman namespace
so I'm to create an incident of instance of that client class by giving it the Providing it with Local REST API URL and a username and the password these are the default values and you can change them and they're in your global maiman config file if you want to you should do of course
so The first thing you do when you start with the clean slate is create a domain maiman can operate a number of domains just like Many machines you know serve different Domains for for websites maiman can serve different domains as well, so you got your own domain
I call it my domain org and it will return Domain object that you can operate on further this domain object for example has a create list method And that you can use to create two lists well by the way you maybe you've noticed I've put some small
Comments below each of these statements to indicate the URLs that are actually called when you Execute those statements so once you've created your lists Those lists show up in the clients list property, and we'll yeah, so you can see what's there? If you want to operate on
on a single list You can get the list object from the clients get lists method And you can use that That list map list object to subscribe and unsubscribe people to from that list
You can also provide it with with an optional username Which maiman might or might not use when sending out messages and So and Once you have subscribed someone this person this member will show up and the and the list objects members property
so This is just a very simple example, but you know the principle is Maiman client gives you objects with methods that might return other objects that you can operate on and this is just The bone was basic use case to create lists and subscribe people to it you can also moderate messages
Change list preferences and so on so the documentation is Sits in the rest file an RST file in the maiman client package I Don't think it's on Python hosted or read the docs. I have to have to change that
So how would you use that in a in a Django view well? There are obviously many ways to do it. I chose one well example that fit on a single page It's It's a very simple class based view
it has a get method and a post method and It has a separate property method that returns the client instance, so we don't repeat ourselves Well If we take a look at the get method the first thing that happens the list object is retrieved through rest from the client
From maiman client from maiman client, and we'll yeah, then there's an imaginary subscription form which probably holds just an email address depending on what your needs are and So the list description and the form are
provided and to the to the request context so if someone actually posts Submits this subscription form The form is instantiated with the request post data
Which should be uppercase not lowercase And if the form is valid The person who submitted the form is subscribed as a list member and Then you just usually redirect to the get to wherever whatever your target pages
So as I said, this is just a very basic example. You could also use a simple view function or If you have several maiman views you might maybe put the client instantiation method which sits in the client property here in a utility function
so Yeah, this is just one example okay, now what we've done is we have Say you have installed maiman and the web uis and now you have Created your own page with your own maiman functionality when you say well, I'm still not happy
I have one list which is a little bit different than all my all the other mailing lists that I'm hosting and It's It's a private list. It shouldn't go into a public archiver and or any usual traditional archiver as well and It's say it's a support list and the list members are your the the support staff of your organization and
You want to get a copy of each Message that gets sent to the to this list and happen and processes in a different way You want to store it into your Django database to display it in Django admin or whatever?
So in order to do that you would Be able to use the I archiver interface So this is a very simple example how to use the I archiver interface. This is some as I said the Python interface
Basically what you have to do is Create a class that implements three methods methods and has one name property the first method is the list URL Method which should return a URL
Where where you list Summary pages can can be found. It's just something that maiman puts into the email header It has another method that you must implement which is the permalink method it doesn't have to It doesn't have to return anything
If you want to you can prefer you can return a separate URL for each methods that you can calculate But you can also return none But you have to still have to implement that method and the really interesting stuff sits in the archive message Method
And there you have access to maiman's internal mailing lists object the mailing list that this message is sent to and A message object which is cast to a string but also has get methods to access the message headers
The way for the maiman core to know that you have correctly implemented Your your archival class is it uses soap interface it You've probably noticed it noticed the implemented decorator on top of the class Well, it basically says maiman. Okay. This is a class that implements the I archiver interface
and Before you run it you can check if it's if everything's there that's needed So that's the one thing you have to do when creating them An Exam and I can archiver class with a custom archiver The second thing you have to do is of course you have to tell maiman about it
So there's your central maiman config file And all you have to do is add a section Which starts with the archiver and a dot and then the name of your archiver It Has a class property and this is the Python path to your archiver implementation
And then of course we have to enable it And if you want to you can add some configuration For your for your custom archiver. So if you have some extra configuration that this archiver class might use might use You can put it there
So again, how would you use that in the Django context? You might think well that sounds good I can just import my my models I have you know in this example is an imaginary my list post model model and
If you would import it at the top of the file it would raise an Improperly configured error because When when maiman imports this this this module in this class you're outside of your usual Django environment, so
There's no whiskey app instance and The settings are unknown So what you have to do is that you have to set up your Django environment by setting the Django settings model module environment variable and
Of course it shouldn't probably hard code it but So otherwise, it wouldn't have have fit onto the page if I Would have you know Wouldn't have put it like that okay, and then after you've done that you can import your your your Django model and
And save whatever information you might you might want to read from the message file again the message Property that is handed to the archive message method The it has a string representation
Which is the complete message source and you can use pythons built an email passage to iterate over each line So you get the raw email body? And the subject and the date So whatever you information you you want to to read from that you probably want to use the email package for that
Okay so As with many open source projects you're welcome to contribute We are a small group of people that are very enthusiastic but also have Like also within many other open source project not the time that we'd like to to to
To work on it Also, since we're just you know short before before new major release of Maim and version 3 It would be nice to have more bug reports. So If you got interested
Subscribe to Maim and developers at python.org which ironically runs on Maim into We're also for is an IRC channel on free node net You can check out a wiki a lot of the documentation is there And if you have specific questions for me, I'm my IRC handlers for an effort. I
I also hang out a lot on Maim and on the Maim and channel So, um, thank you very much