Page MenuHomePhabricator

Missing header of original upload log table
Closed, ResolvedPublic

Description

Using imagetransfer.py to move files (to Commons) produces a malformed original upload log table - the table and column headings are missing. Check this upload. Needed fix.

Command line output:

pwb.py imagetransfer -file:transfer.txt -lang:en -tolang:commons -tofamily:commons -keepname
------------------------------------------------------------
0. Found image: [[File:Kit right arm woodlandswellington09h.png]]
==Summary==
{{Information
|Description = Woodlands Wellington 2009 home kit right arm
|Source = {{own}}
|Date = 2013-01-11
|Author = [[User:Six.stomachs|Six.stomachs]]
}}

==Licensing==
{{self|GFDL|cc-by-sa-3.0|migration=redundant}}
{{Copy to Wikimedia Commons|bot=ContinuityBot}}
============================================================
URL should be: https://upload.wikimedia.org/wikipedia/en/8/8c/Kit_right_arm_woodlandswellington09h.png
WARNING: url as string is deprecated. Use an iterable instead.
The suggested description is:
This image was copied from wikipedia:en. The original description was:

==Summary==
{{Information
|Description = Woodlands Wellington 2009 home kit right arm
|Source = {{own}}
|Date = 2013-01-11
|Author = [[User:Six.stomachs|Six.stomachs]]
}}

==Licensing==
{{self|GFDL|cc-by-sa-3.0|migration=redundant}}
{{Copy to Wikimedia Commons|bot=ContinuityBot}}

| 2013-01-11T14:52:12Z || Six.stomachs || 59x31 || 3216 || <nowiki>Uploading a self-made file using [[Wikipedia:File_Upload_Wizard|File Upload Wizard]]</nowiki>
|}
Uploading file to commons:commons via API...
Reading file https://upload.wikimedia.org/wikipedia/en/8/8c/Kit_right_arm_woodlandswellington09h.png
Upload of Kit_right_arm_woodlandswellington09h.png successful.
Adding nowCommons template to File:Kit right arm woodlandswellington09h.png
Page [[File:Kit right arm woodlandswellington09h.png]] saved

Event Timeline

XXN renamed this task from imagetransfer.py issue - missing original upload log table header to Missing header of original upload log table .Apr 8 2017, 4:19 PM
XXN added a subscriber: Xqt.

I think this is caused by the page.py's getFileVersionHistoryTable

You meant the missing

{| class="wikitable"

right?

getFileVersionHistory works for me as expected:

>>> import pwb, pywikibot as py
>>> s = py.Site('en')
>>> p = py.FilePage(s, 'File:Kit right arm woodlandswellington09h.png')
>>> h = p.getVersionHistoryTable()
>>> h
>>> print h
{| class="wikitable"
! oldid || date/time || username || edit summary
|----
| 774457452 || 2017-04-08T16:04:45Z || XXN || <nowiki>File is now available on Wikimedia Commons.</nowiki>
|----
| 554856612 || 2013-05-13T08:59:41Z || ContinuityBot || <nowiki>BOT: Flagging file as potentially eligible for [[WP:TRANSFER|transfer]] to Commons.</nowiki>
|----
| 532546644 || 2013-01-11T14:52:12Z || Six.stomachs || <nowiki>Uploading a self-made file using [[Wikipedia:File_Upload_Wizard|File Upload Wizard]]</nowiki>
|}

Could you verify.

You meant the missing

{| class="wikitable"

right?

not only this, also the column headings.

getFileVersionHistory works for me as expected:
Could you verify.

Yes; tested this snippet and seems to work.

Perhaps this conclusion was premature:

I think this is caused by the page.py's getFileVersionHistoryTable

Probably the issue is in imagetransfer.py itself as I originally reported in the task title.

In past I used this script to transfer a lot of files from one wikipedia to another and it worked just fine (example), though it was via compat (I'm missing compat :( ).

Right now I've tested everything on a fresh PWB install on labs. The error still persist. This file was transferred with the fresh PWB from labs (imagetransfer.py script), and I had to do such a fix to repair the original upload log table.

Ah, getFileVersionHistoryTable() is used here and it wents wrong.

Xqt triaged this task as High priority.Apr 9 2017, 4:05 PM

Change 347233 had a related patch set uploaded (by Xqt):
[pywikibot/core@master] [bugfix] Re-enable getFileVersionHistoryTable() method

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

I implemented a new translatable header I found by your Change.

Change 347233 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Re-enable getFileVersionHistoryTable() method

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