Page MenuHomePhabricator

category.py move ignores noinclude, includeonly
Closed, ResolvedPublic

Description

Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1232/
Reported by: djbarrett
Created on: 2010-08-26 14:05:12
Subject: category.py move ignores noinclude, includeonly
Original description:
When running "python category.py move", if the old category is enclosed in <noinclude> or <includeonly> tags, the new, replaced category is not, which is a problem. For example, this construction:

<includeonly>\[\[Category:Foo\]\]</includeonly>

when operated on by:

python category.py move -from:"Foo" -to:"Bar"

produces:

<includeonly></includeonly>
\[\[Category:Bar\]\]

which is wrong.

This bug has existed for a long time, at least a few years.

$ python version.py
Python 2.4.3 \(\#1, Sep 3 2009, 15:37:37\)
\[GCC 4.1.2 20080704 \(Red Hat 4.1.2-46\)\]
config-settings:
use\_api = True
use\_api\_login = True

$ svn info
Revision: 8319


Version: unspecified
Severity: normal
See Also:
https://sourceforge.net/p/pywikipediabot/bugs/1232

Details

Reference
bz55260

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:30 AM
bzimport set Reference to bz55260.
bzimport added a subscriber: Unknown Object (????).

This bug is destructive to wiki articles. Any chance it will be addressed soon? Thanks.

Is this related to templates? Could you give me a sample.

Yes, it's related to templates. Here is a test case.

1\. Create "Template:Pywikipedia test" containing:

Hello.<includeonly>\[\[Category:AABBCC\]\]</includeonly>

2\. Create an article "test" containing:

\{\{pywikipedia test\}\}

3\. Run:
$ python category.py move -from:"AABBCC" -to:"DD"

The output shows that Pywikipedia gets confused and can't modify the category tag inside the template:

Target page Category:DD already exists\!
Getting \[\[Category:AABBCC\]\]...
Getting 1 pages from vistawiki:en...
ERROR: \[\[Test\]\] is not in category Category:AABBCC\!
Getting \[\[Category:AABBCC\]\]...

Here is an even worse example. Just like in the previous example, create "Template:Pywikipedia test", but this time, make its contents:

Hello.<noinclude>\[\[Category:AABBCC\]\]</noinclude><includeonly>\[\[Category:EE\]\]</includeonly>

Again, make the article "Test" contain:

\{\{pywikipedia test\}\}

Now run:

$ python category.py move -from:"AABBCC" -to:"DD"

In this case, "Template:Pywikipedia test" gets modified completely wrong to become:

Hello.<noinclude></noinclude><includeonly>
</includeonly>

\[\[Category:DD\]\]

So the category tag for "EE" vanishes completely, and "DD" gets moved outside of the "noinclude" tags.

Piwikipedia's output for this command was:

$ python category.py move -from:"AABBCC" -to:"DD"
Target page Category:DD already exists\!
Getting \[\[Category:AABBCC\]\]...
Getting 1 pages from vistawiki:en...
Sleeping for 5.8 seconds, 2010-09-15 11:28:53
Updating page \[\[Template:Pywikipedia test\]\] via API
Getting \[\[Category:AABBCC\]\]...

Note: bug 3066934 may block you from testing this. r8562 introduced a fatal bug in category.py.

Bug 3066934 is no longer blocking this bug from being fixed.

Any chance this will be fixed? It causes articles to be modified in bad ways. Thanks.