Page MenuHomePhabricator

Category name misinterpreted if it starts with an interwiki prefix
Open, HighPublic

Description

Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1507/
Reported by: @Malafaya
Created on: 2012-08-31 15:13:10

Many Wiktionaries use language code prefixes in categories. I tried executing:

$ python pwb.py category.py -lang:en -family:wiktionary -simulate -inplace move
Please enter the old name of the category: Aba nouns
Please enter the new name of the category: mk:B
SIMULATION: move action blocked.
SIMULATION: edit action blocked.
Page [[Категорија:B]] saved
Retrieving 1 pages from wiktionary:en.
ERROR: [[nie]] is not in category Category:Aba nouns!

Result: Pages will be moved from Category:A to Category:B, not Category:mk:B\! "mk:" is being considered as the wiki interlanguage prefix.

Occurred on compat:

$ pwb.py version.py
Pywikipedia trunk/pywikipedia/ (r10504, 2012/08/23, 10:22:31)
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)]
config-settings:
use_api = True
use_api_login = True
unicode test: ok

And core:

$ python pwb.py version
Pywikibot: [https] r-pywikibot-core (8ba737a, g6804, 2015/12/10, 14:27:36, OUTDATED)
Release version: 2.0b3
requests version: 2.7.0
  cacerts: /usr/lib/python2.7/site-packages/certifi/cacert.pem
    certificate test: ok
Python: 2.7.10 (default, Sep 24 2015, 17:50:09) 
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)]
...

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:24 AM
bzimport set Reference to bz55174.

I was able to reproduce the bug

Change 132781 had a related patch set uploaded by Ladsgroup:
Fix bug 55265 and bug 55174

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

one patch merged; another pending, on a different bug

@Ladsgroup: Any news (as you're set as assignee)? Still "high priority"?

one patch merged; another pending, on a different bug

That was a bit cryptic.

https://gerrit.wikimedia.org/r/132781 was for compat.
The commit message refers to T57174 and T57265

I dont recall what "another pending, on a different bug" referred to. There are definitely no related patches waiting in the compat queue.

Ladsgroup lowered the priority of this task from High to Lowest.
Ladsgroup set Security to None.

I've decided not to fix any bugs for compat. And since this is a compat bug, it should have lowest priority. I'm not sure it's fixed or not but maybe @Xqt knows

jayvdb raised the priority of this task from Lowest to High.Dec 11 2015, 9:53 PM
jayvdb updated the task description. (Show Details)
jayvdb added a project: Pywikibot.
jayvdb added a subscriber: Malafaya.

Change 395154 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [bugfix] Don't handle category prefixes as iw shortcuts

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

I think this is a more general problem of creating a Link object and their init should be rewritten:

s = py.Site('en', 'wiktionary')
p = py.Category(s, 'Wikipedia:Foo')

becomes "Category:Foo" on APISite('en', 'wikipedia') instead of "Category:Wikipedia:foo" which is weird because the site is explicitly given.

Then the whole namespace handling in pywikibot.Link should be rewritten

matej_suchanek renamed this task from Category name misinterpreted if it starts by a IL prefix to Category name misinterpreted if it starts with an interwiki prefix.Dec 6 2017, 7:37 PM
matej_suchanek updated the task description. (Show Details)
Dvorapa subscribed.

Not actively working on it