projects
/
mw
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c5075c4
)
Fixes to Metadir:pages_add_rev
author
Ian Weller
<ian@ianweller.org>
Tue, 22 Dec 2009 02:28:39 +0000
(20:28 -0600)
committer
Ian Weller
<ian@ianweller.org>
Tue, 22 Dec 2009 02:28:39 +0000
(20:28 -0600)
src/mw/metadir.py
patch
|
blob
|
history
diff --git
a/src/mw/metadir.py
b/src/mw/metadir.py
index 49a91cf588f943c719a71845f9fc97e9b81523aa..3988d78981c535f4539330a5dd80dd20e448e308 100644
(file)
--- a/
src/mw/metadir.py
+++ b/
src/mw/metadir.py
@@
-82,11
+82,13
@@
class Metadir(object):
def pages_add_rev(self, pageid, rv):
pagefile = os.path.join(self.location, 'cache', 'pages', str(pageid))
fd = file(pagefile, 'w+')
def pages_add_rev(self, pageid, rv):
pagefile = os.path.join(self.location, 'cache', 'pages', str(pageid))
fd = file(pagefile, 'w+')
- pagedata = json.loads(fd.read())
+ pagedata_raw = fd.read()
+ if pagedata_raw == '':
+ pagedata = {}
+ else:
+ pagedata = json.loads(pagedata_raw)
rvid = int(rv['revid'])
rvid = int(rv['revid'])
- if pageid not in pagedata.keys():
- pagedata[pageid] = {}
- pagedata[pageid][rvid] = {
+ pagedata[rvid] = {
'user': rv['user'], 'timestamp': rv['timestamp'],
'content': rv['*'],
}
'user': rv['user'], 'timestamp': rv['timestamp'],
'content': rv['*'],
}
Benjamin Mako Hill
||
Want to submit a patch?