text method would be like this:
def text(self):
"""Return the current (edited) wikitext, loading it if necessary.
@return: unicode
"""
kwargs = {}
if not hasattr(self, '_text'):
kwargs['force'] = True
if not hasattr(self, '_text') or self._text is None:
try:
self._text = self.get(get_redirect=True, **kwargs)
except pywikibot.NoPage:
# TODO: what other exceptions might be returned?
self._text = u""
return self._text
On Tue, Sep 2, 2014 at 12:38 PM, John <phoenixoverride(a)gmail.com> wrote:
Not a good idea, how do you save a blank page?
On Tuesday, September 2, 2014, Sorawee Porncharoenwase <
nullzero.free(a)gmail.com> wrote:
I propose this change:
- set `page.text` to `None` to discard changes
- delete `page.text` to reload content -- equivalent to get(force=True)
- in Page.save(), if `page.text` is equal to unchanged text, 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
text.
Sorawee Porncharoenwase
_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
--
Sorawee Porncharoenwase