binbot created this task.
binbot added a project: Pywikibot.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION
I file here two bugs because they are closely connected. The whole process of
handling the data should be revised. Involved methods are at lest (others may
be):
get()
save()
exists()
has_content()
`delete()` seems to work well.
**Steps to replicate the issue**:
>>> page = pywikibot.Page(site, 'Teszt') # It does not exist at his point
>>> # Now I create [[Teszt]]
...
>>> page.get()
'Teszt'
>>> page.text
'Teszt'
>>> # Now I delete [[Teszt]]
...
>>> page.get()
'Teszt'
>>> page.text
'Teszt'
>>> page.exists()
True
>>> page.get(force=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Pywikibot\pywikibot\page\_page.py", line 397, in get
self._getInternals()
File "c:\Pywikibot\pywikibot\page\_page.py", line 436, in _getInternals
self.site.loadrevisions(self, content=True)
File "c:\Pywikibot\pywikibot\site\_generators.py", line 772, in
loadrevisions
raise NoPageError(page)
pywikibot.exceptions.NoPageError: Page [[hu:Teszt]] doesn't exist.
>>> page.exists()
True
>>>
**What happens?**:
After `page.get(force=True)` the page data were not refreshed suffuciently.
`page.exists()` believes the page is still existing.
**What should have happened instead?**:
`page.get(force=True)` should refresh `self.pageid` so that `page.exists()`
will not be mislead.
I don't know hat further measures are neccessary for other methods.
Dosumentation of `page.exists()` should clearly descibe what happens and how
to force rechecking.
**Steps to replicate the issue**:
page = pywikibot.Page(site, 'Teszt')
print('Exists:', page.exists())
print('Id:', page.pageid)
page.text = 'Teszt'
page.save('Botteszt')
print('Exists:', page.exists())
print('Id:', page.pageid)
**What happens?**:
Exists: False
Id: 0
Page [[Teszt]] saved
Exists: False
Id: 0
**What should have happened instead?**:
Page.revid should have updated upon save()
**Software version** (skip for WMF-hosted wikis like Wikipedia): 8.0.0
TASK DETAIL
https://phabricator.wikimedia.org/T330980
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: binbot
Cc: Aklapper, pywikibot-bugs-list, binbot, PotsdamLamb, Jyoo1011, JohnsonLee01,
SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, Framawiki,
Mdupont, JJMC89, Dvorapa, Altostratus, Avicennasis, mys_721tx, Xqt, jayvdb,
Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]