Page MenuHomePhabricator

Page with empty title raises "AttributeError: 'Page' object has no attribute '_isredir'" on .get()
Closed, ResolvedPublic

Description

We thought this was fixed, but alas...

local-sn1pebot@tools-login:~/core/pywikibot$ python
Python 2.7.3 (default, Sep 26 2013, 20:03:06)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import pywikibot
site = pywikibot.getSite()
page = pywikibot.Page(site)
page.get("Cat")

Traceback (most recent call last):

File "<stdin>", line 1, in <module>
File "/data/project/sn1pebot/.local/lib/python2.7/site-packages/pywikibot/__init__.py", line 356, in wrapper
  return method(*__args, **__kw)
File "/data/project/sn1pebot/.local/lib/python2.7/site-packages/pywikibot/__init__.py", line 356, in wrapper
  return method(*__args, **__kw)
File "/data/project/sn1pebot/.local/lib/python2.7/site-packages/pywikibot/page.py", line 300, in get
  self._getInternals(sysop)
File "/data/project/sn1pebot/.local/lib/python2.7/site-packages/pywikibot/page.py", line 330, in _getInternals
  if self._isredir:

AttributeError: 'Page' object has no attribute '_isredir'


Version: core-(2.0)
Severity: enhancement

Details

Reference
bz60381

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:59 AM
bzimport set Reference to bz60381.
bzimport added a subscriber: Unknown Object (????).
Sn1per created this task.Jan 23 2014, 10:33 PM

Note that the pywikibot package is a symlink to the latest git version of core.

page = pywikibot.Page(site)

I think this should raise an exception, as it creates a Page object without title:

page

Page()

On the other hand, it's equivalent to

page = pywikibot.Page(site, '')

which should be the main page.

In any case, the correct way to do what you want is
]

page = pywikibot.Page(site, "Cat")
page.get()

Oh, wow, thanks.

My haphazard syntax has led to the discovery of a different bug!

Merged: [[gerrit:163305]]