mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Fix single-attribute examine on not-found
This commit is contained in:
parent
7c9705d90a
commit
23767f4205
1 changed files with 10 additions and 3 deletions
|
|
@ -2375,6 +2375,8 @@ class CmdExamine(ObjManipCommand):
|
|||
value (any): Attribute value.
|
||||
Returns:
|
||||
"""
|
||||
if attr is None:
|
||||
return "No such attribute was found."
|
||||
value = utils.to_str(value)
|
||||
if crop:
|
||||
value = utils.crop(value)
|
||||
|
|
@ -2390,19 +2392,24 @@ class CmdExamine(ObjManipCommand):
|
|||
non-persistent data stored on object
|
||||
|
||||
"""
|
||||
|
||||
if attrname:
|
||||
db_attr = [(attrname, obj.attributes.get(attrname), None)]
|
||||
if obj.attributes.has(attrname):
|
||||
db_attr = [(attrname, obj.attributes.get(attrname), None)]
|
||||
else:
|
||||
db_attr = None
|
||||
try:
|
||||
ndb_attr = [(attrname, object.__getattribute__(obj.ndb, attrname))]
|
||||
except Exception:
|
||||
ndb_attr = None
|
||||
if not (db_attr or ndb_attr):
|
||||
return {"Attribue(s)": f"\n No Attribute '{attrname}' found on {obj.name}"}
|
||||
else:
|
||||
db_attr = [(attr.key, attr.value, attr.category) for attr in obj.db_attributes.all()]
|
||||
try:
|
||||
ndb_attr = obj.nattributes.all(return_tuples=True)
|
||||
except Exception:
|
||||
ndb_attr = None
|
||||
ndb_attr = (None, None, None)
|
||||
|
||||
output = {}
|
||||
if db_attr and db_attr[0]:
|
||||
output["Persistent attribute(s)"] = "\n " + "\n ".join(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue