Mercurial > moin > 2.0
diff MoinMoin/items/__init__.py @ 241:f464adcc3a51
fix saving no data if no previous revision exists
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Sun, 29 May 2011 19:39:54 +0200 |
parents | 7a77ae08161e |
children | e93157b8b0bd |
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py Thu May 26 14:22:07 2011 -0700 +++ b/MoinMoin/items/__init__.py Sun May 29 19:39:54 2011 +0200 @@ -465,6 +465,7 @@ rev_no = currentrev.revno contenttype_current = currentrev.get(CONTENTTYPE) except NoSuchRevisionError: + currentrev = None rev_no = -1 contenttype_current = None new_rev_no = rev_no + 1 @@ -482,9 +483,12 @@ newrev[NAME] = name if data is None: - # we don't have (new) data, just copy the old one. - # a valid usecase of this is to just edit metadata. - data = currentrev + if currentrev is not None: + # we don't have (new) data, just copy the old one. + # a valid usecase of this is to just edit metadata. + data = currentrev + else: + data = '' size = self._write_stream(data, newrev) # XXX if meta is from old revision, and user did not give a non-empty