missing import tls-sprint
authorsylvain.thenault@logilab.fr
Mon, 04 May 2009 13:36:01 +0200
branchtls-sprint
changeset 1645 374586978230
parent 1644 45bec81a9e1c
child 1646 88182252fd11
missing import
web/__init__.py
--- a/web/__init__.py	Mon May 04 13:31:04 2009 +0200
+++ b/web/__init__.py	Mon May 04 13:36:01 2009 +0200
@@ -9,8 +9,11 @@
 __docformat__ = "restructuredtext en"
 _ = unicode
 
+from decimal import Decimal
+from datetime import datetime, date, timedelta
 from simplejson import dumps
 
+from cubicweb.common.uilib import urlquote
 from cubicweb.web._exceptions import *
 
 
@@ -43,16 +46,16 @@
 
 
 def json_dumps(value):
-    if isinstance(value, decimal.Decimal):
+    if isinstance(value, Decimal):
         value = float(value)
     elif isinstance(value, (date, datetime)):
         value = value.strftime('%Y-%m-%d %H:%M')
     elif isinstance(value, timedelta):
         value = (value.days * 24*60*60) + value.seconds
     try:
-        return simplejson.dumps(value)
+        return dumps(value)
     except TypeError:
-        return simplejson.dumps(repr(value))
+        return dumps(repr(value))
 
 def jsonize(function):
     def newfunc(*args, **kwargs):