alexz-enwp / wikitools

Python package for working with MediaWiki wikis
105 stars 51 forks source link

section modifications - i am not able to understand how to do it #26

Closed hyperreal-info closed 9 years ago

hyperreal-info commented 9 years ago

Hi, I have an existing page, built from several sections. I want the robot to modify only one of sections, leaving the rest intact.

Let us say the current content looks like that:

[Category:one]
== section one ==
=== para one
bla ba bla

== section two ==
blablabla

I am generating a new version of the section one in the script:

== section one ==
=== para one
bla ba bla ba bla bla

and trying to commit into mediawiki:

wikipage = page.Page(mymediawiki, title='MyPage" , section="section one")

but the result is that the new section one is removing "[Category:one]" with the new content of section one, putting it on the top of previous section one.

Where am I making a mistake in my script?

Cheers :)

alexz-enwp commented 9 years ago

This was a big that has been fixed in c6527b8f7a78a41c31dfdf9b83b68115c8370cda. It will be in the next release (which should be soon).

If you need a workaround, create the Page object without a section, then call wikipage.setSection(section="section one"), which should work correctly.