Planning the future of Botwiki! - Help us bring Botwiki up to date, contribute to our strategy discussion, add bot scripts, and contribute manuals, guides, and tutorials! Almost anything related to bots, particularly those used to edit mediawiki, is welcome.
UNABLE TO EDIT? - We've experienced attacks by spambots lately and now require you to confirm your e-mail before you can edit (go to your preferences, enter an e-mail address, and request a confirmation e-mail, then go to your e-mail and click on the confirmation link). We also require new accounts to make a few edits and wait a few minutes before before you can create a page; however, if this is a problem contact us in #botwiki and we can manually confirm your account. Sorry for the inconvenience.
Rewrite/Page
There are multiple ways of handling page edits. I have several proposals:
Contents |
Old style
- preload using
page.preload(<api data>) - load using
page.text(),page.templatelinks()etc- and throwing warnings when not using preloaded data
- editing text locally
- save using
page.put(text, comment)
Advantages
- Completely thread-safe, but may give edit conflicts by the bot to itself
Disadvantages
- Lots of seperate functions that essentially do the same thing
- Duplication of functions and variables (for every templatelinks() function, there is a templatelinks variable)
Get/Setter style
- preload using
page.preload(<api data>) - using page.text, page.templatelinks, which are simple loader functions
- and throwing warnings when not using preloaded data
- editing page.text
- editing page.templatelinks would yield a ReadOnlyException or sth.
- saving using
page.save(comment), which saves page.text to the site.
Advantages
- Reduces code duplication in Page class
- Bidirectional way of using the Page variables -> better 'simulation' of the page editing window
- Multiple edits can be done by seperate functions without first writing to the site; e.g.:
page.preload(...)
replace_wikilinks(page)
do_other_replacements(page)
page.save('replaced wikilinks and other replacements')
- would give one edit, while the current system would either yield two edits or the first edit function would be ignored (unless you throw around the text instead of the page object)
- No duplicate variables/functions
Disadvantages
- Less thread safe (i.e. two functions editing the same Page object *at the same time* in two different threads)
- this issue could be addressed by adding an explict mutex/lock to the Page object
Comments
- Neither one of these proposals is compatible with the existing Pywikipediabot API; my preference is to minimize the work that bot authors/operators have to do to convert existing scripts to the rewrite. However, I would prefer the getter/setter style be used in the "back-end" for the reasons suggested by Valhallasw above. Russ Blau