Permalink
Browse files

Allow faster ujson library to be used (optionally) instead of json

  • Loading branch information...
1 parent 5b39db1 commit f0e88f2029da4c0f8744b529b990fb41c66aafcc @mitotic committed Sep 13, 2012
Showing with 15 additions and 4 deletions.
  1. +5 −1 graphterm/gtermserver.py
  2. +5 −1 graphterm/lineterm.py
  3. +5 −2 graphterm/packetserver.py
View
6 graphterm/gtermserver.py
@@ -11,7 +11,6 @@
import functools
import hashlib
import hmac
-import json
import logging
import os
import Queue
@@ -35,6 +34,11 @@
import random
try:
+ import ujson as json
+except ImportError:
+ import json
+
+try:
import otrace
except ImportError:
otrace = None
View
6 graphterm/lineterm.py
@@ -14,6 +14,11 @@
import array, cgi, copy, fcntl, glob, logging, mimetypes, optparse, os, pty
import re, signal, select, socket, sys, threading, time, termios, tty, struct, pwd
+try:
+ import ujson as json
+except ImportError:
+ import json
+
import random
try:
random = random.SystemRandom()
@@ -23,7 +28,6 @@
import base64
import hashlib
import hmac
-import json
import Queue
import shlex
import subprocess
View
7 graphterm/packetserver.py
@@ -21,9 +21,12 @@
import uuid
try:
- import json
+ import ujson as json
except ImportError:
- import simplejson as json
+ try:
+ import json
+ except ImportError:
+ import simplejson as json
from tornado import ioloop
from tornado import iostream

0 comments on commit f0e88f2

Please sign in to comment.