The naming of LogEntry.title() implies that it would return a string, however it returns a Page. At this point in time, I don't see a way to get the page of a LogEntry without using this method.
Should it be renamed to page() and have a real title() that returns data["title"]?
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
[IMPROV] LogEntry: page method instead of title | pywikibot/core | master | +39 -12 |
Related Objects
Event Timeline
The problem is that script outside of our control could use title() and relies on the fact that it actually returns a Page object. But apart from that you could call event.title().title() to get its title in string form.
One long term solution would be to deprecate the title() usage and add a page() method. Then with pywikibot 3 (currently we are working towards pywikibot 2) repurpose the title() method returning a string. To aid scripts in transition we could add a parameter like title(_no_parse=False) which must be explicitly set to True and it then already returns a string. In this case emit no deprecation warning yet but as soon as title() returns a string nevertheless.
Change 218931 had a related patch set uploaded (by XZise):
[IMPROV] LogEntry: page method instead of title
I think stalled is appropriate as my patch does not solve this issue but just makes it easier in the future to resolve it properly (by returning the title string in title()).
IMO .title() needs to be deleted, as it conflicts with str.title(), and the raw values should be properties rather than callables.
Even if we delete it/replace it by a property this would be tracked by this bug. And I agree that properties sound more appropriate as afaik all parameters have no other parameters. And it seems like a reversed DotReadableDict.
It is just one of many deprecations, for things that need to be removed. We should set up a new task to define what will be deprecated, when.