Commit 71493630 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

Drop "uilib" file containing monkeypatches for CubicWeb < 3.20

We require 3.23 since previous changeset.
parent a008686cb409
# -*- coding: utf-8 -*-
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact --
# This file is part of CubicWeb.
# CubicWeb is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
# You should have received a copy of the GNU Lesser General Public License
# along with CubicWeb. If not, see <>.
"""user interface libraries
Contains some helpers designed to help implementation of cubicweb user
This is a CW monkey patch and should disappear as soon as is closed.
__docformat__ = "restructuredtext en"
from cubicweb.utils import js_dumps, JSString
class _JSId(object):
def __init__(self, id, parent=None): = id
self.parent = parent
def __unicode__(self):
if self.parent:
return u'%s.%s' % (self.parent,
return unicode(
def __str__(self):
return unicode(self).encode('utf8')
def __getattr__(self, attr):
return _JSId(attr, self)
def __call__(self, *args):
return _JSCallArgs(args, self)
class _JSCallArgs(_JSId):
def __init__(self, args, parent=None):
assert isinstance(args, tuple)
self.args = args
self.parent = parent
def __unicode__(self):
args = []
for arg in self.args:
if isinstance(arg, JSString):
if self.parent:
return u'%s(%s)' % (self.parent, ','.join(args))
return ','.join(args)
class _JS(object):
def __getattr__(self, attr):
return _JSId(attr)
js = _JS()
js.__doc__ = """\
magic object to return strings suitable to call some javascript function with
the given arguments (which should be correctly typed).
>>> str(js.pouet(1, "2"))
>>> str(, "2"))
>>> str(, "2").pouet(None))
>>> str(, JSString("$")).pouet(None))
>>>{'hop': JSString('$.hop'), 'bar': None})
'cw.pouet({bar: null, hop: $.hop})'
......@@ -19,10 +19,9 @@
from cubicweb import tags
from cubicweb.dataimport import ucsvreader
from cubicweb.uilib import js
from cubicweb.web.formwidgets import FieldWidget
from cubes.slickgrid.uilib import js
class EditableSlickGridWidget(FieldWidget):
......@@ -19,8 +19,8 @@
from cubicweb.web.views import tableview
from cubicweb.uilib import js
from cubicweb.utils import UStringIO, JSString
from cubes.slickgrid.uilib import js
class RsetGridColRenderer(tableview.RsetTableColRenderer):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment