Fix prototype lock display when lock is str. Resolve #2323.

This commit is contained in:
Griatch 2021-08-17 19:37:28 +02:00
parent 0fb9c11490
commit 24d89f93d2
3 changed files with 7 additions and 4 deletions

View file

@ -965,7 +965,7 @@ def _typeclass_actions(caller, raw_inp, **kwargs):
return "node_typeclass" return "node_typeclass"
def _typeclass_select(caller, typeclass): def _typeclass_select(caller, typeclass, **kwargs):
"""Select typeclass from list and add it to prototype. Return next node to go to.""" """Select typeclass from list and add it to prototype. Return next node to go to."""
ret = _set_property(caller, typeclass, prop="typeclass", processor=str) ret = _set_property(caller, typeclass, prop="typeclass", processor=str)
caller.msg("Selected typeclass |c{}|n.".format(typeclass)) caller.msg("Selected typeclass |c{}|n.".format(typeclass))

View file

@ -918,7 +918,7 @@ def prototype_to_str(prototype):
attrs = prototype["attrs"] attrs = prototype["attrs"]
out = [] out = []
for (attrkey, value, category, locks) in attrs: for (attrkey, value, category, locks) in attrs:
locks = ", ".join(lock for lock in locks if lock) locks = locks if isinstance(locks, str) else ", ".join(lock for lock in locks if lock)
category = "|ccategory:|n {}".format(category) if category else "" category = "|ccategory:|n {}".format(category) if category else ""
cat_locks = "" cat_locks = ""
if category or locks: if category or locks:

View file

@ -1374,7 +1374,7 @@ def list_node(option_generator, select=None, pagesize=10):
Parse the select action Parse the select action
""" """
available_choices = kwargs.get("available_choices", []) available_choices = kwargs.pop("available_choices", [])
try: try:
index = int(raw_string.strip()) - 1 index = int(raw_string.strip()) - 1
@ -1390,7 +1390,10 @@ def list_node(option_generator, select=None, pagesize=10):
else: else:
return select(caller, selection, **kwargs) return select(caller, selection, **kwargs)
except Exception: except Exception:
logger.log_trace() logger.log_trace("Error in EvMenu.list_node decorator:\n "
f"select-callable: {select}\n with args: ({caller}"
f"{selection}, {available_choices}, {kwargs}) raised "
"exception.")
elif select: elif select:
# we assume a string was given, we inject the result into the kwargs # we assume a string was given, we inject the result into the kwargs
# to pass on to the next node # to pass on to the next node