web/__init__.py
brancholdstable
changeset 6665 90f2f20367bc
parent 6106 1e6d93f70d14
child 6614 4b9a785df0f7
--- a/web/__init__.py	Tue Jul 27 12:36:03 2010 +0200
+++ b/web/__init__.py	Wed Nov 03 16:38:28 2010 +0100
@@ -17,26 +17,20 @@
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
 """CubicWeb web client core. You'll need a apache-modpython or twisted
 publisher to get a full CubicWeb web application
-
+"""
 
-"""
 __docformat__ = "restructuredtext en"
 _ = unicode
 
-import sys
-if sys.version_info < (2,6):
-    import simplejson as json
-else:
-    import json
-
-dumps = json.dumps
-
 from urllib import quote as urlquote
 
 from logilab.common.deprecation import deprecated
 
 from cubicweb.web._exceptions import *
-from cubicweb.utils import CubicWebJsonEncoder
+from cubicweb.utils import json_dumps
+from cubicweb.uilib import eid_param
+
+dumps = deprecated('[3.9] use cubicweb.utils.json_dumps instead of dumps')(json_dumps)
 
 INTERNAL_FIELD_VALUE = '__cubicweb_internal_field__'
 
@@ -51,13 +45,6 @@
     NO  = (_('no'), None)
 
 
-def eid_param(name, eid):
-    assert eid is not None
-    if eid is None:
-        eid = ''
-    return '%s:%s' % (name, eid)
-
-
 from logging import getLogger
 LOGGER = getLogger('cubicweb.web')
 
@@ -65,9 +52,6 @@
 FACETTES = set()
 
 
-def json_dumps(value):
-    return dumps(value, cls=CubicWebJsonEncoder)
-
 def jsonize(function):
     def newfunc(*args, **kwargs):
         value = function(*args, **kwargs)
@@ -77,7 +61,7 @@
             return json_dumps(repr(value))
     return newfunc
 
-@deprecated('[3.4] use req.build_ajax_replace_url() instead')
+@deprecated('[3.4] use req.ajax_replace_url() instead')
 def ajax_replace_url(nodeid, rql, vid=None, swap=False, **extraparams):
     """builds a replacePageChunk-like url
     >>> ajax_replace_url('foo', 'Person P')