Resolve merge conflicts
This commit is contained in:
commit
8246a060b9
2 changed files with 24 additions and 9 deletions
|
|
@ -1279,6 +1279,19 @@ def check_main_evennia_dependencies():
|
||||||
error = True
|
error = True
|
||||||
if error:
|
if error:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
# fix a common zope issue with a missing __init__ file
|
||||||
|
zope_interface = importlib.import_module("zope.interface")
|
||||||
|
expected_init_path = os.path.join(
|
||||||
|
os.path.dirname(os.path.dirname(zope_interface.__file__)), "__init__.py")
|
||||||
|
if not os.path.exists(expected_init_path):
|
||||||
|
# add an empty missing __init__.py file to fix the problem
|
||||||
|
with open(expected_init_path, 'w') as zope_init_file:
|
||||||
|
zope_init_file.write("")
|
||||||
|
print("Note: zope_interface.__init__.py not found. This is a known issue with that package."
|
||||||
|
"\nEvennia auto-created it at {}.".format(
|
||||||
|
expected_init_path))
|
||||||
|
|
||||||
# return True/False if error was reported or not
|
# return True/False if error was reported or not
|
||||||
return not error
|
return not error
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,14 @@ def loads(data):
|
||||||
return pickle.loads(data)
|
return pickle.loads(data)
|
||||||
|
|
||||||
|
|
||||||
|
def _get_logger():
|
||||||
|
"Delay import of logger until absolutely necessary"
|
||||||
|
global _LOGGER
|
||||||
|
if not _LOGGER:
|
||||||
|
from evennia.utils import logger as _LOGGER
|
||||||
|
return _LOGGER
|
||||||
|
|
||||||
|
|
||||||
@wraps
|
@wraps
|
||||||
def catch_traceback(func):
|
def catch_traceback(func):
|
||||||
"Helper decorator"
|
"Helper decorator"
|
||||||
|
|
@ -87,10 +95,7 @@ def catch_traceback(func):
|
||||||
try:
|
try:
|
||||||
func(*args, **kwargs)
|
func(*args, **kwargs)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
global _LOGGER
|
_get_logger().log_trace()
|
||||||
if not _LOGGER:
|
|
||||||
from evennia.utils import logger as _LOGGER
|
|
||||||
_LOGGER.log_trace()
|
|
||||||
raise # make sure the error is visible on the other side of the connection too
|
raise # make sure the error is visible on the other side of the connection too
|
||||||
print(err)
|
print(err)
|
||||||
return decorator
|
return decorator
|
||||||
|
|
@ -291,7 +296,7 @@ class AMPMultiConnectionProtocol(amp.AMP):
|
||||||
try:
|
try:
|
||||||
super(AMPMultiConnectionProtocol, self).dataReceived(data)
|
super(AMPMultiConnectionProtocol, self).dataReceived(data)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
_LOGGER.trace("Discarded incoming partial data: {}".format(to_str(data)))
|
_get_logger().log_trace("Discarded incoming partial data: {}".format(to_str(data)))
|
||||||
elif self.multibatches:
|
elif self.multibatches:
|
||||||
# invalid AMP, but we have a pending multi-batch that is not yet complete
|
# invalid AMP, but we have a pending multi-batch that is not yet complete
|
||||||
if data[-2:] == NULNUL:
|
if data[-2:] == NULNUL:
|
||||||
|
|
@ -300,7 +305,7 @@ class AMPMultiConnectionProtocol(amp.AMP):
|
||||||
try:
|
try:
|
||||||
super(AMPMultiConnectionProtocol, self).dataReceived(data)
|
super(AMPMultiConnectionProtocol, self).dataReceived(data)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
_LOGGER.trace("Discarded incoming multi-batch data:".format(to_str(data)))
|
_get_logger().log_trace("Discarded incoming multi-batch data:".format(to_str(data)))
|
||||||
else:
|
else:
|
||||||
# not an AMP communication, return warning
|
# not an AMP communication, return warning
|
||||||
self.transport.write(_HTTP_WARNING)
|
self.transport.write(_HTTP_WARNING)
|
||||||
|
|
@ -356,9 +361,6 @@ class AMPMultiConnectionProtocol(amp.AMP):
|
||||||
info (str): Error string.
|
info (str): Error string.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
global _LOGGER
|
|
||||||
if not _LOGGER:
|
|
||||||
from evennia.utils import logger as _LOGGER
|
|
||||||
e.trap(Exception)
|
e.trap(Exception)
|
||||||
_LOGGER.log_err("AMP Error for {info}: {trcbck} {err}".format(
|
_LOGGER.log_err("AMP Error for {info}: {trcbck} {err}".format(
|
||||||
info=info, trcbck=e.getTraceback(), err=e.getErrorMessage()))
|
info=info, trcbck=e.getTraceback(), err=e.getErrorMessage()))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue