summaryrefslogtreecommitdiff
path: root/grc/core/Port.py
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2017-02-12 15:14:34 -0800
committerJohnathan Corgan <johnathan@corganlabs.com>2017-02-12 15:14:34 -0800
commit95c9115a9cf6c744fbfca19e0a02cc9448267518 (patch)
treebd17440a7f1a3d28460fb93eba756d4133a651a0 /grc/core/Port.py
parent2958d57eae9ff0b4eb06e5956af26ebb570c449a (diff)
parent82b1e2e3712bec4b515fa8c2cfd11a72db7c2b77 (diff)
Merge branch 'master' into next
Diffstat (limited to 'grc/core/Port.py')
-rw-r--r--grc/core/Port.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/grc/core/Port.py b/grc/core/Port.py
index 138643503b..8549656c9b 100644
--- a/grc/core/Port.py
+++ b/grc/core/Port.py
@@ -166,7 +166,8 @@ class Port(Element):
self._nports = n.find('nports') or ''
self._vlen = n.find('vlen') or ''
- self._optional = bool(n.find('optional'))
+ self._optional = n.find('optional') or ''
+ self._optional_evaluated = False # Updated on rewrite()
self._clones = [] # References to cloned ports (for nports > 1)
def __str__(self):
@@ -200,6 +201,8 @@ class Port(Element):
hide = self.get_parent().resolve_dependencies(self._hide).strip().lower()
self._hide_evaluated = False if hide in ('false', 'off', '0') else bool(hide)
+ optional = self.get_parent().resolve_dependencies(self._optional).strip().lower()
+ self._optional_evaluated = False if optional in ('false', 'off', '0') else bool(optional)
# Update domain if was deduced from (dynamic) port type
type_ = self.get_type()
@@ -264,7 +267,7 @@ class Port(Element):
return 1
def get_optional(self):
- return bool(self._optional)
+ return self._optional_evaluated
def get_color(self):
"""