Fix func dbref command to include optional dbref info

This commit is contained in:
Griatch 2024-04-04 19:33:23 +02:00
parent 201ffc0da5
commit 425ec69928
2 changed files with 16 additions and 31 deletions

View file

@ -5,13 +5,13 @@ Building and world design commands
import re
import typing
import evennia
from django.conf import settings
from django.core.paginator import Paginator
from django.db.models import Max, Min, Q
import evennia
from evennia import InterruptCommand
from evennia.commands.cmdhandler import generate_cmdset_providers, get_and_merge_cmdsets
from evennia.commands.cmdhandler import (generate_cmdset_providers,
get_and_merge_cmdsets)
from evennia.locks.lockhandler import LockException
from evennia.objects.models import ObjectDB
from evennia.prototypes import menus as olc_menus
@ -24,18 +24,10 @@ from evennia.utils.dbserialize import deserialize
from evennia.utils.eveditor import EvEditor
from evennia.utils.evmore import EvMore
from evennia.utils.evtable import EvTable
from evennia.utils.utils import (
class_from_module,
crop,
dbref,
display_len,
format_grid,
get_all_typeclasses,
inherits_from,
interactive,
list_to_string,
variable_from_module,
)
from evennia.utils.utils import (class_from_module, crop, dbref, display_len,
format_grid, get_all_typeclasses,
inherits_from, interactive, list_to_string,
variable_from_module)
COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS)
@ -77,7 +69,7 @@ __all__ = (
)
# used by set
from ast import literal_eval as _LITERAL_EVAL
from ast import literal_eval as _LITERAL_EVAL # noqa
LIST_APPEND_CHAR = "+"
@ -3282,9 +3274,11 @@ class CmdFind(COMMAND_DEFAULT_CLASS):
string += f"\n |RNo match found for '{searchstring}' in #dbref interval.|n"
else:
result = result[0]
string += f"\n|g {result.get_display_name(caller)} - {result.path}|n"
string += (f"\n|g {result.get_display_name(caller)}"
f"{result.get_extra_display_name_info(caller)} - {result.path}|n")
if "loc" in self.switches and not is_account and result.location:
string += f" (|wlocation|n: |g{result.location.get_display_name(caller)}|n)"
string += (f" (|wlocation|n: |g{result.location.get_display_name(caller)}"
f"{result.get_extra_display_name_info(caller)}|n)")
else:
# Not an account/dbref search but a wider search; build a queryset.
# Searches for key and aliases

View file

@ -10,11 +10,10 @@ import time
import typing
from collections import defaultdict
import evennia
import inflect
from django.conf import settings
from django.utils.translation import gettext as _
import evennia
from evennia.commands import cmdset
from evennia.commands.cmdsethandler import CmdSetHandler
from evennia.objects.manager import ObjectManager
@ -24,17 +23,9 @@ from evennia.server.signals import SIGNAL_EXIT_TRAVERSED
from evennia.typeclasses.attributes import ModelAttributeBackend, NickHandler
from evennia.typeclasses.models import TypeclassBase
from evennia.utils import ansi, create, funcparser, logger, search
from evennia.utils.utils import (
class_from_module,
compress_whitespace,
dbref,
is_iter,
iter_to_str,
lazy_property,
make_iter,
to_str,
variable_from_module,
)
from evennia.utils.utils import (class_from_module, compress_whitespace, dbref,
is_iter, iter_to_str, lazy_property,
make_iter, to_str, variable_from_module)
_INFLECT = inflect.engine()
_MULTISESSION_MODE = settings.MULTISESSION_MODE