Last modified: 2013-10-25 11:54:16 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 T57260, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55260 - category.py move ignores noinclude, includeonly
category.py move ignores noinclude, includeonly
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
category.py (Other open bugs)
unspecified
All All
: Normal normal
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-05 04:53 UTC by Kunal Mehta (Legoktm)
Modified: 2013-10-25 11:54 UTC (History)
1 user (show)

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


Attachments

Description Kunal Mehta (Legoktm) 2013-10-05 04:53:01 UTC
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
Comment 1 Kunal Mehta (Legoktm) 2013-10-05 04:53:03 UTC
- **labels**:  --> category
Comment 2 Kunal Mehta (Legoktm) 2013-10-05 04:53:05 UTC
This bug is destructive to wiki articles. Any chance it will be addressed soon? Thanks.
Comment 3 Kunal Mehta (Legoktm) 2013-10-05 04:53:07 UTC
Is this related to templates? Could you give me a sample.
Comment 4 Kunal Mehta (Legoktm) 2013-10-05 04:53:08 UTC
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\]\]...
Comment 5 Kunal Mehta (Legoktm) 2013-10-05 04:53:10 UTC
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\]\]...
Comment 6 Kunal Mehta (Legoktm) 2013-10-05 04:53:12 UTC
Note: bug 3066934 may block you from testing this.  r8562 introduced a fatal bug in category.py.
Comment 7 Kunal Mehta (Legoktm) 2013-10-05 04:53:14 UTC
Bug 3066934 is no longer blocking this bug from being fixed.
Comment 8 Kunal Mehta (Legoktm) 2013-10-05 04:53:15 UTC
Any chance this will be fixed? It causes articles to be modified in bad ways. Thanks.
Comment 9 Amir Ladsgroup 2013-10-25 11:54:02 UTC
I tested it and It worked correctly http://fa.wikipedia.org/w/index.php?title=%D8%A7%D9%84%DA%AF%D9%88:Pywikibot_test&diff=11178294&oldid=11178221

It's probably fixed during these years

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


Navigation
Links