From 7215bab388a09120e236654bbda2d0f4f167c6d7 Mon Sep 17 00:00:00 2001 From: Griatch Date: Tue, 17 Aug 2021 19:46:29 +0200 Subject: [PATCH] Fix sorting prototyes with non-string attr/tag data. Resolve #2364. --- evennia/prototypes/spawner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/evennia/prototypes/spawner.py b/evennia/prototypes/spawner.py index eb01b9eae0..0e9ee7f8fa 100644 --- a/evennia/prototypes/spawner.py +++ b/evennia/prototypes/spawner.py @@ -325,7 +325,8 @@ def prototype_from_object(obj): if aliases: prot["aliases"] = aliases tags = sorted( - [(tag.db_key, tag.db_category, tag.db_data) for tag in obj.tags.all(return_objs=True)] + [(tag.db_key, tag.db_category, tag.db_data) for tag in obj.tags.all(return_objs=True)], + key=lambda tup: (str(tup[0]), tup[1] or '', tup[2] or '') ) if tags: prot["tags"] = tags @@ -333,7 +334,8 @@ def prototype_from_object(obj): [ (attr.key, attr.value, attr.category, ";".join(attr.locks.all())) for attr in obj.attributes.all() - ] + ], + key=lambda tup: (str(tup[0]), tup[1] or '', tup[2] or '', tup[3]) ) if attrs: prot["attrs"] = attrs