Switch actors to new-style elements
authorJeremy Stanley <fungi@yuggoth.org>
Thu, 9 Nov 2017 10:00:11 +0000 (10:00 +0000)
committerJeremy Stanley <fungi@yuggoth.org>
Thu, 9 Nov 2017 10:00:11 +0000 (10:00 +0000)
Actor elements created for avatars now follow the new data model.

mudpy/misc.py
mudpy/tests/selftest.py

index c3e1940..231858a 100644 (file)
@@ -944,16 +944,12 @@ class User:
     def new_avatar(self):
         """Instantiate a new, unconfigured avatar for this user."""
         counter = 0
-        while "avatar:" + self.account.get("name") + ":" + str(
-            counter
-        ) in universe.categories.get("actor", {}).keys():
+        while ("avatar_%s_%s" % (self.account.get("name"), counter)
+                in universe.categories.get("actor", {}).keys()):
             counter += 1
         self.avatar = Element(
-            "actor:avatar:" + self.account.get("name") + ":" + str(
-                counter
-            ),
-            universe, old_style=True
-        )
+            "actor.avatar_%s_%s" % (self.account.get("name"), counter),
+            universe)
         self.avatar.append("inherit", "archetype:avatar")
         self.account.append("avatars", self.avatar.key)
 
index 02d98a5..5adc43c 100644 (file)
@@ -162,7 +162,7 @@ test_reload = (
 )
 
 test_set_facet = (
-    (2, "> ", "set actor:avatar:admin:0 gender female"),
+    (2, "> ", "set actor.avatar_admin_0 gender female"),
     (2, r'You have successfully \(re\)set the "gender" facet of element', ""),
 )
 
@@ -188,8 +188,8 @@ test_show_element = (
     (2, "> ", "show element mudpy.limit"),
     (2, r'These are the properties of the "mudpy\.limit" element.*'
         r'  \x1b\[32mpassword_tries: \x1b\[31m3.*> ',
-     "show element actor:avatar:admin:0"),
-    (2, r'These are the properties of the "actor:avatar:admin:0" element.*'
+     "show element actor.avatar_admin_0"),
+    (2, r'These are the properties of the "actor.avatar_admin_0" element.*'
         r'  \x1b\[32mgender: \x1b\[31mfemale.*> ', ""),
 )