Skip to content

Commit

Permalink
Core: fix pickling plando connections (#4054)
Browse files Browse the repository at this point in the history
* shift plando pickle hack

* Update Utils.py

Co-authored-by: Exempt-Medic <[email protected]>

---------

Co-authored-by: Exempt-Medic <[email protected]>
  • Loading branch information
Silvris and Exempt-Medic authored Oct 22, 2024
1 parent 703e339 commit 049a878
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def find_class(self, module: str, name: str) -> type:
if module == "NetUtils" and name in {"NetworkItem", "ClientStatus", "Hint", "SlotType", "NetworkSlot"}:
return getattr(self.net_utils_module, name)
# Options and Plando are unpickled by WebHost -> Generate
if module == "worlds.generic" and name in {"PlandoItem", "PlandoConnection"}:
if module == "worlds.generic" and name == "PlandoItem":
if not self.generic_properties_module:
self.generic_properties_module = importlib.import_module("worlds.generic")
return getattr(self.generic_properties_module, name)
Expand All @@ -434,7 +434,7 @@ def find_class(self, module: str, name: str) -> type:
else:
mod = importlib.import_module(module)
obj = getattr(mod, name)
if issubclass(obj, self.options_module.Option):
if issubclass(obj, (self.options_module.Option, self.options_module.PlandoConnection)):
return obj
# Forbid everything else.
raise pickle.UnpicklingError(f"global '{module}.{name}' is forbidden")
Expand Down

0 comments on commit 049a878

Please sign in to comment.