valhallasw added a comment.

I think this issue may have solved itself (sort of):

valhallasw@maeglin:pywikibot-core$ python pwb.py shell
Welcome to the Pywikibot interactive shell!
>>> from pywikibot import ItemPage
>>> from pywikibot import Site
>>> p = pywikibot.ItemPage(pywikibot.Site('test', 'wikidata'), 'Q12848')
>>> p.delete()
Deleting [[wikidata:test:Q12848]].
Please enter a reason for the deletion: test
Can't delete [[wikidata:test:Q12848]]; do you want to mark it for deletion instead? ([y]es, [N]o, [a]ll): y
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/samba/src/pywikibot-core/pywikibot/tools/__init__.py", line 1417, in wrapper
    return obj(*__args, **__kw)
  File "/home/samba/src/pywikibot-core/pywikibot/page.py", line 1839, in delete
    self.text = template + self.text
TypeError: coercing to Unicode: need string or buffer, dict found

The correct result should be a {{delete}} template added on https://test.wikidata.org/w/index.php?title=Talk:Q12848 (as it can't be added on the item page itself)

Note that trying to delete-tag a non-existing item page gives a different error:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/samba/src/pywikibot-core/pywikibot/tools/__init__.py", line 1417, in wrapper
    return obj(*__args, **__kw)
  File "/home/samba/src/pywikibot-core/pywikibot/page.py", line 1840, in delete
    return self.save(summary=reason)
  File "/home/samba/src/pywikibot-core/pywikibot/tools/__init__.py", line 1417, in wrapper
    return obj(*__args, **__kw)
  File "/home/samba/src/pywikibot-core/pywikibot/page.py", line 1208, in save
    cc=apply_cosmetic_changes, quiet=quiet, **kwargs)
  File "/home/samba/src/pywikibot-core/pywikibot/page.py", line 1234, in _save
    raise pywikibot.OtherPageSaveError(self, err)
OtherPageSaveError: Edit to page [[wikidata:test:Q1]] failed:
unknownerror: Unknown error: "wikibase-no-direct-editing" [help:See https://test.wikidata.org/w/api.php for API usage]

which should really throw a PageNotExists exception instead.


TASK DETAIL
https://phabricator.wikimedia.org/T134563

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: JameerBabu, valhallasw
Cc: dachary, TerraCodes, Aklapper, Zppix, valhallasw, pywikibot-bugs-list, MayS, Mdupont, JJMC89, MuhammadShuaib, jayvdb, Ricordisamoa, Alchimista
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to