RSS Amplifier

River Writes - A MediaWiki Blog · Feb 22, 2022

CustomLogs 1.0

0
Sign in to vote or save

River · River Writes - A MediaWiki Blog

  1. River Writes - A MediaWiki Blog
  2. 2022
  3. CustomLogs 1.0

This page looks best with JavaScript enabled

CustomLogs, my MediaWiki extension, has been given a stable release! CustomLogs lets you write and then read arbitrary log types, optionally along with some additional metadata. Last year I wrote a post detailing some use cases for this extension.

I originally published this extension in 2019, and a couple months ago I changed the format of some of the API parameter names and released it as version 1.0.0. I don’t anticipate any further breaking changes (or, indeed, any changes at all) any time soon.

Why this change?

Before this change, because you can’t have a - in a variable name in Python, I had to write code like this:

1
2
3
4
5
6
7
8
            kwargs = {
                'title': event,
                'custom-1': 1,
                'logtype': 'tournamentpurge',
                'publish': 1,
                'token': self.site.client.get_token('csrf')
            }
            self.site.client.api('customlogswrite', **kwargs)

Gross, ew.

So I got rid of the - in the custom parameter names.

1
2
            self.site.client.api('customlogswrite', title=event, custom1=1, logtype='tournamentpurge',
                                 publish=1, token=self.site.client.get_token('csrf'))

So much better.

(Of course, I should still probably make a dedicated mwcleric handler for customlogs, but that’s a separate matter.)

Share on


river

WRITTEN BY

River

River is a developer most at home in MediaWiki and known for building Leaguepedia. She likes cats.


Read the original on river.me

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.