Jul. 1st, 2010

karzilla: a green fist above the word SMASH! (Default)

Bug counts: resolved 199, assigned 11, needs-review 6



I hadn't been planning on doing any dev work today, but I saw bug 2749 come in and I couldn't resist. I had committed the patch that added AO3 to the list, and I had just been working on bug 733 which touched the same code in DW::External::Site, so I pounced on it.

My first thought was to explicitly disallow any site that didn't have a servicetype of "lj" since I knew we only crossposted to LJ-based sites. That's the same approach I used when dealing with detecting journaltype in 733. I knew I was making an assumption about protocols, and it nagged at me, but it produced the desired result.

However, [personal profile] alierak helped me figure out the better way to do it, which was to ask XPostProtocol for its protocol mappings. That would let me more authoritatively say "these are the sites that can crosspost." And when [personal profile] allen comes along and adds support for a different protocol, that list can update itself without any code changes.

So now in addition to the get_sites method that lists all the defined sites, we also have get_xpost_sites that only lists the sites that can crosspost. Yay!

As a bonus, I saw another optimization that could be made from XPostProtocol and copied it to Site - using LJ::ModuleLoader->autouse_subclasses instead of copying out the list of external site subclasses in the file. Again, one less thing to maintain manually.

Since this is a pretty big change to the header of the same code file I edited in 733, the patches aren't compatible. I pulled my 733 patch from the queue and will regenerate it once my new code from 2749 is approved.
Page generated Feb. 15th, 2026 12:57 am
Powered by Dreamwidth Studios