From: Jeremy Stanley Date: Sun, 17 Jul 2016 02:45:00 +0000 (+0000) Subject: Rename internal:limits element to .mudpy.limit X-Git-Tag: 0.0.1~184 X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=commitdiff_plain;h=f2e017445df6026bcde0000b2490caee4ae1e7e3 Rename internal:limits element to .mudpy.limit Convert the old style internal:limits element to a new style .mudpy.limit element and rename the default_admins, default_backup_count and max_avatars facets to admins, backups and avatars respectively. --- diff --git a/etc/mudpy.yaml b/etc/mudpy.yaml index e6fd405..0d61479 100644 --- a/etc/mudpy.yaml +++ b/etc/mudpy.yaml @@ -13,11 +13,10 @@ __control__: .mudpy.linguistic.default_punctuation: . .mudpy.linguistic.typos: { "i": "I", "i'd": "I'd", "i'll": "I'll", "i'm": "I'm", "teh": "the", "theyre": "they're", "youre": "you're" } -internal:limits: - #default_admins: [ "admin" ] - #default_backup_count: 10 - max_avatars: 7 - password_tries: 3 +#.mudpy.limit.admins: [ admin ] +.mudpy.limit.avatars: 7 +#.mudpy.limit.backups: 10 +.mudpy.limit.password_tries: 3 internal:logging: #file: mudpy.log diff --git a/lib/mudpy/data.py b/lib/mudpy/data.py index 9c167f5..02a9139 100644 --- a/lib/mudpy/data.py +++ b/lib/mudpy/data.py @@ -132,11 +132,8 @@ class DataFile: "__control__"]: max_count = self.data["__control__"]["backup_count"] else: - max_count = self.universe.categories[ - "internal" - ][ - "limits" - ].get("default_backup_count") + max_count = self.universe.contents["mudpy.limit"].get( + "backups") if os.path.exists(self.filename) and max_count: backups = [] for candidate in os.listdir(os.path.dirname(self.filename)): diff --git a/lib/mudpy/misc.py b/lib/mudpy/misc.py index 1dc6b3d..2dc75c0 100644 --- a/lib/mudpy/misc.py +++ b/lib/mudpy/misc.py @@ -685,13 +685,8 @@ class User: if self.state is not "authenticated": log("User " + self.account.get("name") + " logged in.", 2) self.authenticated = True - if self.account.subkey in universe.categories[ - "internal" - ][ - "limits" - ].get( - "default_admins" - ): + if self.account.subkey in universe.contents["mudpy.limit"].get( + "admins"): self.account.set("administrator", "True") def show_menu(self): @@ -1760,13 +1755,8 @@ def handler_checking_password(user): user.state = "main_utility" # if at first your hashes don't match, try, try again - elif user.password_tries < universe.categories[ - "internal" - ][ - "limits" - ].get( - "password_tries" - ) - 1: + elif user.password_tries < universe.contents["mudpy.limit"].get( + "password_tries") - 1: user.password_tries += 1 user.error = "incorrect" @@ -1799,13 +1789,8 @@ def handler_entering_new_password(user): user.state = "verifying_new_password" # the password was weak, try again if you haven't tried too many times - elif user.password_tries < universe.categories[ - "internal" - ][ - "limits" - ].get( - "password_tries" - ) - 1: + elif user.password_tries < universe.contents["mudpy.limit"].get( + "password_tries") - 1: user.password_tries += 1 user.error = "weak" @@ -1834,13 +1819,8 @@ def handler_verifying_new_password(user): # go back to entering the new password as long as you haven't tried # too many times - elif user.password_tries < universe.categories[ - "internal" - ][ - "limits" - ].get( - "password_tries" - ) - 1: + elif user.password_tries < universe.contents["mudpy.limit"].get( + "password_tries") - 1: user.password_tries += 1 user.error = "differs" user.state = "entering_new_password" diff --git a/share/menu.yaml b/share/menu.yaml index 94865c1..9735aec 100644 --- a/share/menu.yaml +++ b/share/menu.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2004-2015 Jeremy Stanley . Permission +# Copyright (c) 2004-2016 Jeremy Stanley . Permission # to use, copy, modify, and distribute this software is granted under # terms provided in the LICENSE file distributed with this software. @@ -112,7 +112,7 @@ menu:main_utility: choice_l: leave for now choice_p: permanently remove your account demand_a: user.account.get("avatars") - demand_c: len(user.account.get("avatars")) < universe.categories["internal"]["limits"].get("max_avatars") + demand_c: len(user.account.get("avatars")) < universe.contents["mudpy.limit"].get("avatars") demand_d: user.account.get("avatars") description: $(red)$(inc:banner.txt)$(nrm)$(eol)$(eol)From here you can awaken, create and delete avatars. An avatar is your persona in the World. You can also leave or permanently delete your account. prompt: What would you like to do?