Page MenuHomePhabricator

Username case changes after site.data_repository
Closed, ResolvedPublic

Description

When the username starts in lowercase it's stored with that lowercase in the “_sites” map. A site requested via data_repository() is stored with an uppercase starting username.

>>> import pywikibot
>>> s = pywikibot.Site('test', 'wikidata')
>>> pywikibot._sites
{'wikidata:test:xZise': Site("test", "wikidata")}
>>> type(s)
<class 'pywikibot.site.APISite'>
>>> d = s.data_repository()
>>> type(d)
<class 'pywikibot.site.DataSite'>
>>> pywikibot._sites
{'wikidata:test:xZise': Site("test", "wikidata"), 'wikidata:test:XZise': DataSite("test", "wikidata")}

This doesn't make a difference usually, because it requests via the “original” lowercased name:

>>> import pywikibot
>>> pywikibot.Site('en', 'wikipedia')
Site("en", "wikipedia")
>>> pywikibot._sites
{'wikipedia:en:xZise': Site("en", "wikipedia")}
>>> pywikibot.Site('en', 'wikipedia')
Site("en", "wikipedia")
>>> pywikibot._sites
{'wikipedia:en:xZise': Site("en", "wikipedia")}

Version: core-(2.0)
Severity: trivial

Details

Reference
bz71398
Related Gerrit Patches:
pywikibot/core : master[FIX] Normalize username

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:46 AM
bzimport set Reference to bz71398.
bzimport added a subscriber: Unknown Object (????).
XZise created this task.Sep 28 2014, 9:49 PM
jayvdb triaged this task as Low priority.Dec 6 2014, 2:43 AM
jayvdb updated the task description. (Show Details)
jayvdb removed a project: Pywikibot-General.
jayvdb set Security to None.
jayvdb removed a subscriber: Unknown Object (????).
gerritbot added a subscriber: gerritbot.

Change 190619 had a related patch set uploaded (by XZise):
[IMPROV] Deprecate nocapitalize

https://gerrit.wikimedia.org/r/190619

Patch-For-Review

Change 190672 had a related patch set uploaded (by XZise):
[FIX] Normalize username

https://gerrit.wikimedia.org/r/190672

Patch-For-Review

Change 190672 merged by jenkins-bot:
[FIX] Normalize username

https://gerrit.wikimedia.org/r/190672

Should this be closed ? As the patch has been merged ?

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 15 2016, 6:10 AM
Xqt closed this task as Resolved.Apr 5 2016, 11:21 AM
Xqt claimed this task.