Page MenuHomePhabricator

Retrieve / edit the section
Open, LowPublicFeature

Description

Originally from: http://sourceforge.net/p/pywikipediabot/patches/521/
Reported by: lankier
Created on: 2011-07-15 10:11:55
Subject: Retrieve / edit the section
Original description:
This patch adds new parameter 'section' to Page.get & Page.put.
\(See also feature requests https://sourceforge.net/tracker/?func=detail&atid=603141&aid=3104703&group\_id=93107 \)

Examples:
add a new section:
page.put\('New section text', comment='New section header', section='new'\)
edit the top section:
text = page.get\(section=0\)
page.put\(text+'\n\n==New section==\nNew text', section=0\)


Version: compat-(1.0)
Severity: normal
See Also:
https://sourceforge.net/p/pywikipediabot/patches/521
T72682: Implement extracts in Pywikibot

Details

Reference
bz54569

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:12 AM
bzimport set Reference to bz54569.
bzimport added a subscriber: Unknown Object (????).

It is a useful one. Was looking for it recently.
Any plans for this?

This comment was removed by Legoktm.

Is referring to sections by ID a good idea? Isn't it worth the extra query to get the section ID first? \(by calling action=render\). We currently 'support' sections by having a Page object with title "page title\#section", and I think this is the sensible way to work with sections.

Housekeeper's note: the patch applies cleanly to r10035 \(with some fuzz\).

Great and important contribution, I support the fast acceptation\! This feature has long been missing from Pywiki.

The Page constructor already accepts a section within the title. But I think we're still lacking a good single-section-editing feature.

(In reply to Ricordisamoa from comment #6)

The Page constructor already accepts a section within the title. But I think
we're still lacking a good single-section-editing feature.

Isnt that the section _name_. This patch needs a section number. I'm guessing that we dont have any functionality to convert between the two except using textlib on the full page text, which defeats the point of the patch.

I think this would be useful (in core too), if only to get the first/top section of the page.

Have you ever thought about adding a little bit more than just your articles? ...

This is spam which has been copied. Could it be deleted please.

Aklapper triaged this task as Lowest priority.Jun 5 2015, 1:41 PM
Aklapper subscribed.

Pywikibot has two versions: Compat and Core. This task was filed about the older version, called Pywikibot-compat, which is not under active development anymore. Hence I'm lowering the priority of this task to reflect the reality. Unfortunately, the Pywikibot team does not have the manpower to retest every single bug report / feature request against the (maintained) Pywikibot code base. Furthermore, the code base of Pywikibot-Compat has changed a lot compared to the code base of Pywikibot-Core so there is a chance that the problem described in this task might not exist anymore. Please help: Unfortunately manpower is limited and does not allow testing every single reported task again. If you have time and interest in Pywikibot, please upgrade to Pywikibot-Core and add a comment to this task if the problem in this task still happens in Pywikibot-Core (or directly edit the task by removing the Pywikibot-compat project and adding the Pywikibot project to this task). To learn more about Pywikibot and to get involved in its development, please check out https://www.mediawiki.org/wiki/Manual:Pywikibot/Development Thank you for your understanding.

Also a valid enhancement for core, however I recommend adding a new method for this as opposed to implementing this in 'Page.get' , and it would need lots of unittests to ensure the section of wikitext doesnt pollute Page._revisions.

Xqt set Security to None.
Xqt subscribed.

request for compat discarded

Xqt raised the priority of this task from Lowest to Low.Mar 16 2022, 5:56 AM
Xqt changed the subtype of this task from "Task" to "Feature Request".