mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Log more useful error message if using ObjectDB root instead of typeclass. Resolve #3556
This commit is contained in:
parent
7d553125ba
commit
1ad91fed2c
2 changed files with 16 additions and 5 deletions
|
|
@ -2,12 +2,14 @@
|
|||
|
||||
## Main branch
|
||||
|
||||
[Docs][issue3591]: Fix of NPC reaction tutorial code (Griatch)
|
||||
[Docs][issue3590]: Make `examine` command properly show `strattr` type
|
||||
[Fix][issue3556]: Better error if trying to treat ObjectDB as a typeclass (Griatch)
|
||||
[Fix][issue3590]: Make `examine` command properly show `strattr` type
|
||||
Attribute values (Griatch)
|
||||
[Docs][issue3591]: Fix of NPC reaction tutorial code (Griatch)
|
||||
|
||||
[issue3591]: https://github.com/evennia/evennia/issues/3591
|
||||
[issue3590]: https://github.com/evennia/evennia/issues/3590
|
||||
[issue3556]: https://github.com/evennia/evennia/issues/3556
|
||||
|
||||
|
||||
## Evennia 4.3.0
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ from django.conf import settings
|
|||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.validators import validate_comma_separated_integer_list
|
||||
from django.db import models
|
||||
|
||||
from evennia.objects.manager import ObjectDBManager
|
||||
from evennia.typeclasses.models import TypedObject
|
||||
from evennia.utils import logger
|
||||
|
|
@ -71,8 +70,18 @@ class ContentsHandler:
|
|||
objects = self.load()
|
||||
self._pkcache = {obj.pk: True for obj in objects}
|
||||
for obj in objects:
|
||||
for ctype in obj._content_types:
|
||||
self._typecache[ctype][obj.pk] = True
|
||||
try:
|
||||
ctypes = obj._content_types
|
||||
except AttributeError:
|
||||
logger.log_err(
|
||||
f"Object {obj} has no `_content_types` property. Skipping content-cache setup. "
|
||||
"This error suggests it is not a valid Evennia Typeclass but maybe a root model "
|
||||
"like `ObjectDB`. Investigate the `db_typeclass_path` of the object and make sure "
|
||||
"it points to a proper, existing Typeclass."
|
||||
)
|
||||
else:
|
||||
for ctype in obj._content_types:
|
||||
self._typecache[ctype][obj.pk] = True
|
||||
|
||||
def get(self, exclude=None, content_type=None):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue