On Fri, Sep 5, 2014 at 5:00 AM, John Mark Vandenberg <jayvdb(a)gmail.com>
On Wed, Sep 3, 2014 at 2:29 AM, Sorawee
I propose this change:
- set `page.text` to `None` to discard changes
Doesn't the page.text setter already do this?
Yes, it already does this. Currently, `del page.text` and `page.text =
None` do the same thing. Since I want to change the functionality of `del
page.text`, I wrote "set `page.text` to `None` to discard changes" to say
that `page.text = None` will not be changed.
`page.text` to reload content -- equivalent to get(force=True)
del page.text already removes the cached / modified page text.
so a forced reload of text is currently two lines:
new = page.text
I dont see why 'del page.text' should initiate network activity to
reload the page text.
It seems to me that we want to switch get() to text property instead. To
make text can do what get() can do, we want an ability to force reloading
page--maybe to get the latest edit of a page which is edited frequently.
Page.save(), if `page.text` is equal to unchanged text, no API call
Currently, when I want to do find & replace, I have to write
text = page.text.replace(find, replace)
if text != page.text: # avoid API call
page.text = text
In the past, we have put(), so I can just write
text = page.get().replace(find, replace)
if text != page.text:
I therefore think that the current functionality of save() is not useful
much. I think that the right code for this is
page.text = page.text.replace(find, replace)
In order to make this possible, if the text is unchanged, there should be
no API call.
- to touch a
page, use page.touch(), which will call action="edit" &
appendtext="", instead. The advantage is that there is no need to preload
We have a touch() changeset pending.
Can I submit another patchset for 144717? action="edit" &
a better way to go because we don't have to retrieve text at all.
Pywikipedia-l mailing list