Last modified: 2014-10-29 05:55:40 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T62381, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 60381 - Page with empty title raises "AttributeError: 'Page' object has no attribute '_isredir'" on .get()
Page with empty title raises "AttributeError: 'Page' object has no attribute ...
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
core-(2.0)
All All
: Normal enhancement
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks: pwb20
  Show dependency treegraph
 
Reported: 2014-01-23 22:33 UTC by Geoffrey Mon
Modified: 2014-10-29 05:55 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Geoffrey Mon 2014-01-23 22:33:45 UTC
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'
>>>
Comment 1 Geoffrey Mon 2014-01-23 22:35:13 UTC
Note that the pywikibot package is a symlink to the latest git version of core.
Comment 2 Merlijn van Deen (test) 2014-01-23 22:42:11 UTC
>>> 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()
Comment 3 Geoffrey Mon 2014-01-23 22:50:48 UTC
Oh, wow, thanks.

My haphazard syntax has led to the discovery of a different bug!
Comment 4 Sorawee Porncharoenwase 2014-10-29 05:55:40 UTC
Merged: [[gerrit:163305]]

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links