Skip to content

Commit 4822677

Browse files
committed
Evaluating Action strictly, except extra
1 parent afe7373 commit 4822677

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/tri_form/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
dispatch,
3636
EMPTY,
3737
evaluate_recursive,
38+
evaluate_recursive_strict,
3839
flatten,
3940
getattr_path,
4041
Namespace,
@@ -544,24 +545,26 @@ def icon(cls, icon, title=None, *, display_name=None, call_target=None, icon_cla
544545
def _bind(self) -> 'Action':
545546
return copy.copy(self)
546547

547-
def _evaluate_attribute(self, key, strict=False, **kwargs):
548+
def _evaluate_attribute(self, key, **kwargs):
548549
value = getattr(self, key)
549-
new_value = evaluate_recursive(value, action=self, strict=strict, **kwargs)
550+
new_value = evaluate_recursive_strict(value, action=self, **kwargs)
550551
if new_value is not value:
551552
setattr(self, key, new_value)
552553

553554
def _evaluate_show(self, **kwargs):
554-
self._evaluate_attribute('show', strict=True, **kwargs)
555+
self._evaluate_attribute('show', **kwargs)
555556

556557
def _evaluate(self, **kwargs):
557558
"""
558559
Evaluates callable/lambda members. After this function is called all members will be values.
559560
"""
560-
not_evaluated_attributes = {'show'}
561+
not_evaluated_attributes = {'show', 'extra'}
561562
evaluated_attributes = (x for x in self.get_declared('refinable_members').keys() if x not in not_evaluated_attributes)
562563
for key in evaluated_attributes:
563564
self._evaluate_attribute(key, **kwargs)
564565

566+
self.extra = evaluate_recursive(self.extra, action=self, **kwargs)
567+
565568
for k, v in kwargs.items():
566569
setattr(self, k, v)
567570

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
tri.declarative>=3.0.0,<4.0.0
1+
tri.declarative>=4.0.0,<5.0.0
22
tri.struct>=3.0.0,<4.0.0
33
six

0 commit comments

Comments
 (0)