JJMC89 created this task.
JJMC89 added a project: Pywikibot.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION
Steps to Reproduce:
>>> import pywikibot
>>> site = pywikibot.Site()
>>> site
APISite("test", "wikipedia")
>>> page = pywikibot.Page(site, 'Test pwb recreate') # Does not exist and
hasn't been deleted
>>> page
Page('Test pwb recreate')
>>> page.exists()
False
>>> page.text = 'Testing'
>>> page.save(recreate=False)
Actual Results:
Traceback (most recent call last):
File "/shared/pywikipedia/core/pywikibot/page/__init__.py", line 99, in
handle
func(self, *args, **kwargs)
File "/shared/pywikipedia/core/pywikibot/page/__init__.py", line 1315, in
_save
watch=watch, bot=botflag, **kwargs)
File "/shared/pywikipedia/core/pywikibot/site/_decorators.py", line 94,
in callee
return fn(self, *args, **kwargs)
File "/shared/pywikipedia/core/pywikibot/site/__init__.py", line 5162, in
editpage
lastrev = page.latest_revision
File "/shared/pywikipedia/core/pywikibot/page/__init__.py", line 602, in
latest_revision
return next(self.revisions(content=True, total=1))
File "/shared/pywikipedia/core/pywikibot/tools/__init__.py", line 1434,
in wrapper
return obj(*__args, **__kw)
File "/shared/pywikipedia/core/pywikibot/page/__init__.py", line 1756, in
revisions
total=total)
File "/shared/pywikipedia/core/pywikibot/tools/__init__.py", line 1434,
in wrapper
return obj(*__args, **__kw)
File "/shared/pywikipedia/core/pywikibot/tools/__init__.py", line 1517,
in wrapper
return obj(*new_args, **new_kwargs)
File "/shared/pywikipedia/core/pywikibot/site/__init__.py", line 4008, in
loadrevisions
raise NoPage(page)
pywikibot.exceptions.NoPage: Page [[test:Test pwb recreate]] doesn't exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/shared/pywikipedia/core/pywikibot/tools/__init__.py", line 1434,
in wrapper
return obj(*__args, **__kw)
File "/shared/pywikipedia/core/pywikibot/tools/__init__.py", line 1434,
in wrapper
return obj(*__args, **__kw)
File "/shared/pywikipedia/core/pywikibot/page/__init__.py", line 1304, in
save
cc=apply_cosmetic_changes, quiet=quiet, **kwargs)
File "/shared/pywikipedia/core/pywikibot/page/__init__.py", line 120, in
wrapper
handle(func, self, *args, **kwargs)
File "/shared/pywikipedia/core/pywikibot/page/__init__.py", line 112, in
handle
raise pywikibot.OtherPageSaveError(self, err)
pywikibot.exceptions.OtherPageSaveError: Edit to page [[Test pwb recreate]]
failed:
Page [[test:Test pwb recreate]] doesn't exist.
Expected Results:
The page is created with the text `Testing` just like it would be if using
the API directly:
name=request
{
"action": "edit",
"format": "json",
"title": "Test API recreate",
"text": "Testing",
"token": "<token>"
}
name=response
{
"edit": {
"new": "",
"result": "Success",
"pageid": 115743,
"title": "Test API recreate",
"contentmodel": "wikitext",
"oldrevid": 0,
"newrevid": 447041,
"newtimestamp": "2020-08-31T03:35:21Z"
}
}
The current behavior with `recreate=False` is like `nocreate=True`.
name=request
{
"action": "edit",
"format": "json",
"title": "Test API nocreate",
"text": "Testing",
"nocreate": 1,
"token": "<token>"
}
name=response
{
"error": {
"code": "missingtitle",
"info": "The page you specified doesn't exist.",
"*": "See https://test.wikipedia.org/w/api.php for API usage.
Subscribe to the mediawiki-api-announce mailing list at
<https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for
notice of API deprecations and breaking changes."
},
"servedby": "mw1410"
}
----
Version: 4.2.1.dev0 (75aca06
<https://phabricator.wikimedia.org/rPWBC75aca06f1f48acdaa9ca8dc38ccc0517be31a20c>)
TASK DETAIL
https://phabricator.wikimedia.org/T261591
WORKBOARD
https://phabricator.wikimedia.org/project/board/87/
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: JJMC89
Cc: Aklapper, pywikibot-bugs-list, JJMC89, JohnsonLee01, SHEKH, Dijkstra,
Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, Mdupont, Dvorapa, Altostratus,
Avicennasis, mys_721tx, jayvdb, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs