 Hello everybody, I'm Pablo. This is my fourth talk at the Montreal Python If you want to know what I do for a living You can look at my previous talk that is on YouTube and Poor Google puts up titles on it and they're really really funny. Don't miss it Okay, so this is not about what I do for work This is what I do for fun and involves Python and it's a project called Poison Magic that is Allows you to Do the following thing let's say I'm playing a game and I have a Person playing that goes by Montreal Python and I send this person an email and Then this person will receive the email from the director of the game the game master So it will come from GM at Poison Magic and then when the person replies It will arrive to the other email account as coming from Poison Magic Montreal Python at Poison Magic.net. So this is what the system does and other things but More or less does it and I'll show you how does it's done using a very very very interesting framework and Another of the things I'm going to try in this talk is to have the slides in French and Give the most important part of the talk that is the introduction to Lambson in French with slides in English Trying to convince people to do this type of I mean many I have seen many talks in French with slides in English And I think it will be nice if we can have the opposite Okay, so that's being done in Python that way you instead of writing some strange Mail Dot mail forward those very very arcane things you just write routes like if it were saying system in Django or similar and then you have states and Your state received the message and you can get things from the message like the address And you can create new messages and you can send them through So that logic checks whether the person who is is this the email that received the game master that is kind of like a catch all For and then you check whether the sender is a person you actually know about and then you see which campaign This person is playing then you see Whether the GM is bouncing or not and if the person is not the GM himself or herself Then you relay the message after changing the address. So If you ever done any email development with something not so nice, this is like heaven Okay, so this is for playing role-playing games in general role-playing games for adults particularly around my age. It's kind of like a third Third rail, you know that expression means something with 700 volts that you touch because it gives you idea that you don't do anything productive your life Just playing these games they take a lot of time to play but they are very fun And it's all about collaborative storytelling. You build a narrative with your friends. There is no winner or loser Particularly the one I like is called it call of Cthulhu and it's a horror game where there is full of very Terrible creatures that come from the sea and they have a lot of magical powers and you see where the name comes for the software and One of the most important parts is that you have people who play the game and then other Characters that are managed by the game master. Those are the non-player characters Most of the non-player characters are crazy and will kill you So not knowing which one of the people you are emailing with are player characters And which one are not player characters is a key part of the fun of the game So last time this is a second time and trying to direct Call of Cthulhu by email the previous time I tried to do it keep track of the game with a mind map software caddy cert This is how it was looking at one-third of the game Each of these boxes is an email This was over a year of time of course, but So Alors we're going to talk a little bit about Lambsong the logiciel for the courier with a paradigm model view and controller. Yes, it's a project of Zedzo and Zedzo This thing is very well known in the Python community because he wrote the books Learning Python the hard way We The project link is Lambsongproject.org. He wrote this system for his project List of distribution, LibreList.com, which I'm going to talk about a little bit later The idea is to have a modern system and also with the controller based on the idea of Automat finish. Okay, so how can you use Lambsong very quickly? You make an easy install Lambsong and then you have a Lambsong command that is very similar to the Django command Yes, so you can generate a new project and with the new project You can start Lambsong and you will see directly a program that is close to the 25th and Reception of couriers and also a setting for mood, the program can read the couriers, which is already configured to send the couriers and work with this server It's like that, you can send the courier, you can see the different rules as it executes during the courier that you write It's the concept for Lambsong, of course, the idea of ​​the controller That is Very well understood for us that does web development It's the separation of the presentation that for Lambsong is templates Ninja 2 templates The controller and the models, the data, it's also Lambsong uses the finished automata To make all the couriers, all the actions that we need to Reponder a courier with specific commands like that for my project, I use it a lot now, but it may not be possible An important concept for Lambsong is the idea of ​​a relay, which is the final server that will Take the couriers to send them, it's the example that I presented at the beginning Often of all the methods are to send the couriers with the relay And then conceptually Lambsong is not a courier receiver, with the idea of ​​a web system, it's a proxy It is in front of a normal server, it costs 25 and then you send the couriers with the relay And it also uses the mail-to-report That is a format to introduce for postfix, to have a message package With each message it is a separate file for a special repertoire So normally the Lambsong projects have a particular repertoire structure We have an app repertoire with handlers, models and also templates A configuration repertoire and test And for me there is a bit of Django Flavor The free-list projects have been included during the Lambsong distribution All the projects that we could study to learn how to use it The idea of ​​the projects is to have a courier distribution list without someone who does the maintenance Yes, if you have the opportunity to have a courier distribution list You send a courier there and the system immediately will reply to you Well, there is no such list, but because you want to create a list like that And you say yes and that's all, there is a list It's really simple, it's really a bit And the same way if you send a courier to a list and you are not subscribed He will tell you that you are not subscribed because you want to subscribe He will say yes and then you send your courier And there is also an interface web, there is access to all the history of the system And this is the repertoire structure of the project So there are Alejandro models, templates And there is also a web app that is a normal Django repertoire And to make Django work with Lambsong There is simply a need to change the module settings And then it works without problems Ok, the most important thing of Lambsong is the idea of the controllers with the finished automata Here it is a route that is not trivial It is the idea of saying when a courier arrives that starts with a roll And then there is HHID, which is this regular expression We will receive HHID and host as parameters to the start function with the message And then we can do the other things But there is a empty return, that is to say I continue during the same stage But I can return another function and have for example Ok, I think this courier needs to be confirmed It is a different stage that will be put in the database Ok, for one thing that uses the courier and a port 25 The installation is really complicated This is of course during the documentation of Lambsong There are three different pages of how to install it The most interesting thing is that for the installation that I made of magic fish It is not during the trope Yes, the things that I use are a virtual machine That rolls during a machine with Debian Linux I use Exim 4 That is why one of the most interesting things is that You can use this thing called Habit Hosts And say the ports where the system is listening But there must be a double, double point And things like that, it's a lot of time for me to find Ok, so we have the main processes that are listening to port 25 We can also have a lot of other processes that are not listening for nothing But that are monitoring a particular repertoire with a queue The queues are a format to mail The processes are revealed after each second And make a process of all the new couriers The most interesting thing is that the controllers are in the same format Than with the processors But there is a little difference with the state idea during this controller If you want to do something with couriers And you don't want to use the Amazon The code to make the process of a new code Is of course the most interesting thing to fly from the project It is also the most complicated code during the whole code base Why is that? Because there are a lot of courier clients That create bad couriers Not conforming So they need to use these different heuristics To try to guess what the encoding is Unfortunately, I didn't understand how it works Because it seems that the byte strings encoded in the interface I come from Java For me, the character chain of byte strings is a little complicated But I think that if everyone thinks the same way That's the reason that Python did that Or it improved a lot There are two very important things I think for the community that I didn't use for magic The first is double optime The ability to implement it during the Amazon It will be very important for the next year With the new regulation for the couriers I don't know if there are any people who don't know And also the HTML template It seems that you can't have the external styles During the couriers And the template system used by the Amazon To take an external style And change all the HTML elements with the styles But the same way that Z doesn't have a lot of love For the couriers and HTML I don't think so because it's a good idea Ok, so very quickly to finish A little bit more about Poisson magic So it is two processes, yes One just gets the emails Very quickly it checks whether you are a person Who should be sending emails And then send it to a queue And then there is another process that takes from that queue And that's the heavy lifting of putting it in a database And the idea is that there is a website That has the part where I am more behind Where you can review the emails And do things about it And I'm building it in Django and Bootstrap And from the point of view of the database You have this difference between humans That have an external email address And characters that have an internal email address And humans can control characters If you are playing the game Then you can only control one character And if you are the game master You can control a bunch When a new email arrives Then you check whether you know the person And you check whether the person can send emails And most important part is that If a player character is sending If a person is sending an email to another Instead of the game master That's helpful review And just something that is working And it's nice and I want to share with you To roll dice that is part of the game We don't roll it on site Because that will give me an opportunity to cheat Which is beautiful But some of my players are also good Python developers And they won't trust me So we use another website called SecureDice And what the interface does Is I can write this type of thing And say well I'm going to send this to this player character And they have to roll two dice With six sides And this is the reason And then it produces a nice URL That when they click here They get redirected to this other URL Then they click on that button And they will receive an email with the result And the system will receive an email with the results And put it on the database And you see you get a custom rolling dice Email for each roll So I'm currently playing This is some of my players And I cannot tell you how many players I have Because they don't know either But I can tell you that I have a bunch of players That actually don't even know they are playing together I have some players I have never met myself That were referred from other friends So it's a pretty fun game And it's in a submarine So these guys are going into a game Full of sea monsters And getting into a submarine I really admire how brave they are So to conclude So I really like this Lamsom framework so far Please give it a try In your next project if it involves emails This project, the Paso Magic Is a work in progress If you are interested in collaborating All the code is in GitHub When the project is more finished Than I can invite other people to use the server Most probably I'll give you a talk On the Montreal Game Society And the last thing I want to mention Is I'm participating this year again On this challenge 24 pull request If you haven't heard about it It's a lot of fun You have to do one pull request Every day between December 1st And December 24th And it's very intense If you have any project that can take A small contribution, let me know But it has to be on GitHub That's the only thing And also if you don't want to participate You can just go to the site And submit your projects as people Because most of the projects are in Ruby So more Python projects will be nice too Okay, thank you