Dolda2000 GitWeb
/
didex.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f9b1d04
)
Fixed storedescs to work properly on derived types.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 24 Jul 2015 13:25:01 +0000
(15:25 +0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 24 Jul 2015 13:25:01 +0000
(15:25 +0200)
didex/store.py
patch
|
blob
|
blame
|
history
diff --git
a/didex/store.py
b/didex/store.py
index
43c1348
..
55dc71e
100644
(file)
--- a/
didex/store.py
+++ b/
didex/store.py
@@
-1,4
+1,4
@@
-import threading, pickle
+import threading, pickle
, inspect
from . import db, index, cache
from .db import txnfun
from . import db, index, cache
from .db import txnfun
@@
-35,13
+35,14
@@
class storedesc(object):
def storedescs(obj):
t = type(obj)
def storedescs(obj):
t = type(obj)
- ret =
getattr(t, "__didex_attr", None
)
+ ret =
t.__dict__.get("__didex_attr"
)
if ret is None:
ret = []
if ret is None:
ret = []
- for nm, val in t.__dict__.items():
- if isinstance(val, storedesc):
- ret.append((nm, val))
- t.__didex_attr = ret
+ for st in inspect.getmro(t):
+ for nm, val in st.__dict__.items():
+ if isinstance(val, storedesc):
+ ret.append((nm, val))
+ t.__dict__["__didex_attr"] = ret
return ret
class datastore(object):
return ret
class datastore(object):