From aefe2b070f95d1b62382397ff33c831d7d1df227 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 27 Feb 2021 13:58:51 +0100 Subject: [PATCH] Fix additional things needed for stand-alone import of evennia lib --- evennia/utils/search.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/evennia/utils/search.py b/evennia/utils/search.py index 8e4cdfaeb3..622ce8a5ca 100644 --- a/evennia/utils/search.py +++ b/evennia/utils/search.py @@ -26,7 +26,7 @@ Example: To reach the search method 'get_object_with_account' # Import the manager methods to be wrapped -from django.db.utils impoort OperationalError +from django.db.utils import OperationalError from django.contrib.contenttypes.models import ContentType # limit symbol import from API @@ -49,11 +49,11 @@ try: AccountDB = ContentType.objects.get(app_label="accounts", model="accountdb").model_class() ScriptDB = ContentType.objects.get(app_label="scripts", model="scriptdb").model_class() Msg = ContentType.objects.get(app_label="comms", model="msg").model_class() - Channel = ContentType.objects.get(app_label="comms", model="channeldb").model_class() + ChannelDB = ContentType.objects.get(app_label="comms", model="channeldb").model_class() HelpEntry = ContentType.objects.get(app_label="help", model="helpentry").model_class() Tag = ContentType.objects.get(app_label="typeclasses", model="tag").model_class() except OperationalError: - # this is a fallback used during tests/doc building + # this is a fallback used during tests/doc building print("Couldn't initialize search managers - db not set up.") from evennia.objects.models import ObjectDB from evennia.accounts.models import AccountDB @@ -180,7 +180,7 @@ messages = search_messages # exact - requires an exact ostring match (not case sensitive) # -search_channel = Channel.objects.channel_search +search_channel = ChannelDB.objects.channel_search search_channels = search_channel channel_search = search_channel channels = search_channels @@ -241,7 +241,7 @@ def search_script_attribute( def search_channel_attribute( key=None, category=None, value=None, strvalue=None, attrtype=None, **kwargs ): - return Channel.objects.get_by_attribute( + return ChannelDB.objects.get_by_attribute( key=key, category=category, value=value, strvalue=strvalue, attrtype=attrtype, **kwargs ) @@ -356,7 +356,7 @@ def search_channel_tag(key=None, category=None, tagtype=None, **kwargs): matches were found. """ - return Channel.objects.get_by_tag(key=key, category=category, tagtype=tagtype, **kwargs) + return ChannelDB.objects.get_by_tag(key=key, category=category, tagtype=tagtype, **kwargs) # search for tag objects (not the objects they are attached to