Page MenuHomePhabricator

Outdated document on Page.protect method
Closed, ResolvedPublic

Description

I have been trying to protect a page according to the documents available here. As there was no parameter documentations for edit, move, create and upload, I had to assume by the default values that the values are going to Boolean.
However that is not the case, the four arguments mentioned above expect a string (a valid protection level as mentioned in the documents) and therefore passing true to the arguments causes a TypeError.
Here's what I'm going to do:

  • Update the documents to involve the mentioned parameters explaining their accepted values.
  • Set default values of said arguments to None and change the process_deprecated_arg function to work with that.

I wanted to share the issue and request for comments, I also suggest adding a warning that clearly indicates deprecation of protections as this can only be found on the source code.

Event Timeline

Xqt renamed this task from Outdated document on Page.Protect to Outdated document on Page.protect method.Jul 10 2019, 5:24 AM
Xqt triaged this task as Low priority.
Xqt added a project: Pywikibot-Documentation.

@MohammadtheEditor: Hi! This task has been assigned to you a while ago. Could you maybe share an update? Do you still plan to work on this task, or do you need any help?

If this task has been resolved in the meantime: Please update the task status (via Add Action...Change Status in the dropdown menu).
If this task is not resolved and only if you do not plan to work on this task anymore: Please consider removing yourself as assignee (via Add Action...Assign / Claim in the dropdown menu): That would allow others to work on this (in theory), as others won't think that someone is already working on this. Thanks! :)

@Aklapper Hi! I'm sorry for the long delay, I had trouble setting up with the way Wikimedia works with Git and I abandoned collaboration to python projects altogether.

Apologies as I should've removed myself from the task a long time ago. if the issue still persists, I suggest someone more familiar with the project take the task, otherwise the task should be closed.

Thank you for paying attention to this task!

@Xqt I think edit, move, create and upload (and all the process_deprecated_arg) can be removed.

There is a FutureWarning since https://github.com/wikimedia/pywikibot/commit/7ddfa6576d1e0b0169f934f96ebc1b0a9b7bab4e#diff-a0fb5343bf06e967de98a05792aa046e10f446974cd02aede6d91c88bf2ffe63L1999

What do you think?

Yes but I would wait until 5.0 was released. I am waiting for T264962.

Change 634078 had a related patch set uploaded (by Mpaa; owner: Mpaa):
[pywikibot/core@master] [IMPR] remove deprecated args for Page.protect()

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

Hm, probably we should replace the warn message by a issue_deprecation_warning for each used argument first. The "protections" argument of protect() replaces "{0}" seem s not clear enough.

Change 634190 had a related patch set uploaded (by Mpaa; owner: Mpaa):
[pywikibot/core@master] [IMPR] issue deprecation warning for Page.protect()

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

Change 634190 merged by jenkins-bot:
[pywikibot/core@master] [IMPR] issue deprecation warning for Page.protect()

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

Xqt claimed this task.
Xqt reassigned this task from Xqt to Mpaa.

Change 634078 merged by jenkins-bot:
[pywikibot/core@master] [IMPR] remove deprecated args for Page.protect()

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