mirror of
https://github.com/evennia/evennia.git
synced 2026-03-30 20:47:17 +02:00
Fixed an elusive bug in utils.get_variable_from_module() that caused the connection screen to sometimes not load properly, due to the imported modules being erroneously extracted and used.
This commit is contained in:
parent
5264dc85bb
commit
6501f30cbc
7 changed files with 80 additions and 78 deletions
|
|
@ -6,6 +6,7 @@ be of use when designing your own game.
|
|||
|
||||
|
||||
"""
|
||||
from inspect import ismodule
|
||||
import os, sys, imp
|
||||
import textwrap
|
||||
import datetime
|
||||
|
|
@ -623,7 +624,7 @@ def variable_from_module(modpath, variable=None, default=None):
|
|||
return mod.__dict__.get(variable, default)
|
||||
else:
|
||||
# random selection
|
||||
mvars = [val for key, val in mod.__dict__.items() if not key.startswith("_")]
|
||||
mvars = [val for key, val in mod.__dict__.items() if not (key.startswith("_") or ismodule(val))]
|
||||
return mvars and random.choice(mvars)
|
||||
|
||||
def string_from_module(modpath, variable=None, default=None):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue