check for results and fix attr-get
This commit is contained in:
parent
6c8eef5961
commit
67a7e6ad61
1 changed files with 7 additions and 6 deletions
|
|
@ -1927,14 +1927,11 @@ class CmdSetAttribute(ObjManipCommand):
|
||||||
if self.rhs is None:
|
if self.rhs is None:
|
||||||
# no = means we inspect the attribute(s)
|
# no = means we inspect the attribute(s)
|
||||||
if not attrs:
|
if not attrs:
|
||||||
attrs = [attr.key for attr in obj.attributes.get(category=None)]
|
attrs = [attr.key for attr in obj.attributes.get(category=None, return_obj=True)]
|
||||||
for attr in attrs:
|
for attr in attrs:
|
||||||
if not self.check_attr(obj, attr, category):
|
if not self.check_attr(obj, attr, category):
|
||||||
continue
|
continue
|
||||||
result.append(self.view_attr(obj, attr, category))
|
result.append(self.view_attr(obj, attr, category))
|
||||||
# we view it without parsing markup.
|
|
||||||
self.caller.msg("".join(result).strip(), options={"raw": True})
|
|
||||||
return
|
|
||||||
else:
|
else:
|
||||||
# deleting the attribute(s)
|
# deleting the attribute(s)
|
||||||
if not (obj.access(self.caller, "control") or obj.access(self.caller, "edit")):
|
if not (obj.access(self.caller, "control") or obj.access(self.caller, "edit")):
|
||||||
|
|
@ -1979,6 +1976,10 @@ class CmdSetAttribute(ObjManipCommand):
|
||||||
else:
|
else:
|
||||||
value = _convert_from_string(self, value)
|
value = _convert_from_string(self, value)
|
||||||
result.append(self.set_attr(obj, attr, value, category))
|
result.append(self.set_attr(obj, attr, value, category))
|
||||||
|
# check if anything was done
|
||||||
|
if not result:
|
||||||
|
caller.msg("No valid attributes were found. Usage: set obj/attr[:category] = value. Use empty value to clear.")
|
||||||
|
else:
|
||||||
# send feedback
|
# send feedback
|
||||||
caller.msg("".join(result).strip("\n"))
|
caller.msg("".join(result).strip("\n"))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue