Last modified: 2014-10-21 16:34:40 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 T74317, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 72317 - ItemPage.fromPage should not send page title with section
ItemPage.fromPage should not send page title with section
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
Wikidata (Other open bugs)
core-(2.0)
All All
: Unprioritized normal
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-10-21 15:09 UTC by John Mark Vandenberg
Modified: 2014-10-21 16:34 UTC (History)
1 user (show)

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


Attachments

Description John Mark Vandenberg 2014-10-21 15:09:43 UTC
Wikibase API does not handle page titles with sections.  ItemPage.fromPage currently sends them.

Compare

https://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwiki&titles=New%20York%20City

with

https://www.wikidata.org/w/api.php?action=wbgetentities&sites=enwiki&titles=New%20York%20City%23foo

ItemPage.fromPage needs to either raise an error, or strip the section from the title.
Comment 1 John Mark Vandenberg 2014-10-21 15:15:05 UTC
This is one of the problems causing an error with:

python2.7 pwb.py harvest_template.py -family:wikipedia -lang:it -page:"Stazione di Redipuglia" -template:Navbox_ferrovia "Stazione precedente" P197 "Stazione successiva" P197
...
File "scripts/harvest_template.py", line 98, in _template_link_target
    if not item or not linked_item.exists():
AttributeError: 'NoneType' object has no attribute 'exists'

The other is that 'if not item' should probably be 'if not linked_item'
Comment 2 Gerrit Notification Bot 2014-10-21 15:19:27 UTC
Change 167819 had a related patch set uploaded by John Vandenberg:
ItemPage.fromPage should strip #section

https://gerrit.wikimedia.org/r/167819
Comment 3 Gerrit Notification Bot 2014-10-21 16:31:19 UTC
Change 167819 merged by jenkins-bot:
ItemPage.fromPage should strip #section

https://gerrit.wikimedia.org/r/167819
Comment 4 Maarten Dammers 2014-10-21 16:34:26 UTC
I approved the patch set. Thanks for hunting this down and fixing it!

python2.7 pwb.py harvest_template.py -family:w"Stazione di Redipuglia" -template:Navbox_ferrovia "Stazione precedente" P197 "Stazione successiva" P197
Finding redirects...
Retrieving 1 pages from wikipedia:it.
Working on u'Stazione di Redipuglia'
Adding P197 --> [[wikidata:Q3743679]]
Adding P197 --> [[wikidata:Q3743679]]
WARNING: API warning (wbcreateclaim)of unknown format: {u'messages': [{u'html': {u'*': u'Your edit was patched into the latest version.'}, u'name': u'wikibase-conflict-patched', u'parameters': []}]} <--- That's another bug/feature ;-)

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


Navigation
Links