author | Laurent Peuch <cortex@worlddomination.be> |
Thu, 19 Dec 2019 06:33:49 +0100 | |
changeset 12831 | b1ef9690f357 |
parent 12508 | a8c1ea390400 |
child 12846 | ba3cf6aaa695 |
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:
5315
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:
5315
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:
5315
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:
5315
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:
5315
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:
5315
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:
5315
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:
5315
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:
5315
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:
5315
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:
5315
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:
5315
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:
5315
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:
5315
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:
5315
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
5147
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
18 |
""" |
5306
763319a51e72
[doc/book] some fixes for vregistry, selectors & appobjects
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
5147
diff
changeset
|
19 |
|
5147
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
20 |
The `AppObject` class |
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
21 |
--------------------- |
0 | 22 |
|
5147
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
23 |
The AppObject class is the base class for all dynamically loaded objects |
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
24 |
(application objects) accessible through the vregistry. |
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
25 |
|
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
26 |
We can find a certain number of attributes and methods defined in this class and |
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
27 |
common to all the application objects. |
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
28 |
|
0 | 29 |
""" |
11767
432f87a63057
flake8 and all
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
11057
diff
changeset
|
30 |
|
0 | 31 |
|
12831
b1ef9690f357
[mypy] type __select__ everywhere
Laurent Peuch <cortex@worlddomination.be>
parents:
12508
diff
changeset
|
32 |
from typing import Union |
2657
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
33 |
from logging import getLogger |
0 | 34 |
|
2657
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
35 |
from logilab.common.logging_ext import set_log_methods |
447 | 36 |
|
12831
b1ef9690f357
[mypy] type __select__ everywhere
Laurent Peuch <cortex@worlddomination.be>
parents:
12508
diff
changeset
|
37 |
from logilab.common.registry import RegistrableObject, yes, Predicate |
2657
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
38 |
|
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
39 |
|
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
40 |
# the base class for all appobjects ############################################ |
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
41 |
|
8664
29652410c317
[appobject] introduce RegistrableObject base class (prepares #2406609)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8654
diff
changeset
|
42 |
class AppObject(RegistrableObject): |
2657
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
43 |
"""This is the base class for CubicWeb application objects which are |
8664
29652410c317
[appobject] introduce RegistrableObject base class (prepares #2406609)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
8654
diff
changeset
|
44 |
selected in a request context. |
2657
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
45 |
|
7879
9aae456abab5
[pylint] fix pylint detected errors and tweak it so that pylint -E will be much less verbose next time (+ update some copyrights on the way)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7815
diff
changeset
|
46 |
The following attributes should be set on concrete appobject classes: |
2657
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
47 |
|
2825 | 48 |
At selection time, the following attributes are set on the instance: |
49 |
||
5147
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
50 |
:attr:`_cw` |
2825 | 51 |
current request |
5147
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
52 |
:attr:`cw_extra_kwargs` |
2825 | 53 |
other received arguments |
0 | 54 |
|
5147
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
55 |
And also the following, only if `rset` is found in arguments (in which case |
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
56 |
rset/row/col will be removed from `cwextra_kwargs`): |
2825 | 57 |
|
5147
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
58 |
:attr:`cw_rset` |
2657
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
59 |
context result set or None |
5147
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
60 |
|
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
61 |
:attr:`cw_row` |
2657
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
62 |
if a result set is set and the context is about a particular cell in the |
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
63 |
result set, and not the result set as a whole, specify the row number we |
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
64 |
are interested in, else None |
5147
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
65 |
|
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
66 |
:attr:`cw_col` |
2657
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
67 |
if a result set is set and the context is about a particular cell in the |
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
68 |
result set, and not the result set as a whole, specify the col number we |
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
69 |
are interested in, else None |
5147
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
70 |
|
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
71 |
|
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
72 |
.. Note:: |
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
73 |
|
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
74 |
* do not inherit directly from this class but from a more specific class |
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
75 |
such as `AnyEntity`, `EntityView`, `AnyRsetView`, `Action`... |
70181998897f
more / cleaner / in code documentation of vreg, selectors and appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5093
diff
changeset
|
76 |
|
0 | 77 |
""" |
12831
b1ef9690f357
[mypy] type __select__ everywhere
Laurent Peuch <cortex@worlddomination.be>
parents:
12508
diff
changeset
|
78 |
__select__: Union[None, str, Predicate] = yes() |
0 | 79 |
|
80 |
@classmethod |
|
2820
66b31686d92b
rename registered to __registered__
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2819
diff
changeset
|
81 |
def __registered__(cls, registry): |
2657
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
82 |
"""called by the registry when the appobject has been registered. |
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
83 |
|
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
84 |
It must return the object that will be actually registered (this may be |
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
85 |
the right hook to create an instance for example). By default the |
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
86 |
appobject is returned without any transformation. |
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
87 |
""" |
7990
a673d1d9a738
[diet] drop pre 3.6 API compatibility (but attempt to keep data cmopatibility). Closes #2017916
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7879
diff
changeset
|
88 |
pdefs = getattr(cls, 'cw_property_defs', {}) |
2802
2251b4aee54a
should still call .items
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2799
diff
changeset
|
89 |
for propid, pdef in pdefs.items(): |
2799
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
90 |
pdef = pdef.copy() # may be shared |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
91 |
pdef['default'] = getattr(cls, propid, pdef['default']) |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
92 |
pdef['sitewide'] = getattr(cls, 'site_wide', pdef.get('sitewide')) |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
93 |
registry.vreg.register_property(cls._cwpropkey(propid), **pdef) |
4716
55b6a3262071
fix some pylint detected errors
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4568
diff
changeset
|
94 |
assert callable(cls.__select__), cls |
0 | 95 |
return cls |
1524 | 96 |
|
2822
f26578339214
deprecate appobject.vreg and rename appobject instance attributes using cw_ prefix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2821
diff
changeset
|
97 |
def __init__(self, req, **extra): |
2656
a93ae0f6c0ad
R [base classes] only AppObject remaning, no more AppRsetObject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2650
diff
changeset
|
98 |
super(AppObject, self).__init__() |
2847
c2ee28f4d4b1
use ._cw instead of .cw_req
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2833
diff
changeset
|
99 |
self._cw = req |
2822
f26578339214
deprecate appobject.vreg and rename appobject instance attributes using cw_ prefix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2821
diff
changeset
|
100 |
try: |
f26578339214
deprecate appobject.vreg and rename appobject instance attributes using cw_ prefix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2821
diff
changeset
|
101 |
self.cw_rset = extra.pop('rset') |
f26578339214
deprecate appobject.vreg and rename appobject instance attributes using cw_ prefix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2821
diff
changeset
|
102 |
self.cw_row = extra.pop('row', None) |
f26578339214
deprecate appobject.vreg and rename appobject instance attributes using cw_ prefix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2821
diff
changeset
|
103 |
self.cw_col = extra.pop('col', None) |
f26578339214
deprecate appobject.vreg and rename appobject instance attributes using cw_ prefix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2821
diff
changeset
|
104 |
except KeyError: |
f26578339214
deprecate appobject.vreg and rename appobject instance attributes using cw_ prefix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2821
diff
changeset
|
105 |
pass |
f26578339214
deprecate appobject.vreg and rename appobject instance attributes using cw_ prefix
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2821
diff
changeset
|
106 |
self.cw_extra_kwargs = extra |
1524 | 107 |
|
2799
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
108 |
# persistent class properties ############################################## |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
109 |
# |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
110 |
# optional `cw_property_defs` dict on a class defines available persistent |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
111 |
# properties for this class: |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
112 |
# |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
113 |
# * key: id of the property (the actual CWProperty key is build using |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
114 |
# <registry name>.<obj id>.<property id> |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
115 |
# * value: tuple (property type, vocabfunc, default value, property description) |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
116 |
# possible types are those used by `logilab.common.configuration` |
0 | 117 |
# |
118 |
# notice that when it exists multiple objects with the same id (adaptation, |
|
119 |
# overriding) only the first encountered definition is considered, so those |
|
120 |
# objects can't try to have different default values for instance. |
|
2799
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
121 |
# |
2818
326375561412
propagate some api changes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2811
diff
changeset
|
122 |
# you can then access to a property value using self.cw_propval, where self |
326375561412
propagate some api changes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2811
diff
changeset
|
123 |
# is an instance of class |
1524 | 124 |
|
0 | 125 |
@classmethod |
2799
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
126 |
def _cwpropkey(cls, propid): |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
127 |
"""return cw property key for the property of the given id for this |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
128 |
class |
0 | 129 |
""" |
3399
2b84f4adb6f8
use __regid__ instead of id on appobject classes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3396
diff
changeset
|
130 |
return '%s.%s.%s' % (cls.__registry__, cls.__regid__, propid) |
1524 | 131 |
|
2799
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
132 |
def cw_propval(self, propid): |
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
133 |
"""return cw property value associated to key |
1524 | 134 |
|
2799
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
135 |
<cls.__registry__>.<cls.id>.<propid> |
0 | 136 |
""" |
3418
7b49fa7e942d
[api] use _cw, cw_row, cw_col, cw_rset etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3399
diff
changeset
|
137 |
return self._cw.property_value(self._cwpropkey(propid)) |
2799
b703639614e7
refactor property handling to avoid name conflicts
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2798
diff
changeset
|
138 |
|
7083
b8e35cde46e9
help pylint by explicitely defining some attributes
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
6870
diff
changeset
|
139 |
# these are overridden by set_log_methods below |
b8e35cde46e9
help pylint by explicitely defining some attributes
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
6870
diff
changeset
|
140 |
# only defining here to prevent pylint from complaining |
b8e35cde46e9
help pylint by explicitely defining some attributes
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
6870
diff
changeset
|
141 |
info = warning = error = critical = exception = debug = lambda msg,*a,**kw: None |
b8e35cde46e9
help pylint by explicitely defining some attributes
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents:
6870
diff
changeset
|
142 |
|
2657
de974465d381
[appobject] kill VObject class, move base selector classes to appobject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
143 |
set_log_methods(AppObject, getLogger('cubicweb.appobject')) |