https://bugzilla.wikimedia.org/show_bug.cgi?id=69664

            Bug ID: 69664
           Summary: WikibasePage.save fails on python2.6
           Product: Pywikibot
           Version: core (2.0)
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Wikidata
          Assignee: [email protected]
          Reporter: [email protected]
       Web browser: ---
   Mobile Platform: ---

Following on from bug 66120, we now get a TypeError during save (and other Page
write methods).  The test added in the last changeset is identifying the issue:

ERROR: test_page_methods (__main__.TestPageMethods)
Test ItemPage methods inherited from superclass Page.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/wikibase_tests.py", line 418, in test_page_methods
    self.assertRaises(pywikibot.PageNotSaved, self.wdp.save)
  File "/usr/local/lib/python2.6/site-packages/unittest2/case.py", line 475, in
assertRaises
    callableObj(*args, **kwargs)
  File ".../pywikibot/__init__.py", line 476, in wrapper
    return method(*__args, **__kw)
  File ".../pywikibot/page.py", line 954, in save
    if not force and not self.botMayEdit():
  File ".../pywikibot/page.py", line 883, in botMayEdit
    templates = self.templatesWithParams()
  File ".../pywikibot/__init__.py", line 476, in wrapper
    return method(*__args, **__kw)
  File ".../pywikibot/page.py", line 1257, in templatesWithParams
    templates = textlib.extract_templates_and_params(self.text)
  File ".../pywikibot/textlib.py", line 923, in extract_templates_and_params
    return extract_templates_and_params_regex(text)
  File ".../pywikibot/textlib.py", line 943, in
extract_templates_and_params_regex
    thistxt = removeDisabledParts(text)
  File ".../pywikibot/textlib.py", line 293, in removeDisabledParts
    return toRemoveR.sub('', text)
TypeError: expected string or buffer

That test hasnt caused an error for a while, but this test is against
test.wikidata.org which has had a few other bugs needing fixing, and the server
config appears to be changing frequently (getting better).

The error we see now is:

1. Page.save method calls botMayEdit
2. which calls templatesWithParams to look for {{nobots}}
3. which loads 'self.text' and
4. asks textlib.extract_templates_and_params() to extract all the templates

Page.text calls Page.get, which is supposed to return a string.

On a WikibasePage, .get returns a dict instead of a string.

-- 
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
Pywikipedia-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-bugs

Reply via email to