Commit f39fa143 by aagusti

penambahan fungsi default render json buat date

1 parent 09525b7a
......@@ -3,7 +3,7 @@ import hashlib
import hmac
import json
import sys
from datetime import datetime
from datetime import datetime, date
import requests
from pyramid_rpc.jsonrpc import JsonRpcError
......@@ -346,3 +346,9 @@ def send_rpc(auth, message):
##############################
lima_menit = 300
def json_serial(obj):
"""JSON serializer for objects not serializable by default json code"""
if isinstance(obj, (datetime, date)):
return obj.isoformat()
raise TypeError ("Type %s not serializable" % type(obj))
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!