Page MenuHomePhabricator

core Page.interwiki() returns Links whereas compat Page.interwiki() returns Pages
Closed, DeclinedPublic

Description

core Page.interwiki() returns Links whereas compat Page.interwiki() returns Pages

The core implementation of Page.interwiki was created in 2008, with an incompatible return type to compat.

As an example of the problems this cases, the imagetransfer script -interwiki argument was ported incorrectly and nobody has noticed in over one year.

Traceback (most recent call last):
  File "pwb.py", line 222, in <module>
    run_python_file(filename, argv, argvu, file_package)
  File "pwb.py", line 81, in run_python_file
    main_mod.__dict__)
  File "./scripts/imagetransfer.py", line 353, in <module>
    main()
  File "./scripts/imagetransfer.py", line 350, in main
    bot.run()
  File "./scripts/imagetransfer.py", line 269, in run
    imagelist.append(linkedPage.imagelinks(followRedirects=True))
AttributeError: 'Link' object has no attribute 'imagelinks'
Found 1 wikipedia:mk processes running, including this one.
Dropped throttle(s).
<type 'exceptions.AttributeError'>

Note also even the basic attributes of a Link are different from Page. e.g. Link.title and Link.namespace are a property and title() and namespace() are an error, whereas Page.title and Page.namespace are a method and must be called as title() and namespace().

Event Timeline

jayvdb raised the priority of this task from to Needs Triage.
jayvdb updated the task description. (Show Details)
jayvdb added a project: Pywikibot.
jayvdb subscribed.
Xqt triaged this task as Low priority.Aug 26 2016, 7:53 AM
Xqt added a project: Pywikibot-compat-to-core.
Xqt subscribed.

Declined after this Long time