author | Rémi Cardona <remi.cardona@logilab.fr> |
Thu, 29 Jan 2015 16:40:08 +0100 | |
changeset 10167 | de62952550d9 |
permissions | -rw-r--r-- |
10167
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
1 |
# copyright 2015 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
3 |
# |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
4 |
# This file is part of CubicWeb. |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
5 |
# |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
9 |
# any later version. |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
10 |
# |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
14 |
# details. |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
15 |
# |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
18 |
|
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
19 |
from cubicweb.predicates import is_instance |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
20 |
from cubicweb.entities.adapters import ITreeAdapter |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
21 |
from cubicweb.entities import AnyEntity, fetch_config |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
22 |
|
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
23 |
|
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
24 |
class TreeNode(AnyEntity): |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
25 |
__regid__ = 'TreeNode' |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
26 |
fetch_attrs, cw_fetch_order = fetch_config(['name']) |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
27 |
|
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
28 |
|
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
29 |
class ITreeNode(ITreeAdapter): |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
30 |
__select__ = is_instance('TreeNode') |
de62952550d9
[web] Allow propagating 'klass' parameter on tree views recursively
Rémi Cardona <remi.cardona@logilab.fr>
parents:
diff
changeset
|
31 |
tree_relation = 'parent' |