Page MenuHomePhabricator

listify to file option in
Open, LowPublic


Originally from:
Reported by: Anonymous user
Created on: 2008-05-15 02:27:02
Subject: listify to file option in
Original description:
Please add an option to listify to file rather than a wikipedia article.

Version: unspecified
Severity: enhancement
See Also:



Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 2:19 AM
bzimport set Reference to bz55102.
bzimport added a subscriber: Unknown Object (????).

....Any updates on this? :-\)

If the only purpose is to list pages in a file, I would enhance to add this capability, rather than

@jayvdb already suggested to make CategoryListifyRobot obsolete by the listpages script. And in theory you could also pipe the result simply I guess?

Hello Mpaa,
Would it be okay, if I try to add the aforementioned capability, into It will be my first fix, (if I am able to do it).

Yepp, no need to ask for permission ...

Hello all,
I have got a class similar to CategoryListifyRobot working in when invoked with argument '-listify'. What should I do next? Please guide me.

Change 245471 had a related patch set uploaded (by Tokencolour):
Bug Fix(#T57102) - listify to file option in

Afaik this but is invalid as listpages already supports redirection?

$ python listpages -lang:test -family:test -cat:A
   1 Category page
   2 Incnis Mrsi
   3 Test sortkey
   4 Test sortkey2
   5 Test sortkey3
5 page(s) found
$ python listpages -lang:test -family:test -cat:A > list
5 page(s) found
$ cat list 
   1 Category page
   2 Incnis Mrsi
   3 Test sortkey
   4 Test sortkey2
   5 Test sortkey3

The only valid part is that listpages doesn't support everything category listify supports.

would this pattern work?
$ python listpages -listify:<path/to/directory>
I'll include subcategories and talkpages and the recurse property so that it yields almost all articles in the category as they appear when we pipe the results using CategoryListifyRobot into a webpage. Furthermore, as you suggest, I will properly integrate it with rest of the script i.e. I won't make a new class for it. I'll collect all the articles and write it into a file in the directory given in the arguments and I shall do both these things in the main function itself, but before a generator is invoked, since we won't need a generator for -listify option. Should I continue with this approach?

Isn't it already possible to also get subcategories using -subcats/-subcatsr? Now with regard to the talkpages @jayvdb afaik suggested to make the pywikibot.pagegenerators.PageWithTalkPageGenerator visible via the command line so that you can use it's generator. But I don't think that'll be useful for the formatter as the it only works on one page at a time.

So personally, adding a way to also handle the talk pages is more suitable. You just need to enhance the formatter to also provide variables for the talk page. There is Gerrit 239682 upon this could be build. Or we have a proxy class for page instances and the format gets two of those to provide a proxy for each page “variant” (non-talk page and talk page). So that instead of the entries site, title there are site, page.title and talk.title. Maybe we could coordinate and I implement the proxy class in my patch and you provide the talkpage related part (aka creating a proxy instance and providing that) in your patch.

But still I think we don't need an option to save it to disc for listpages. I can understand that it's suggested for category listify as that saves the list to the wiki, but that category listify is mostly redundant with listpages and so it was suggested to deprecate the former. But listpages prints the output to the console so you can use redirection (as I've shown above) so that doesn't need it.

Now in case others disagree and they want that option, please don't use an option like -listify because that doesn't describe what it does. Maybe something like -tofile instead (-file is already used by pagegenerators).

Thank you for your reply.
Redirection shall serve the purpose here. If others decide against it, -tofile will be a better option name.
I just wanted to confirm my part in the patch to come, i.e. you will amend the Formatter class to handle both non-talk and talk pages and I shall instantiate the newly amended class. Is this it?

Change 245471 had a related patch set uploaded (by Zoranzoki21; owner: Tokencolour):
[pywikibot/core@master] Listify to file option in