author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Wed, 10 Jun 2009 09:53:54 +0200 | |
changeset 2082 | 633b175811d0 |
parent 2058 | 7ef12c03447c |
child 2234 | 1fbcf202882d |
permissions | -rw-r--r-- |
0 | 1 |
"""extend the generic VRegistry with some cubicweb specific stuff |
2 |
||
3 |
:organization: Logilab |
|
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1923
diff
changeset
|
4 |
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
0 | 5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1923
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
0 | 7 |
""" |
8 |
__docformat__ = "restructuredtext en" |
|
1769
fb91d2b8a441
fix some rtags pb on i18n catalog generation
sylvain.thenault@logilab.fr
parents:
1752
diff
changeset
|
9 |
_ = unicode |
0 | 10 |
|
11 |
from logilab.common.decorators import cached, clear_cache |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
12 |
from logilab.common.deprecation import obsolete |
0 | 13 |
|
14 |
from rql import RQLHelper |
|
15 |
||
1923
3802c2e37e72
handle speaking to an instance using old entity types
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1917
diff
changeset
|
16 |
from cubicweb import ETYPE_NAME_MAP, Binary, UnknownProperty, UnknownEid |
0 | 17 |
from cubicweb.vregistry import VRegistry, ObjectNotFound, NoSelectableObject |
1769
fb91d2b8a441
fix some rtags pb on i18n catalog generation
sylvain.thenault@logilab.fr
parents:
1752
diff
changeset
|
18 |
from cubicweb.rtags import RTAGS |
0 | 19 |
|
20 |
||
776 | 21 |
def use_interfaces(obj): |
1132 | 22 |
"""return interfaces used by the given object by searchinf for implements |
23 |
selectors, with a bw compat fallback to accepts_interfaces attribute |
|
24 |
""" |
|
776 | 25 |
from cubicweb.selectors import implements |
26 |
try: |
|
27 |
# XXX deprecated |
|
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
28 |
return sorted(obj.accepts_interfaces) |
776 | 29 |
except AttributeError: |
30 |
try: |
|
31 |
impl = obj.__select__.search_selector(implements) |
|
32 |
if impl: |
|
33 |
return sorted(impl.expected_ifaces) |
|
34 |
except AttributeError: |
|
35 |
pass # old-style vobject classes with no accepts_interfaces |
|
1044
3672a7c86784
print message to help debugging selector on error
sylvain.thenault@logilab.fr
parents:
1037
diff
changeset
|
36 |
except: |
3672a7c86784
print message to help debugging selector on error
sylvain.thenault@logilab.fr
parents:
1037
diff
changeset
|
37 |
print 'bad selector %s on %s' % (obj.__select__, obj) |
3672a7c86784
print message to help debugging selector on error
sylvain.thenault@logilab.fr
parents:
1037
diff
changeset
|
38 |
raise |
776 | 39 |
return () |
0 | 40 |
|
41 |
||
42 |
class CubicWebRegistry(VRegistry): |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
43 |
"""Central registry for the cubicweb application, extending the generic |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
44 |
VRegistry with some cubicweb specific stuff. |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
45 |
|
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
46 |
This is one of the central object in cubicweb application, coupling |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
47 |
dynamically loaded objects with the schema and the configuration objects. |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
48 |
|
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
49 |
It specializes the VRegistry by adding some convenience methods to access to |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
50 |
stored objects. Currently we have the following registries of objects known |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
51 |
by the web application (library may use some others additional registries): |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
52 |
|
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
53 |
* etypes |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
54 |
* views |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
55 |
* components |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
56 |
* actions |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
57 |
* forms |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
58 |
* formrenderers |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
59 |
* controllers, which are directly plugged into the application |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
60 |
object to handle request publishing XXX to merge with views |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
61 |
* contentnavigation XXX to merge with components? to kill? |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
62 |
""" |
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
63 |
|
169
0e031b66cb0b
don't systematically init_log, it may breaks client log configuration
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
0
diff
changeset
|
64 |
def __init__(self, config, debug=None, initlog=True): |
0e031b66cb0b
don't systematically init_log, it may breaks client log configuration
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
0
diff
changeset
|
65 |
if initlog: |
0e031b66cb0b
don't systematically init_log, it may breaks client log configuration
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
0
diff
changeset
|
66 |
# first init log service |
0e031b66cb0b
don't systematically init_log, it may breaks client log configuration
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
0
diff
changeset
|
67 |
config.init_log(debug=debug) |
0 | 68 |
super(CubicWebRegistry, self).__init__(config) |
69 |
self.schema = None |
|
70 |
self.reset() |
|
71 |
self.initialized = False |
|
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
72 |
|
0 | 73 |
def items(self): |
74 |
return [item for item in self._registries.items() |
|
75 |
if not item[0] in ('propertydefs', 'propertyvalues')] |
|
76 |
||
77 |
def values(self): |
|
1132 | 78 |
return [value for key, value in self._registries.items() |
0 | 79 |
if not key in ('propertydefs', 'propertyvalues')] |
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
80 |
|
0 | 81 |
def reset(self): |
82 |
self._registries = {} |
|
83 |
self._lastmodifs = {} |
|
666
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
84 |
self._needs_iface = {} |
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
85 |
# two special registries, propertydefs which care all the property |
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
86 |
# definitions, and propertyvals which contains values for those |
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
87 |
# properties |
0 | 88 |
self._registries['propertydefs'] = {} |
89 |
self._registries['propertyvalues'] = self.eprop_values = {} |
|
90 |
for key, propdef in self.config.eproperty_definitions(): |
|
91 |
self.register_property(key, **propdef) |
|
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
92 |
|
0 | 93 |
def set_schema(self, schema): |
94 |
"""set application'schema and load application objects""" |
|
95 |
self.schema = schema |
|
96 |
clear_cache(self, 'rqlhelper') |
|
97 |
# now we can load application's web objects |
|
98 |
self.register_objects(self.config.vregistry_path()) |
|
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
99 |
|
0 | 100 |
def update_schema(self, schema): |
101 |
"""update .schema attribute on registered objects, necessary for some |
|
102 |
tests |
|
103 |
""" |
|
104 |
self.schema = schema |
|
105 |
for registry, regcontent in self._registries.items(): |
|
106 |
if registry in ('propertydefs', 'propertyvalues'): |
|
107 |
continue |
|
108 |
for objects in regcontent.values(): |
|
109 |
for obj in objects: |
|
110 |
obj.schema = schema |
|
666
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
111 |
|
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
112 |
def register_if_interface_found(self, obj, ifaces, **kwargs): |
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
113 |
"""register an object but remove it if no entity class implements one of |
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
114 |
the given interfaces |
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
115 |
""" |
785 | 116 |
self.register(obj, **kwargs) |
666
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
117 |
if not isinstance(ifaces, (tuple, list)): |
785 | 118 |
self._needs_iface[obj] = (ifaces,) |
666
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
119 |
else: |
785 | 120 |
self._needs_iface[obj] = ifaces |
666
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
121 |
|
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
122 |
def register(self, obj, **kwargs): |
717 | 123 |
if kwargs.get('registryname', obj.__registry__) == 'etypes': |
1037
1f3fae8d82b2
don't fail if vobjects reference an unexistant class
sylvain.thenault@logilab.fr
parents:
1016
diff
changeset
|
124 |
if obj.id != 'Any' and not obj.id in self.schema: |
1132 | 125 |
self.error('don\'t register %s, %s type not defined in the ' |
126 |
'schema', obj, obj.id) |
|
0 | 127 |
return |
717 | 128 |
kwargs['clear'] = True |
666
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
129 |
super(CubicWebRegistry, self).register(obj, **kwargs) |
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
130 |
# XXX bw compat |
777
39695e98ba35
test and fix interface based objects cleaning
sylvain.thenault@logilab.fr
parents:
776
diff
changeset
|
131 |
ifaces = use_interfaces(obj) |
666
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
132 |
if ifaces: |
785 | 133 |
self._needs_iface[obj] = ifaces |
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
134 |
|
0 | 135 |
def register_objects(self, path, force_reload=None): |
666
8ad9885ea45a
interface handling should be done here
sylvain.thenault@logilab.fr
parents:
631
diff
changeset
|
136 |
"""overriden to remove objects requiring a missing interface""" |
2025
010a4b0fe855
fix lookup of files to load when using CW_CUBES_PATH
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1985
diff
changeset
|
137 |
extrapath = {} |
010a4b0fe855
fix lookup of files to load when using CW_CUBES_PATH
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1985
diff
changeset
|
138 |
for cubesdir in self.config.cubes_search_path(): |
010a4b0fe855
fix lookup of files to load when using CW_CUBES_PATH
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1985
diff
changeset
|
139 |
if cubesdir != self.config.CUBES_DIR: |
010a4b0fe855
fix lookup of files to load when using CW_CUBES_PATH
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1985
diff
changeset
|
140 |
extrapath[cubesdir] = 'cubes' |
010a4b0fe855
fix lookup of files to load when using CW_CUBES_PATH
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1985
diff
changeset
|
141 |
if super(CubicWebRegistry, self).register_objects(path, force_reload, |
010a4b0fe855
fix lookup of files to load when using CW_CUBES_PATH
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1985
diff
changeset
|
142 |
extrapath): |
1638 | 143 |
self.initialization_completed() |
1752
4b0b912ff5b7
fix rtags initialization: do it at the registry level to avoid multiple initialization of the same rtag
sylvain.thenault@logilab.fr
parents:
1723
diff
changeset
|
144 |
# call vreg_initialization_completed on appobjects and print |
4b0b912ff5b7
fix rtags initialization: do it at the registry level to avoid multiple initialization of the same rtag
sylvain.thenault@logilab.fr
parents:
1723
diff
changeset
|
145 |
# registry content |
1282
272d8ec6f308
* print vreg content once fully initialized (require move of print code from vregistry to cwvreg)
sylvain.thenault@logilab.fr
parents:
1263
diff
changeset
|
146 |
for registry, objects in self.items(): |
272d8ec6f308
* print vreg content once fully initialized (require move of print code from vregistry to cwvreg)
sylvain.thenault@logilab.fr
parents:
1263
diff
changeset
|
147 |
self.debug('available in registry %s: %s', registry, |
272d8ec6f308
* print vreg content once fully initialized (require move of print code from vregistry to cwvreg)
sylvain.thenault@logilab.fr
parents:
1263
diff
changeset
|
148 |
sorted(objects)) |
272d8ec6f308
* print vreg content once fully initialized (require move of print code from vregistry to cwvreg)
sylvain.thenault@logilab.fr
parents:
1263
diff
changeset
|
149 |
for appobjects in objects.itervalues(): |
272d8ec6f308
* print vreg content once fully initialized (require move of print code from vregistry to cwvreg)
sylvain.thenault@logilab.fr
parents:
1263
diff
changeset
|
150 |
for appobject in appobjects: |
272d8ec6f308
* print vreg content once fully initialized (require move of print code from vregistry to cwvreg)
sylvain.thenault@logilab.fr
parents:
1263
diff
changeset
|
151 |
appobject.vreg_initialization_completed() |
1769
fb91d2b8a441
fix some rtags pb on i18n catalog generation
sylvain.thenault@logilab.fr
parents:
1752
diff
changeset
|
152 |
# don't check rtags if we don't want to cleanup_interface_sobjects |
1752
4b0b912ff5b7
fix rtags initialization: do it at the registry level to avoid multiple initialization of the same rtag
sylvain.thenault@logilab.fr
parents:
1723
diff
changeset
|
153 |
for rtag in RTAGS: |
1769
fb91d2b8a441
fix some rtags pb on i18n catalog generation
sylvain.thenault@logilab.fr
parents:
1752
diff
changeset
|
154 |
rtag.init(self.schema, |
fb91d2b8a441
fix some rtags pb on i18n catalog generation
sylvain.thenault@logilab.fr
parents:
1752
diff
changeset
|
155 |
check=self.config.cleanup_interface_sobjects) |
0 | 156 |
|
1638 | 157 |
def initialization_completed(self): |
158 |
# clear etype cache if you don't want to run into deep weirdness |
|
159 |
clear_cache(self, 'etype_class') |
|
160 |
# we may want to keep interface dependent objects (e.g.for i18n |
|
161 |
# catalog generation) |
|
162 |
if self.config.cleanup_interface_sobjects: |
|
163 |
# remove vobjects that don't support any available interface |
|
164 |
implemented_interfaces = set() |
|
165 |
if 'Any' in self.get('etypes', ()): |
|
166 |
for etype in self.schema.entities(): |
|
167 |
cls = self.etype_class(etype) |
|
168 |
for iface in cls.__implements__: |
|
169 |
implemented_interfaces.update(iface.__mro__) |
|
170 |
implemented_interfaces.update(cls.__mro__) |
|
171 |
for obj, ifaces in self._needs_iface.items(): |
|
172 |
ifaces = frozenset(isinstance(iface, basestring) |
|
173 |
and iface in self.schema |
|
174 |
and self.etype_class(iface) |
|
175 |
or iface |
|
176 |
for iface in ifaces) |
|
177 |
if not ('Any' in ifaces or ifaces & implemented_interfaces): |
|
178 |
self.debug('kicking vobject %s (no implemented ' |
|
179 |
'interface among %s)', obj, ifaces) |
|
180 |
self.unregister(obj) |
|
181 |
# clear needs_iface so we don't try to remove some not-anymore-in |
|
182 |
# objects on automatic reloading |
|
183 |
self._needs_iface.clear() |
|
184 |
||
0 | 185 |
@cached |
186 |
def etype_class(self, etype): |
|
187 |
"""return an entity class for the given entity type. |
|
188 |
Try to find out a specific class for this kind of entity or |
|
189 |
default to a dump of the class registered for 'Any' |
|
190 |
""" |
|
191 |
etype = str(etype) |
|
631
99f5852f8604
major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents:
395
diff
changeset
|
192 |
if etype == 'Any': |
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
193 |
return self.select('etypes', 'Any', 'Any') |
0 | 194 |
eschema = self.schema.eschema(etype) |
195 |
baseschemas = [eschema] + eschema.ancestors() |
|
196 |
# browse ancestors from most specific to most generic and |
|
197 |
# try to find an associated custom entity class |
|
198 |
for baseschema in baseschemas: |
|
1923
3802c2e37e72
handle speaking to an instance using old entity types
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1917
diff
changeset
|
199 |
try: |
3802c2e37e72
handle speaking to an instance using old entity types
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1917
diff
changeset
|
200 |
btype = ETYPE_NAME_MAP[baseschema] |
3802c2e37e72
handle speaking to an instance using old entity types
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1917
diff
changeset
|
201 |
except KeyError: |
3802c2e37e72
handle speaking to an instance using old entity types
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1917
diff
changeset
|
202 |
btype = str(baseschema) |
0 | 203 |
try: |
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
204 |
cls = self.select('etypes', btype, etype) |
631
99f5852f8604
major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents:
395
diff
changeset
|
205 |
break |
0 | 206 |
except ObjectNotFound: |
207 |
pass |
|
631
99f5852f8604
major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents:
395
diff
changeset
|
208 |
else: |
99f5852f8604
major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents:
395
diff
changeset
|
209 |
# no entity class for any of the ancestors, fallback to the default |
99f5852f8604
major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents:
395
diff
changeset
|
210 |
# one |
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
211 |
cls = self.select('etypes', 'Any', etype) |
631
99f5852f8604
major selector refactoring (mostly to avoid looking for select parameters on the target class), start accept / interface unification)
sylvain.thenault@logilab.fr
parents:
395
diff
changeset
|
212 |
return cls |
0 | 213 |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
214 |
def render(self, __oid, req, __fallback_oid=None, __registry='views', |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
215 |
rset=None, **kwargs): |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
216 |
"""select object, or fallback object if specified and the first one |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
217 |
isn't selectable, then render it |
0 | 218 |
""" |
219 |
try: |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
220 |
obj = self.select(__registry, __oid, req, rset=rset, **kwargs) |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
221 |
except NoSelectableObject: |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
222 |
if __fallback_oid is None: |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
223 |
raise |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
224 |
obj = self.select(__registry, __fallback_oid, req, rset=rset, |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
225 |
**kwargs) |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
226 |
return obj.render(**kwargs) |
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
227 |
|
823
cb8ccbef8fa5
main template refactoring
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
816
diff
changeset
|
228 |
def main_template(self, req, oid='main-template', **context): |
0 | 229 |
"""display query by calling the given template (default to main), |
230 |
and returning the output as a string instead of requiring the [w]rite |
|
231 |
method as argument |
|
232 |
""" |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
233 |
res = self.render(oid, req, **context) |
0 | 234 |
if isinstance(res, unicode): |
235 |
return res.encode(req.encoding) |
|
236 |
assert isinstance(res, str) |
|
237 |
return res |
|
238 |
||
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
239 |
def select_vobject(self, registry, oid, *args, **kwargs): |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
240 |
selected = self.select_object(registry, oid, *args, **kwargs) |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
241 |
if selected and selected.propval('visible'): |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
242 |
return selected |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
243 |
return None |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
244 |
|
0 | 245 |
def possible_vobjects(self, registry, *args, **kwargs): |
246 |
"""return an ordered list of possible app objects in a given registry, |
|
247 |
supposing they support the 'visible' and 'order' properties (as most |
|
248 |
visualizable objects) |
|
249 |
""" |
|
250 |
return [x for x in sorted(self.possible_objects(registry, *args, **kwargs), |
|
251 |
key=lambda x: x.propval('order')) |
|
213
6842c3dee34b
adding files (formely appearing in jpl) specific to cubicweb
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents:
169
diff
changeset
|
252 |
if x.propval('visible')] |
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
253 |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
254 |
def possible_actions(self, req, rset=None, **kwargs): |
0 | 255 |
if rset is None: |
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
256 |
actions = self.possible_vobjects('actions', req, rset=rset, **kwargs) |
0 | 257 |
else: |
1381
6042f1b342bb
consider kwargs in possible_actions
sylvain.thenault@logilab.fr
parents:
1254
diff
changeset
|
258 |
actions = rset.possible_actions(**kwargs) # cached implementation |
0 | 259 |
result = {} |
260 |
for action in actions: |
|
261 |
result.setdefault(action.category, []).append(action) |
|
262 |
return result |
|
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
263 |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
264 |
def possible_views(self, req, rset=None, **kwargs): |
0 | 265 |
"""return an iterator on possible views for this result set |
266 |
||
267 |
views returned are classes, not instances |
|
268 |
""" |
|
269 |
for vid, views in self.registry('views').items(): |
|
270 |
if vid[0] == '_': |
|
271 |
continue |
|
272 |
try: |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
273 |
view = self.select_best(views, req, rset=rset, **kwargs) |
0 | 274 |
if view.linkable(): |
275 |
yield view |
|
276 |
except NoSelectableObject: |
|
277 |
continue |
|
395
cce260264122
catch Exception in case there is some unexepected selector bug
sylvain.thenault@logilab.fr
parents:
355
diff
changeset
|
278 |
except Exception: |
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
279 |
self.exception('error while trying to select %s view for %s', |
395
cce260264122
catch Exception in case there is some unexepected selector bug
sylvain.thenault@logilab.fr
parents:
355
diff
changeset
|
280 |
vid, rset) |
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
281 |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
282 |
@obsolete("use .select_object('boxes', ...)") |
0 | 283 |
def select_box(self, oid, *args, **kwargs): |
284 |
"""return the most specific view according to the result set""" |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
285 |
return self.select_object('boxes', oid, *args, **kwargs) |
0 | 286 |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
287 |
@obsolete("use .select_object('components', ...)") |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
288 |
def select_component(self, cid, *args, **kwargs): |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
289 |
"""return the most specific component according to the result set""" |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
290 |
return self.select_object('components', cid, *args, **kwargs) |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
291 |
|
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
292 |
@obsolete("use .select_object('actions', ...)") |
0 | 293 |
def select_action(self, oid, *args, **kwargs): |
294 |
"""return the most specific view according to the result set""" |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
295 |
return self.select_object('actions', oid, *args, **kwargs) |
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
296 |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
297 |
@obsolete("use .select('views', ...)") |
1985
9c1db4e06095
move view method's logic on the registry, so it's easier to call it from outside an appobject. Also make rset argument optional
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
298 |
def select_view(self, __vid, req, rset=None, **kwargs): |
0 | 299 |
"""return the most specific view according to the result set""" |
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
300 |
return self.select('views', __vid, req, rset=rset, **kwargs) |
0 | 301 |
|
302 |
# properties handling ##################################################### |
|
303 |
||
304 |
def user_property_keys(self, withsitewide=False): |
|
305 |
if withsitewide: |
|
306 |
return sorted(self['propertydefs']) |
|
307 |
return sorted(k for k, kd in self['propertydefs'].iteritems() |
|
308 |
if not kd['sitewide']) |
|
309 |
||
310 |
def register_property(self, key, type, help, default=None, vocabulary=None, |
|
311 |
sitewide=False): |
|
312 |
"""register a given property""" |
|
313 |
properties = self._registries['propertydefs'] |
|
314 |
assert type in YAMS_TO_PY |
|
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
315 |
properties[key] = {'type': type, 'vocabulary': vocabulary, |
0 | 316 |
'default': default, 'help': help, |
317 |
'sitewide': sitewide} |
|
318 |
||
319 |
def property_info(self, key): |
|
320 |
"""return dictionary containing description associated to the given |
|
321 |
property key (including type, defaut value, help and a site wide |
|
322 |
boolean) |
|
323 |
""" |
|
324 |
try: |
|
325 |
return self._registries['propertydefs'][key] |
|
326 |
except KeyError: |
|
327 |
if key.startswith('system.version.'): |
|
328 |
soft = key.split('.')[-1] |
|
329 |
return {'type': 'String', 'sitewide': True, |
|
330 |
'default': None, 'vocabulary': None, |
|
331 |
'help': _('%s software version of the database') % soft} |
|
332 |
raise UnknownProperty('unregistered property %r' % key) |
|
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
333 |
|
0 | 334 |
def property_value(self, key): |
335 |
try: |
|
336 |
return self._registries['propertyvalues'][key] |
|
337 |
except KeyError: |
|
338 |
return self._registries['propertydefs'][key]['default'] |
|
339 |
||
340 |
def typed_value(self, key, value): |
|
341 |
"""value is an unicode string, return it correctly typed. Let potential |
|
342 |
type error propagates. |
|
343 |
""" |
|
344 |
pdef = self.property_info(key) |
|
345 |
try: |
|
346 |
value = YAMS_TO_PY[pdef['type']](value) |
|
347 |
except (TypeError, ValueError): |
|
348 |
raise ValueError(_('bad value')) |
|
349 |
vocab = pdef['vocabulary'] |
|
350 |
if vocab is not None: |
|
351 |
if callable(vocab): |
|
352 |
vocab = vocab(key, None) # XXX need a req object |
|
353 |
if not value in vocab: |
|
354 |
raise ValueError(_('unauthorized value')) |
|
355 |
return value |
|
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
356 |
|
0 | 357 |
def init_properties(self, propvalues): |
358 |
"""init the property values registry using the given set of couple (key, value) |
|
359 |
""" |
|
360 |
self.initialized = True |
|
361 |
values = self._registries['propertyvalues'] |
|
362 |
for key, val in propvalues: |
|
363 |
try: |
|
364 |
values[key] = self.typed_value(key, val) |
|
365 |
except ValueError: |
|
366 |
self.warning('%s (you should probably delete that property ' |
|
367 |
'from the database)', ex) |
|
368 |
except UnknownProperty, ex: |
|
369 |
self.warning('%s (you should probably delete that property ' |
|
370 |
'from the database)', ex) |
|
371 |
||
372 |
def parse(self, session, rql, args=None): |
|
373 |
rqlst = self.rqlhelper.parse(rql) |
|
374 |
def type_from_eid(eid, session=session): |
|
375 |
return session.describe(eid)[0] |
|
1123
a8e2838f174a
catch UnknownEid and set empty solutions on select nodes
sylvain.thenault@logilab.fr
parents:
395
diff
changeset
|
376 |
try: |
a8e2838f174a
catch UnknownEid and set empty solutions on select nodes
sylvain.thenault@logilab.fr
parents:
395
diff
changeset
|
377 |
self.rqlhelper.compute_solutions(rqlst, {'eid': type_from_eid}, args) |
a8e2838f174a
catch UnknownEid and set empty solutions on select nodes
sylvain.thenault@logilab.fr
parents:
395
diff
changeset
|
378 |
except UnknownEid: |
a8e2838f174a
catch UnknownEid and set empty solutions on select nodes
sylvain.thenault@logilab.fr
parents:
395
diff
changeset
|
379 |
for select in rqlst.children: |
a8e2838f174a
catch UnknownEid and set empty solutions on select nodes
sylvain.thenault@logilab.fr
parents:
395
diff
changeset
|
380 |
select.solutions = [] |
0 | 381 |
return rqlst |
382 |
||
383 |
@property |
|
384 |
@cached |
|
385 |
def rqlhelper(self): |
|
386 |
return RQLHelper(self.schema, |
|
387 |
special_relations={'eid': 'uid', 'has_text': 'fti'}) |
|
388 |
||
169
0e031b66cb0b
don't systematically init_log, it may breaks client log configuration
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents:
0
diff
changeset
|
389 |
|
0 | 390 |
class MulCnxCubicWebRegistry(CubicWebRegistry): |
391 |
"""special registry to be used when an application has to deal with |
|
392 |
connections to differents repository. This class add some additional wrapper |
|
393 |
trying to hide buggy class attributes since classes are not designed to be |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
394 |
shared among multiple registries. |
0 | 395 |
""" |
396 |
def etype_class(self, etype): |
|
397 |
"""return an entity class for the given entity type. |
|
398 |
Try to find out a specific class for this kind of entity or |
|
399 |
default to a dump of the class registered for 'Any' |
|
400 |
""" |
|
401 |
usercls = super(MulCnxCubicWebRegistry, self).etype_class(etype) |
|
1917
eaf6e0edc509
fix etype_class(Any) when multiple sources
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1769
diff
changeset
|
402 |
if etype == 'Any': |
eaf6e0edc509
fix etype_class(Any) when multiple sources
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1769
diff
changeset
|
403 |
return usercls |
0 | 404 |
usercls.e_schema = self.schema.eschema(etype) |
405 |
return usercls |
|
406 |
||
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
407 |
def select_best(self, vobjects, *args, **kwargs): |
0 | 408 |
"""return an instance of the most specific object according |
409 |
to parameters |
|
410 |
||
411 |
raise NoSelectableObject if not object apply |
|
412 |
""" |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
413 |
for vobjectcls in vobjects: |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
414 |
self._fix_cls_attrs(vobjectcls) |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
415 |
selected = super(MulCnxCubicWebRegistry, self).select_best( |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
416 |
vobjects, *args, **kwargs) |
1923
3802c2e37e72
handle speaking to an instance using old entity types
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1917
diff
changeset
|
417 |
# redo the same thing on the instance so it won't use equivalent class |
3802c2e37e72
handle speaking to an instance using old entity types
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1917
diff
changeset
|
418 |
# attributes (which may change) |
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
419 |
self._fix_cls_attrs(selected) |
1923
3802c2e37e72
handle speaking to an instance using old entity types
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1917
diff
changeset
|
420 |
return selected |
1475
5c1ec97f317e
should not be necessary anymore to add entity class to __implements__
sylvain.thenault@logilab.fr
parents:
1357
diff
changeset
|
421 |
|
2058
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
422 |
def _fix_cls_attrs(self, vobject): |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
423 |
vobject.vreg = self |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
424 |
vobject.schema = self.schema |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
425 |
vobject.config = self.config |
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
426 |
|
7ef12c03447c
nicer vreg api, try to make rset an optional named argument in select and derivated (including selectors)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2025
diff
changeset
|
427 |
|
1016
26387b836099
use datetime instead of mx.DateTime
sylvain.thenault@logilab.fr
parents:
823
diff
changeset
|
428 |
from datetime import datetime, date, time, timedelta |
0 | 429 |
|
430 |
YAMS_TO_PY = { |
|
431 |
'Boolean': bool, |
|
432 |
'String' : unicode, |
|
433 |
'Password': str, |
|
434 |
'Bytes': Binary, |
|
435 |
'Int': int, |
|
436 |
'Float': float, |
|
1016
26387b836099
use datetime instead of mx.DateTime
sylvain.thenault@logilab.fr
parents:
823
diff
changeset
|
437 |
'Date': date, |
26387b836099
use datetime instead of mx.DateTime
sylvain.thenault@logilab.fr
parents:
823
diff
changeset
|
438 |
'Datetime': datetime, |
26387b836099
use datetime instead of mx.DateTime
sylvain.thenault@logilab.fr
parents:
823
diff
changeset
|
439 |
'Time': time, |
26387b836099
use datetime instead of mx.DateTime
sylvain.thenault@logilab.fr
parents:
823
diff
changeset
|
440 |
'Interval': timedelta, |
0 | 441 |
} |
442 |