1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 08:17:13 +03:00

Rewrite '.' in plugin name as '_'

Fixes #254
This commit is contained in:
Jonathan Harris 2017-10-16 14:40:19 +01:00
parent bb839eafd2
commit 190d9c6bd3

View File

@ -39,9 +39,9 @@ class Plugin(object):
self.module = None # None for disabled plugins.
if loadfile:
sys.stdout.write(('loading plugin %s from "%s"\n' % (name, loadfile)).encode('utf-8'))
sys.stdout.write(('loading plugin %s from "%s"\n' % (name.replace('.', '_'), loadfile)).encode('utf-8'))
with open(loadfile, 'rb') as plugfile:
module = imp.load_module('plugin_%s' % name.encode('ascii', 'replace'), plugfile, loadfile.encode(sys.getfilesystemencoding()),
module = imp.load_module('plugin_%s' % name.encode('ascii', 'replace').replace('.', '_'), plugfile, loadfile.encode(sys.getfilesystemencoding()),
('.py', 'r', imp.PY_SOURCE))
newname = module.plugin_start()
self.name = newname and unicode(newname) or name