author | Alexandre Fayolle <alexandre.fayolle@logilab.fr> |
Wed, 23 Jun 2010 09:30:59 +0000 | |
branch | stable |
changeset 5827 | aad4496a279a |
parent 5424 | 8ecbcbff9777 |
child 5556 | 9ab2b4c74baf |
permissions | -rw-r--r-- |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5309
diff
changeset
|
1 |
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5309
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:
5309
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:
5309
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:
5309
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:
5309
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:
5309
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:
5309
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:
5309
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:
5309
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:
5309
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:
5309
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:
5309
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:
5309
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:
5309
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:
5309
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
5309
e8567135a927
[doc/book] fix docstrings, add notes
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4719
diff
changeset
|
18 |
"""mixins of entity/views organized somewhat in a graph or tree structure""" |
0 | 19 |
__docformat__ = "restructuredtext en" |
20 |
||
4401
4d973c834eb3
missing import
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4395
diff
changeset
|
21 |
from itertools import chain |
4d973c834eb3
missing import
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4395
diff
changeset
|
22 |
|
0 | 23 |
from logilab.common.decorators import cached |
24 |
||
692
800592b8d39b
replace deprecated cubicweb.common.selectors by its new module path (cubicweb.selectors)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
471
diff
changeset
|
25 |
from cubicweb.selectors import implements |
2920
64322aa83a1d
start a new workflow engine
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2748
diff
changeset
|
26 |
from cubicweb.interfaces import IEmailable, ITree |
0 | 27 |
|
28 |
||
29 |
class TreeMixIn(object): |
|
5309
e8567135a927
[doc/book] fix docstrings, add notes
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4719
diff
changeset
|
30 |
"""base tree-mixin implementing the tree interface |
0 | 31 |
|
32 |
This mixin has to be inherited explicitly and configured using the |
|
33 |
tree_attribute, parent_target and children_target class attribute to |
|
34 |
benefit from this default implementation |
|
35 |
""" |
|
36 |
tree_attribute = None |
|
37 |
# XXX misnamed |
|
38 |
parent_target = 'subject' |
|
39 |
children_target = 'object' |
|
1451 | 40 |
|
0 | 41 |
def different_type_children(self, entities=True): |
42 |
"""return children entities of different type as this entity. |
|
1451 | 43 |
|
0 | 44 |
according to the `entities` parameter, return entity objects or the |
45 |
equivalent result set |
|
46 |
""" |
|
47 |
res = self.related(self.tree_attribute, self.children_target, |
|
48 |
entities=entities) |
|
49 |
if entities: |
|
50 |
return [e for e in res if e.e_schema != self.e_schema] |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3426
diff
changeset
|
51 |
return res.filtered_rset(lambda x: x.e_schema != self.e_schema, self.cw_col) |
0 | 52 |
|
53 |
def same_type_children(self, entities=True): |
|
54 |
"""return children entities of the same type as this entity. |
|
1451 | 55 |
|
0 | 56 |
according to the `entities` parameter, return entity objects or the |
57 |
equivalent result set |
|
58 |
""" |
|
59 |
res = self.related(self.tree_attribute, self.children_target, |
|
60 |
entities=entities) |
|
61 |
if entities: |
|
62 |
return [e for e in res if e.e_schema == self.e_schema] |
|
4395 | 63 |
return res.filtered_rset(lambda x: x.e_schema is self.e_schema, self.cw_col) |
1451 | 64 |
|
0 | 65 |
def iterchildren(self, _done=None): |
66 |
if _done is None: |
|
67 |
_done = set() |
|
68 |
for child in self.children(): |
|
69 |
if child.eid in _done: |
|
3457
0924d0d08d60
[api] __regid__, cw_* and friends
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
70 |
self.error('loop in %s tree', self.__regid__.lower()) |
0 | 71 |
continue |
72 |
yield child |
|
73 |
_done.add(child.eid) |
|
74 |
||
75 |
def prefixiter(self, _done=None): |
|
76 |
if _done is None: |
|
77 |
_done = set() |
|
78 |
if self.eid in _done: |
|
79 |
return |
|
4383
e62a9efdd90a
it seems that prefixiter is expected to return child *folder* but was relying on a specific .children implementation, fix this
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4351
diff
changeset
|
80 |
_done.add(self.eid) |
0 | 81 |
yield self |
4383
e62a9efdd90a
it seems that prefixiter is expected to return child *folder* but was relying on a specific .children implementation, fix this
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4351
diff
changeset
|
82 |
for child in self.same_type_children(): |
e62a9efdd90a
it seems that prefixiter is expected to return child *folder* but was relying on a specific .children implementation, fix this
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4351
diff
changeset
|
83 |
for entity in child.prefixiter(_done): |
e62a9efdd90a
it seems that prefixiter is expected to return child *folder* but was relying on a specific .children implementation, fix this
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4351
diff
changeset
|
84 |
yield entity |
1451 | 85 |
|
0 | 86 |
@cached |
87 |
def path(self): |
|
88 |
"""returns the list of eids from the root object to this object""" |
|
89 |
path = [] |
|
90 |
parent = self |
|
91 |
while parent: |
|
92 |
if parent.eid in path: |
|
3457
0924d0d08d60
[api] __regid__, cw_* and friends
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
93 |
self.error('loop in %s tree', self.__regid__.lower()) |
0 | 94 |
break |
95 |
path.append(parent.eid) |
|
96 |
try: |
|
97 |
# check we are not leaving the tree |
|
98 |
if (parent.tree_attribute != self.tree_attribute or |
|
99 |
parent.parent_target != self.parent_target): |
|
100 |
break |
|
101 |
parent = parent.parent() |
|
102 |
except AttributeError: |
|
103 |
break |
|
104 |
||
105 |
path.reverse() |
|
106 |
return path |
|
1451 | 107 |
|
4351
619c7f9302fc
get back iterparents implementation from folder cubes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
108 |
def iterparents(self, strict=True): |
173
a4a9e1a7e40f
TreeMixin : provide an iterator on the parents
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
62
diff
changeset
|
109 |
def _uptoroot(self): |
a4a9e1a7e40f
TreeMixin : provide an iterator on the parents
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
62
diff
changeset
|
110 |
curr = self |
a4a9e1a7e40f
TreeMixin : provide an iterator on the parents
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
62
diff
changeset
|
111 |
while True: |
a4a9e1a7e40f
TreeMixin : provide an iterator on the parents
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
62
diff
changeset
|
112 |
curr = curr.parent() |
a4a9e1a7e40f
TreeMixin : provide an iterator on the parents
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
62
diff
changeset
|
113 |
if curr is None: |
a4a9e1a7e40f
TreeMixin : provide an iterator on the parents
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
62
diff
changeset
|
114 |
break |
a4a9e1a7e40f
TreeMixin : provide an iterator on the parents
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
62
diff
changeset
|
115 |
yield curr |
4351
619c7f9302fc
get back iterparents implementation from folder cubes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
116 |
if not strict: |
619c7f9302fc
get back iterparents implementation from folder cubes
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
117 |
return chain([self], _uptoroot(self)) |
173
a4a9e1a7e40f
TreeMixin : provide an iterator on the parents
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
62
diff
changeset
|
118 |
return _uptoroot(self) |
a4a9e1a7e40f
TreeMixin : provide an iterator on the parents
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
62
diff
changeset
|
119 |
|
0 | 120 |
def notification_references(self, view): |
121 |
"""used to control References field of email send on notification |
|
122 |
for this entity. `view` is the notification view. |
|
1451 | 123 |
|
0 | 124 |
Should return a list of eids which can be used to generate message ids |
125 |
of previously sent email |
|
126 |
""" |
|
127 |
return self.path()[:-1] |
|
128 |
||
129 |
||
130 |
## ITree interface ######################################################## |
|
131 |
def parent(self): |
|
132 |
"""return the parent entity if any, else None (e.g. if we are on the |
|
133 |
root |
|
134 |
""" |
|
135 |
try: |
|
136 |
return self.related(self.tree_attribute, self.parent_target, |
|
137 |
entities=True)[0] |
|
138 |
except (KeyError, IndexError): |
|
139 |
return None |
|
140 |
||
141 |
def children(self, entities=True, sametype=False): |
|
142 |
"""return children entities |
|
143 |
||
144 |
according to the `entities` parameter, return entity objects or the |
|
145 |
equivalent result set |
|
146 |
""" |
|
147 |
if sametype: |
|
148 |
return self.same_type_children(entities) |
|
149 |
else: |
|
150 |
return self.related(self.tree_attribute, self.children_target, |
|
151 |
entities=entities) |
|
152 |
||
153 |
def children_rql(self): |
|
154 |
return self.related_rql(self.tree_attribute, self.children_target) |
|
1451 | 155 |
|
0 | 156 |
def is_leaf(self): |
157 |
return len(self.children()) == 0 |
|
158 |
||
159 |
def is_root(self): |
|
160 |
return self.parent() is None |
|
161 |
||
162 |
def root(self): |
|
163 |
"""return the root object""" |
|
3426
6ea4a2ff01c9
[api] use cw_*
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3023
diff
changeset
|
164 |
return self._cw.entity_from_eid(self.path()[0]) |
0 | 165 |
|
166 |
||
167 |
class EmailableMixIn(object): |
|
168 |
"""base mixin providing the default get_email() method used by |
|
169 |
the massmailing view |
|
170 |
||
171 |
NOTE: The default implementation is based on the |
|
172 |
primary_email / use_email scheme |
|
173 |
""" |
|
174 |
__implements__ = (IEmailable,) |
|
1451 | 175 |
|
0 | 176 |
def get_email(self): |
177 |
if getattr(self, 'primary_email', None): |
|
178 |
return self.primary_email[0].address |
|
179 |
if getattr(self, 'use_email', None): |
|
180 |
return self.use_email[0].address |
|
181 |
return None |
|
182 |
||
183 |
@classmethod |
|
184 |
def allowed_massmail_keys(cls): |
|
185 |
"""returns a set of allowed email substitution keys |
|
186 |
||
187 |
The default is to return the entity's attribute list but an |
|
188 |
entity class might override this method to allow extra keys. |
|
189 |
For instance, the Person class might want to return a `companyname` |
|
190 |
key. |
|
191 |
""" |
|
3830
3b6bbb3a3c3e
close #472361: omit password and bytes attributes in allowed mass-mailing keys
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3583
diff
changeset
|
192 |
return set(rschema.type |
3b6bbb3a3c3e
close #472361: omit password and bytes attributes in allowed mass-mailing keys
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3583
diff
changeset
|
193 |
for rschema, attrtype in cls.e_schema.attribute_definitions() |
3b6bbb3a3c3e
close #472361: omit password and bytes attributes in allowed mass-mailing keys
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3583
diff
changeset
|
194 |
if attrtype.type not in ('Password', 'Bytes')) |
0 | 195 |
|
196 |
def as_email_context(self): |
|
197 |
"""returns the dictionary as used by the sendmail controller to |
|
198 |
build email bodies. |
|
1451 | 199 |
|
0 | 200 |
NOTE: the dictionary keys should match the list returned by the |
201 |
`allowed_massmail_keys` method. |
|
202 |
""" |
|
203 |
return dict( (attr, getattr(self, attr)) for attr in self.allowed_massmail_keys() ) |
|
204 |
||
205 |
||
3926 | 206 |
"""pluggable mixins system: plug classes registered in MI_REL_TRIGGERS on entity |
207 |
classes which have the relation described by the dict's key. |
|
1451 | 208 |
|
3926 | 209 |
NOTE: pluggable mixins can't override any method of the 'explicit' user classes tree |
210 |
(eg without plugged classes). This includes bases Entity and AnyEntity classes. |
|
211 |
""" |
|
0 | 212 |
MI_REL_TRIGGERS = { |
213 |
('primary_email', 'subject'): EmailableMixIn, |
|
214 |
('use_email', 'subject'): EmailableMixIn, |
|
215 |
} |
|
216 |
||
217 |
||
218 |
||
219 |
def _done_init(done, view, row, col): |
|
220 |
"""handle an infinite recursion safety belt""" |
|
221 |
if done is None: |
|
222 |
done = set() |
|
3460
e4843535db25
[api] some more _cw / __regid__, automatic tests now pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3457
diff
changeset
|
223 |
entity = view.cw_rset.get_entity(row, col) |
0 | 224 |
if entity.eid in done: |
3426
6ea4a2ff01c9
[api] use cw_*
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3023
diff
changeset
|
225 |
msg = entity._cw._('loop in %(rel)s relation (%(eid)s)') % { |
62
ef06f71533d9
use named substitutions in i18n strings
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
226 |
'rel': entity.tree_attribute, |
ef06f71533d9
use named substitutions in i18n strings
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
227 |
'eid': entity.eid |
ef06f71533d9
use named substitutions in i18n strings
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
228 |
} |
0 | 229 |
return None, msg |
230 |
done.add(entity.eid) |
|
231 |
return done, entity |
|
232 |
||
233 |
||
234 |
class TreeViewMixIn(object): |
|
235 |
"""a recursive tree view""" |
|
3457
0924d0d08d60
[api] __regid__, cw_* and friends
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
236 |
__regid__ = 'tree' |
0 | 237 |
item_vid = 'treeitem' |
728
a95b284150d1
first pass to use __select__ instead of __selectors__
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
692
diff
changeset
|
238 |
__select__ = implements(ITree) |
0 | 239 |
|
240 |
def call(self, done=None, **kwargs): |
|
241 |
if done is None: |
|
242 |
done = set() |
|
243 |
super(TreeViewMixIn, self).call(done=done, **kwargs) |
|
1451 | 244 |
|
0 | 245 |
def cell_call(self, row, col=0, vid=None, done=None, **kwargs): |
246 |
done, entity = _done_init(done, self, row, col) |
|
247 |
if done is None: |
|
248 |
# entity is actually an error message |
|
249 |
self.w(u'<li class="badcontent">%s</li>' % entity) |
|
250 |
return |
|
251 |
self.open_item(entity) |
|
252 |
entity.view(vid or self.item_vid, w=self.w, **kwargs) |
|
253 |
relatedrset = entity.children(entities=False) |
|
3457
0924d0d08d60
[api] __regid__, cw_* and friends
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
254 |
self.wview(self.__regid__, relatedrset, 'null', done=done, **kwargs) |
0 | 255 |
self.close_item(entity) |
256 |
||
257 |
def open_item(self, entity): |
|
3457
0924d0d08d60
[api] __regid__, cw_* and friends
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
258 |
self.w(u'<li class="%s">\n' % entity.__regid__.lower()) |
0 | 259 |
def close_item(self, entity): |
260 |
self.w(u'</li>\n') |
|
261 |
||
262 |
||
263 |
class TreePathMixIn(object): |
|
264 |
"""a recursive path view""" |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3426
diff
changeset
|
265 |
__regid__ = 'path' |
0 | 266 |
item_vid = 'oneline' |
2996
866a2c135c33
B #345282 xhtml requires to use   instead of
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2748
diff
changeset
|
267 |
separator = u' > ' |
0 | 268 |
|
269 |
def call(self, **kwargs): |
|
270 |
self.w(u'<div class="pathbar">') |
|
271 |
super(TreePathMixIn, self).call(**kwargs) |
|
272 |
self.w(u'</div>') |
|
1451 | 273 |
|
0 | 274 |
def cell_call(self, row, col=0, vid=None, done=None, **kwargs): |
275 |
done, entity = _done_init(done, self, row, col) |
|
276 |
if done is None: |
|
277 |
# entity is actually an error message |
|
278 |
self.w(u'<span class="badcontent">%s</span>' % entity) |
|
279 |
return |
|
280 |
parent = entity.parent() |
|
281 |
if parent: |
|
3457
0924d0d08d60
[api] __regid__, cw_* and friends
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
282 |
parent.view(self.__regid__, w=self.w, done=done) |
0 | 283 |
self.w(self.separator) |
284 |
entity.view(vid or self.item_vid, w=self.w) |
|
285 |
||
286 |
||
287 |
class ProgressMixIn(object): |
|
5309
e8567135a927
[doc/book] fix docstrings, add notes
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
4719
diff
changeset
|
288 |
"""provide a default implementations for IProgress interface methods""" |
0 | 289 |
|
290 |
@property |
|
291 |
def cost(self): |
|
292 |
return self.progress_info()['estimated'] |
|
293 |
||
294 |
@property |
|
295 |
def revised_cost(self): |
|
296 |
return self.progress_info().get('estimatedcorrected', self.cost) |
|
297 |
||
298 |
@property |
|
299 |
def done(self): |
|
300 |
return self.progress_info()['done'] |
|
301 |
||
302 |
@property |
|
303 |
def todo(self): |
|
304 |
return self.progress_info()['todo'] |
|
305 |
||
306 |
@cached |
|
307 |
def progress_info(self): |
|
308 |
raise NotImplementedError() |
|
309 |
||
310 |
def finished(self): |
|
311 |
return not self.in_progress() |
|
312 |
||
313 |
def in_progress(self): |
|
314 |
raise NotImplementedError() |
|
1451 | 315 |
|
0 | 316 |
def progress(self): |
317 |
try: |
|
318 |
return 100. * self.done / self.revised_cost |
|
319 |
except ZeroDivisionError: |
|
320 |
# total cost is 0 : if everything was estimated, task is completed |
|
961 | 321 |
if self.progress_info().get('notestimated'): |
0 | 322 |
return 0. |
323 |
return 100 |