Last modified: 2014-11-04 23:29:12 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T73398, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 71398 - Username case changes after site.data_repository
Username case changes after site.data_repository
Status: NEW
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
All All
: Unprioritized trivial
: ---
Assigned To: Pywikipedia bugs
Depends on: 71451
Blocks: pwb20
  Show dependency treegraph
Reported: 2014-09-28 21:49 UTC by Fabian
Modified: 2014-11-04 23:29 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Fabian 2014-09-28 21:49:14 UTC
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 ''>
>>> d = s.data_repository()
>>> type(d)
<class ''>
>>> 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")}

Note You need to log in before you can comment on or make changes to this bug.