Page MenuHomePhabricator

In python 3 page objects are represented by bytes instead of Unicode strings
Closed, DuplicatePublic

Description

>>> p = pwb.Page(pwb.Site('en'), 'A')
>>> p
Page(b'A')

It seems that the __repr__ function should be rewritten as

def __repr__(self):
    """Return a more complete string representation."""
    if sys.version_info[0] == 2:
        title = self.title().encode(config.console_encoding)
    else:
        title = self.title()
    return str('{0}({1})').format(self.__class__.__name__, title)

instead of

def __repr__(self):
    """Return a more complete string representation."""
    title = self.title().encode(config.console_encoding)
    return str('{0}({1})').format(self.__class__.__name__, title)

Event Timeline

Dalba raised the priority of this task from to Needs Triage.
Dalba updated the task description. (Show Details)
Dalba subscribed.
Dalba renamed this task from In python 3 page objects are represented by byte arrays instead of Unicode strings to In python 3 page objects are represented by bytes instead of Unicode strings.Apr 29 2015, 3:23 PM
Dalba set Security to None.

Hi @Dalba. Please associate at least one project with this task, otherwise nobody can find this task when searching in the corresponding project(s). Is this about Pywikibot ? Thanks!

Restricted Application added a subscriber: Unknown Object (MLST). · View Herald TranscriptApr 29 2015, 4:14 PM