https://bugzilla.wikimedia.org/show_bug.cgi?id=54549
--- Comment #2 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- Committed in r11359, thanks.
I do agree that token() does need a re-think, it probably should be using a straight query rather than a generator, we also should be caching tokens per login session. Gonna leave this open for now so it can be properly fixed.