Move config object to variables.py
- Initialized in main.py - This way the configuration is available for all modules
This commit is contained in:
10
util.py
10
util.py
@ -7,17 +7,15 @@ import variables as var
|
||||
import zipfile
|
||||
|
||||
def get_recursive_filelist_sorted(path):
|
||||
global __CONFIG
|
||||
|
||||
filelist = []
|
||||
for root, dirs, files in os.walk(path):
|
||||
relroot = root.replace(path, '')
|
||||
if relroot != '' and relroot in __CONFIG.get('bot', 'ignored_folders'):
|
||||
if relroot != '' and relroot in var.config.get('bot', 'ignored_folders'):
|
||||
continue
|
||||
if len(relroot):
|
||||
relroot += '/'
|
||||
for file in files:
|
||||
if file in __CONFIG.get('bot', 'ignored_files'):
|
||||
if file in var.config.get('bot', 'ignored_files'):
|
||||
continue
|
||||
|
||||
fullpath = os.path.join(path, relroot, file)
|
||||
@ -36,9 +34,7 @@ def get_recursive_filelist_sorted(path):
|
||||
# - hash is a sha1 of the string representation of the directories' contents (which are
|
||||
# zipped)
|
||||
def zipdir(zippath, zipname_prefix=None):
|
||||
global __CONFIG
|
||||
|
||||
zipname = __CONFIG.get('bot', 'tmp_folder')
|
||||
zipname = var.config.get('bot', 'tmp_folder')
|
||||
if zipname_prefix and '../' not in zipname_prefix:
|
||||
zipname += zipname_prefix.strip().replace('/', '_') + '_'
|
||||
|
||||
|
Reference in New Issue
Block a user