mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
API can now properly show ranges
This commit is contained in:
parent
5c076dfe25
commit
341af94fa9
@ -78,6 +78,15 @@ class MRangeDescriptor:
|
||||
"description":self.desc()
|
||||
}
|
||||
|
||||
def __json__(self):
|
||||
return {
|
||||
"fromstring":self.fromstr(),
|
||||
"tostr":self.tostr(),
|
||||
"fromstamp":self.first_stamp(),
|
||||
"tostamp":self.last_stamp(),
|
||||
"description":self.desc()
|
||||
}
|
||||
|
||||
def uri(self):
|
||||
return "&".join(k + "=" + self.urikeys[k] for k in self.urikeys)
|
||||
|
||||
|
7
monkey.py
Normal file
7
monkey.py
Normal file
@ -0,0 +1,7 @@
|
||||
from simplejson import JSONEncoder
|
||||
|
||||
def newdefault(self,object):
|
||||
return getattr(object.__class__,"__json__", olddefault)(object)
|
||||
|
||||
olddefault = JSONEncoder.default
|
||||
JSONEncoder.default = newdefault
|
Loading…
Reference in New Issue
Block a user