In https://gerrit.wikimedia.org/r/#/c/139792
I noticed that Page.delete() and page.protect() have a lot of user interaction logic which would normally be in a script. e.g. asking a user what actions to take. Also, they set a flag in the site object. i.e. site._noDeletePrompt = True and site._noProtectPrompt = True
Is there any reason for it being in Page?
Avoiding the headache of re-inventing the wheel across dozens of scripts that use that code?
On Mon, Jun 16, 2014 at 10:19 AM, John Mark Vandenberg jayvdb@gmail.com wrote:
In https://gerrit.wikimedia.org/r/#/c/139792
I noticed that Page.delete() and page.protect() have a lot of user interaction logic which would normally be in a script. e.g. asking a user what actions to take. Also, they set a flag in the site object. i.e. site._noDeletePrompt = True and site._noProtectPrompt = True
Is there any reason for it being in Page?
-- John Vandenberg
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Then it should be in the default 'bot' class, not in the Page class.
On 16 June 2014 16:33, John phoenixoverride@gmail.com wrote:
Avoiding the headache of re-inventing the wheel across dozens of scripts that use that code?
On Mon, Jun 16, 2014 at 10:19 AM, John Mark Vandenberg jayvdb@gmail.com wrote:
In https://gerrit.wikimedia.org/r/#/c/139792
I noticed that Page.delete() and page.protect() have a lot of user interaction logic which would normally be in a script. e.g. asking a user what actions to take. Also, they set a flag in the site object. i.e. site._noDeletePrompt = True and site._noProtectPrompt = True
Is there any reason for it being in Page?
-- John Vandenberg
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
On 16 June 2014 16:33, John phoenixoverride@gmail.com wrote:
Avoiding the headache of re-inventing the wheel across dozens of scripts that use that code?
There is only one use of Page.protect() , even in compat, so IMO that code should mostly be moved from Page to scripts/protect.py.
There is also only one use of Page.delete(mark=True), so IMO that code should mostly be moved from Page to scripts/category.py.
There are many more uses of Page.delete() prompt=True, especially in compat, so I can see the need for re-use here.
On Mon, Jun 16, 2014 at 10:11 PM, Merlijn van Deen valhallasw@arctus.nl wrote:
Then it should be in the default 'bot' class, not in the Page class.
I like that approach. I'll work on it after my other Bot changeset is checked in.
https://gerrit.wikimedia.org/r/#/c/139309/
I disagree, I wrote lots of codes that deletion is a part of them (e.g. this code for deleting items in Wikidata https://www.wikidata.org/wiki/User:Ladsgroup/del.py). Maybe there is one usage of them in core but it has been widely used in customized codes.
Best
On Mon, Jun 16, 2014 at 8:17 PM, John Mark Vandenberg jayvdb@gmail.com wrote:
On 16 June 2014 16:33, John phoenixoverride@gmail.com wrote:
Avoiding the headache of re-inventing the wheel across dozens of scripts that use that code?
There is only one use of Page.protect() , even in compat, so IMO that code should mostly be moved from Page to scripts/protect.py.
There is also only one use of Page.delete(mark=True), so IMO that code should mostly be moved from Page to scripts/category.py.
There are many more uses of Page.delete() prompt=True, especially in compat, so I can see the need for re-use here.
On Mon, Jun 16, 2014 at 10:11 PM, Merlijn van Deen valhallasw@arctus.nl wrote:
Then it should be in the default 'bot' class, not in the Page class.
I like that approach. I'll work on it after my other Bot changeset is checked in.
https://gerrit.wikimedia.org/r/#/c/139309/
-- John Vandenberg
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
On Tue, Jun 17, 2014 at 4:39 PM, Amir Ladsgroup ladsgroup@gmail.com wrote:
I disagree, I wrote lots of codes that deletion is a part of them (e.g. this [https://www.wikidata.org/wiki/User:Ladsgroup/del.py] code for deleting items in Wikidata). Maybe there is one usage of them in core but it has been widely used in customized codes.
In my email .. 'only one use of' ... was referring to calling Page.delete() with mark=True, which is a code path that your code does not use, and doesnt belong in Page.
The more usual use of Page.delete() is with mark=False , and I'm sure we can find a nice solution for re-using that code. Im happy with it staying in Page even, provided it is clearly documented as a highly re-used piece of logic.
If someone else does use protect() or delete(mark=True) in custom code, it would be good to know about it.
----- Original Nachricht ---- Von: Merlijn van Deen valhallasw@arctus.nl An: Pywikibot discussion list pywikipedia-l@lists.wikimedia.org Datum: 16.06.2014 17:11 Betreff: Re: [Pywikipedia-l] Page delete and protect
Then it should be in the default 'bot' class, not in the Page class.
strong +1
xqt
On 16 June 2014 16:33, John phoenixoverride@gmail.com wrote:
Avoiding the headache of re-inventing the wheel across dozens of scripts that use that code?
On Mon, Jun 16, 2014 at 10:19 AM, John Mark Vandenberg jayvdb@gmail.com wrote:
In https://gerrit.wikimedia.org/r/#/c/139792
I noticed that Page.delete() and page.protect() have a lot of user interaction logic which would normally be in a script. e.g. asking a user what actions to take. Also, they set a flag in the site object. i.e. site._noDeletePrompt = True and site._noProtectPrompt = True
Is there any reason for it being in Page?
-- John Vandenberg
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l