Page MenuHomePhabricator

Create LogpagesPageGenerator page generator
Closed, ResolvedPublic

Description

The pagegenerator LogpagesPageGenerator exists in the old compat codebase, and needs to be copied and possibly re-worked to exist in the new codebase.

old code:

http://git.wikimedia.org/blob/pywikibot%2Fcompat.git/64f6f0671646506863b65826a5941066ed90f775/pagegenerators.py#L565

Event Timeline

jayvdb raised the priority of this task from to Medium.
jayvdb updated the task description. (Show Details)
jayvdb changed Security from none to None.
jayvdb subscribed.

I am porting the code over and assuming logpages() changes to logevents() [site.py]. When adapting the arguments from LogpagesPageGenerator, I assumed that number changes to total but two other arguments (namespace and repeat) seem to not fit in.

The port of the generator below this (NewpagesPageGenerator) ended up deprecating the repeat argument all together and changing namespace to namespaces and passing it to the respective recentchanges() [site.py] and then to _generator() as an argument of namespaces.

logevents() does not accept namespaces as an arguments. So, should I change logevents() to accept a namespaces argument?

As [[ https://en.wikipedia.org/w/api.php?action=help&modules=query%2Blogevents | action=query&list=logevents ]] support namespaces I'd suggest that APISite.logevents does support it too (unless there is a reason not to).

And repeat is afaik replaced by RepeatingGenerator so you could drop the parameter as well (via @deprecated_args).

(repeating and agreeing with a lot of what XZise has already said)

All great deductions. repeat was previously (compat) a capability of every generator, which is not very modular and they all only provided very basic repeat functionality; in core, we've decided that isnt desirable , so we have built RepeatingGenerator (which has many options and usage patterns) and there is another 'repeat' like capability being built.

Yes, we will need to implement a namespace argument in APISite.logevents, both for backwards compatibility and because the MediaWiki PHP API method accepts a namespace argument (singular; not plural), so we need expose that in the Python API.

https://en.wikipedia.org/w/api.php?action=paraminfo&modules=query+logevents

I recommend you initially build LogpagesPageGenerator with namespace as a parameter that is not implemented , build unit tests, etc, submit the code to be reviewed, and then add the namespace functionality after the initial code reviews.

Change 178773 had a related patch set uploaded (by Daviskr):
Add LogpagesPageGenerator

https://gerrit.wikimedia.org/r/178773

Patch-For-Review

Change 178773 merged by jenkins-bot:
Add LogeventsPageGenerator, LogpagesPageGenerator

https://gerrit.wikimedia.org/r/178773