So we’re coming up to the end of a turbulent four months. When it started out, I was building a new extension (Excel Exporter), with the primary purpose of testing out the extension support. About halfway through that, we realised there were some problems with the whole idea of the extension, and I was told to move on to something else. Next, I tested out the configurability of extensions, which as it turned out already worked. So there wasn’t much to do there. Finally, I was given webhooks.
My task: to take the old webhooks code, which was in the notifications area of Review Board, and move it into an extension. No big deal, I thought. After all, I’d already half built an extension at the start of the term. As it turns out, I didn’t understand the framework quite as well as I’d hoped. I got the code moved over fine, and was able to figure out where to put everything, so that was fine. But then there were errors, and I didn’t understand them.
The first few errors weren’t in the code, but were a result of needing to sync the database, or update the extensions branch. So there were some lessons learned there. After that, I realised my biggest mistake of all. I was treating this extension as a static thing, like the other extensions. I was acting like there was just a webhook, and users would set what url it would point to. As a result, I was never actually creating webhooks in the database, and that’s what the code depended on. So, after a lot of debugging with pdb, and a lot of help from Mike and Christian, I started actually creating webhooks, so a user could create multiple webhooks which all point to different scripts.
So now, it works! I wrote a php script that posts a message to Twitter. All it says is “Someone has posted a review or commented on a review!” but of course a user could make it say whatever they wanted. As of right now, it definitely works when a new review is posted, though I’m having some issues with comments.
There are some things that should be in the extension, that currently aren’t, due to running out of time. For one thing, webhooks should be configurable to associate with a specific repository and/or a specific group. Also, currently a webhook automatically listens to all types of events, while it would be better if the user could either select one, or select as many as they want from the list.
It’s possible that I may work on these things after the term is done. At this point it’s hard to be sure, since school has crushed my soul and I don’t even want to look at a computer for a while after exams are done. But I’m sure I’ll feel better after a couple of weeks of sleep and relaxation. In any case, before jumping back into Review Board, I’ll want to actually learn Python properly. Of course I had to learn a fair bit on the go during this course, but with a crazy schedule and just trying to keep up with everything, I never had time to do tutorials, start from the basics, as I prefer to do when learning a new language.
Hopefully I haven’t rambled on too much. It’s been a stressful term, and I’m relieved to be coming to the end. That being said, I’m glad to have the experience UCOSP has given me, and I had a lot of fun when I wasn’t panicking.
Screencast coming soon! It should be up tomorrow (Tuesday).