author | Julien Cristau <julien.cristau@logilab.fr> |
Mon, 07 Apr 2014 18:04:56 +0200 | |
changeset 9636 | e35ae8617c03 |
parent 9257 | ce338133c92c |
child 10603 | 65ad6980976e |
permissions | -rw-r--r-- |
8190
2a3c1b787688
[vreg] move base registry implementation to logilab.common. Closes #1916014
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7990
diff
changeset
|
1 |
# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
3 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
4 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
5 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
9 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
10 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
14 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
15 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5389
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
0 | 18 |
"""CubicWeb web client core. You'll need a apache-modpython or twisted |
19 |
publisher to get a full CubicWeb web application |
|
5556
9ab2b4c74baf
[entity] introduce a new 'adapters' registry
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
20 |
""" |
0 | 21 |
|
22 |
__docformat__ = "restructuredtext en" |
|
1635
866563e2d0fc
don't depends on simplejson outside web/
sylvain.thenault@logilab.fr
parents:
1181
diff
changeset
|
23 |
_ = unicode |
0 | 24 |
|
2808
497424219fb0
fix urlquote imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2788
diff
changeset
|
25 |
from urllib import quote as urlquote |
0 | 26 |
|
2613
5e19c2bb370e
R [all] logilab.common 0.44 provides only deprecated
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
27 |
from logilab.common.deprecation import deprecated |
1801
672acc730ce5
ajax_replace_url becomes obsolete, req.build_ajax_replace_url should be used instead
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1645
diff
changeset
|
28 |
|
1635
866563e2d0fc
don't depends on simplejson outside web/
sylvain.thenault@logilab.fr
parents:
1181
diff
changeset
|
29 |
from cubicweb.web._exceptions import * |
5940
0e3ae19b181a
[uilib] refactor json_dumps code organization
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5713
diff
changeset
|
30 |
from cubicweb.utils import json_dumps |
6106
1e6d93f70d14
[selectors] fix match_transition & introduce new edited_attribute selector
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5940
diff
changeset
|
31 |
from cubicweb.uilib import eid_param |
5940
0e3ae19b181a
[uilib] refactor json_dumps code organization
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5713
diff
changeset
|
32 |
|
6614
4b9a785df0f7
[web] proper error when no json module available
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6106
diff
changeset
|
33 |
assert json_dumps is not None, 'no json module installed' |
0 | 34 |
|
35 |
INTERNAL_FIELD_VALUE = '__cubicweb_internal_field__' |
|
36 |
||
37 |
||
38 |
class stdmsgs(object): |
|
39 |
"""standard ui message (in a class for bw compat)""" |
|
3803
414bb8439002
[web ui] decorate form buttons with icons (at last)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3758
diff
changeset
|
40 |
BUTTON_OK = (_('button_ok'), 'OK_ICON') |
414bb8439002
[web ui] decorate form buttons with icons (at last)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3758
diff
changeset
|
41 |
BUTTON_APPLY = (_('button_apply'), 'APPLY_ICON') |
414bb8439002
[web ui] decorate form buttons with icons (at last)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3758
diff
changeset
|
42 |
BUTTON_CANCEL = (_('button_cancel'), 'CANCEL_ICON') |
414bb8439002
[web ui] decorate form buttons with icons (at last)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3758
diff
changeset
|
43 |
BUTTON_DELETE = (_('button_delete'), 'TRASH_ICON') |
414bb8439002
[web ui] decorate form buttons with icons (at last)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3758
diff
changeset
|
44 |
YES = (_('yes'), None) |
414bb8439002
[web ui] decorate form buttons with icons (at last)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
3758
diff
changeset
|
45 |
NO = (_('no'), None) |
0 | 46 |
|
47 |
||
48 |
from logging import getLogger |
|
49 |
LOGGER = getLogger('cubicweb.web') |
|
50 |
||
1181
620ec8e6ae19
cleanup, various fix to get something working
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
51 |
# XXX deprecated |
0 | 52 |
FACETTES = set() |
1635
866563e2d0fc
don't depends on simplejson outside web/
sylvain.thenault@logilab.fr
parents:
1181
diff
changeset
|
53 |
|
866563e2d0fc
don't depends on simplejson outside web/
sylvain.thenault@logilab.fr
parents:
1181
diff
changeset
|
54 |
|
866563e2d0fc
don't depends on simplejson outside web/
sylvain.thenault@logilab.fr
parents:
1181
diff
changeset
|
55 |
def jsonize(function): |
866563e2d0fc
don't depends on simplejson outside web/
sylvain.thenault@logilab.fr
parents:
1181
diff
changeset
|
56 |
def newfunc(*args, **kwargs): |
3758
d43c9709434d
yet another brain fart
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
3741
diff
changeset
|
57 |
value = function(*args, **kwargs) |
3741
3864c7dfddf0
use cuibicweb json encoder for json_dumps, still catch the TypeError in the request-less jsonize
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2934
diff
changeset
|
58 |
try: |
3864c7dfddf0
use cuibicweb json encoder for json_dumps, still catch the TypeError in the request-less jsonize
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2934
diff
changeset
|
59 |
return json_dumps(value) |
3864c7dfddf0
use cuibicweb json encoder for json_dumps, still catch the TypeError in the request-less jsonize
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2934
diff
changeset
|
60 |
except TypeError: |
3864c7dfddf0
use cuibicweb json encoder for json_dumps, still catch the TypeError in the request-less jsonize
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
2934
diff
changeset
|
61 |
return json_dumps(repr(value)) |
1635
866563e2d0fc
don't depends on simplejson outside web/
sylvain.thenault@logilab.fr
parents:
1181
diff
changeset
|
62 |
return newfunc |