Last modified: 2014-08-11 07:29:23 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 T63832, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 61832 - User name normalization does not take underscores into account
User name normalization does not take underscores into account
Status: PATCH_TO_REVIEW
Product: Pywikibot
Classification: Unclassified
login.py (Other open bugs)
core-(2.0)
All All
: Unprioritized normal
: ---
Assigned To: Pywikipedia bugs
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-23 19:53 UTC by Purodha Blissenbach
Modified: 2014-08-11 07:29 UTC (History)
5 users (show)

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


Attachments

Description Purodha Blissenbach 2014-02-23 19:53:51 UTC
After a fresh checkout from git,
python pwb.py login -family:i18n -lang:i18n
asks for a password, says the bot was logged in,
but subsequent actions ask for a passwort again.

The files mentioned in the documentation are not
created. There is a file pywikibot.lwp that has
the cookies related to the wiki.


purodha@tools-dev:~/pywikibot$ python pwb.py version
Pywikibot: [ssh] pywikibot-core.git (e553f36, g2767, 2014/02/23, 15:09:44, ok)
Release version: 2.0b1
Python: 2.7.3 (default, Sep 26 2013, 20:03:06)
[GCC 4.6.3]
unicode test: ok
purodha@tools-dev:~/pywikibot$ python pwb.py login -family:i18n -lang:i18n
Password for user Purbo_T on i18n:i18n (no characters will be shown):
Logging in to i18n:i18n as Purbo_T
Logged in on i18n:i18n as Purbo T.
purodha@tools-dev:~/pywikibot$ python pwb.py pagefromfile -file:/tmp/purodha-pagefromfile-test -appendbottom -nocontent:/try
Reading '/tmp/purodha-pagefromfile-test'...
>>> User:Purodha/try <<<
Password for user Purbo_T on i18n:i18n (no characters will be shown):
Comment 1 Merlijn van Deen (test) 2014-02-23 20:17:52 UTC
Could you post your user-config.py?
Comment 2 Purodha Blissenbach 2014-02-23 21:33:47 UTC
Thanks for the hint. Here's the problem:

user-config.py:
usernames['i18n']['i18n'] = u'Purbo_T'

pywikibot.lwp:
Set-Cookie3: translatewiki_net_bw_UserName="Purbo+T"; path="/"; domain="translatewiki.net"; path_spec; expires="2014-08-22 21:18:35Z"; httponly=None; version=0

The equivalence of " ", "_", "+" inside the user name in various contexts
is not properly taken unto account.

Altering user-config.py to:
usernames['i18n']['i18n'] = u'Purbo T'

finds the user logged in.
Comment 3 Merlijn van Deen (test) 2014-02-23 21:56:06 UTC
It's just the _ in the user name -- we determine user names like this:

       if not self.nocapitalize:                                                                                                                                                                                          if user:
                user = user[0].upper() + user[1:]                                                                                                                                                                          if sysop:
                sysop = sysop[0].upper() + sysop[1:]    

(site.py)

and compare that to what the API returns (which is a capitalized-or-not name with spaces, not underscores).

The better solution would be to either
a) normalize the username (with a Page object -- which I guess is OK because Page objects are used more often in Site)
or
b) comparing the usernames with site.sametitle (which currently does not take underscores into account, but should)

Marking as 'easy' for anyone willing to pick up option a)
Comment 4 Gerrit Notification Bot 2014-03-09 16:48:49 UTC
Change 117689 had a related patch set uploaded by Purodha:
Bug: 61832 - fixed.

https://gerrit.wikimedia.org/r/117689
Comment 5 Gerrit Notification Bot 2014-03-20 21:47:26 UTC
Change 119882 had a related patch set uploaded by Tim Landscheidt:
become: Add --help option

https://gerrit.wikimedia.org/r/119882
Comment 6 Tim Landscheidt 2014-03-20 21:51:49 UTC
Sorry, comment #5 was a typo of mine.
Comment 7 Ricordisamoa 2014-08-06 01:18:38 UTC
https://gerrit.wikimedia.org/r/117689 merged.
Comment 8 Gerrit Notification Bot 2014-08-11 07:29:20 UTC
Change 150872 had a related patch set uploaded by John Vandenberg:
WIP: Introduce static method Link.normalize(title)

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

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


Navigation
Links