Changeset - bfe920603761
[Not reviewed]
version_5
0 1 0
Dennis Fink - 10 years ago 2015-08-30 15:15:19
dennis.fink@c3l.lu
Use Server.from_dict instead of Server.from_json
1 file changed with 1 insertions and 2 deletions:
0 comments (0 inline, 0 general)
ennstatus/api/views.py
Show inline comments
 
import ipaddress
 
import json
 

	
 
from datetime import datetime
 

	
 
from flask import (Blueprint, request, current_app, jsonify, render_template,
 
                   abort)
 

	
 
@@ -67,13 +66,13 @@ def update():
 

	
 
    data['last_updated'] = strict_rfc3339.timestamp_to_rfc3339_utcoffset(
 
        datetime.utcnow().timestamp()
 
    )
 

	
 
    try:
 
        server = Server.from_json(json.dumps(data))
 
        server = Server.from_dict(data)
 
    except Exception as e:
 
        current_app.logger.warning(' '.join([str(e), str(data)]))
 
        return str(e), 409, {'Content-Type': 'text/plain'}
 

	
 
    if server.type in ('exit', 'relay'):
 
        server.update_weights()
0 comments (0 inline, 0 general)