mirror of
https://github.com/krateng/maloja.git
synced 2025-06-15 06:42:24 +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()
|
"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):
|
def uri(self):
|
||||||
return "&".join(k + "=" + self.urikeys[k] for k in self.urikeys)
|
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
|
@ -3,6 +3,8 @@
|
|||||||
# server stuff
|
# server stuff
|
||||||
from bottle import Bottle, route, get, post, error, run, template, static_file, request, response, FormsDict, redirect, template
|
from bottle import Bottle, route, get, post, error, run, template, static_file, request, response, FormsDict, redirect, template
|
||||||
import waitress
|
import waitress
|
||||||
|
# monkey patching
|
||||||
|
import monkey
|
||||||
# rest of the project
|
# rest of the project
|
||||||
import database
|
import database
|
||||||
from utilities import *
|
from utilities import *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user