minimale Änderungen

This commit is contained in:
Philipp Rauch 2014-01-30 11:36:00 +01:00
parent 51610ad421
commit bd216d5222
2 changed files with 5 additions and 3 deletions

View file

@ -34,6 +34,8 @@ class API(object):
def __init__(self):
self.app = Flask(__name__)
### Start Buffer ###
self.buf = Buffer()
### Start EMS thread ###

View file

@ -9,7 +9,7 @@ from config import Config
from datetime import datetime
from flask import abort
### jason test ###
### json test ###
from numpy import timedelta64, float64, int64
from datetime import date
from decimal import Decimal
@ -114,9 +114,9 @@ class Buffer(object):
return { l[-1] : message, 'args' : args.to_dict(flat=False)}
def value_to_json(self, value): #timedelta64, float64, int64
if isinstance(value, date) or isinstance(value, timedelta64):
if isinstance(value, (date, timedelta64)):
return str(value)
elif isinstance(value, Decimal) or isinstance(value, float64):
elif isinstance(value, (Decimal, float64)):
return float(value)
elif isinstance(value, int64):
return int(value)