1
0
mirror of http://aero2k.de/t/repos/urlbot-native.git synced 2017-09-06 15:25:38 +02:00

introduce configobj as configuration backend

This commit is contained in:
Thorsten
2015-12-20 12:36:08 +01:00
parent 9c3f7dae0f
commit c29ce94a3d
8 changed files with 153 additions and 77 deletions

View File

@@ -9,7 +9,7 @@ import sys
import time
import urllib.request
from collections import namedtuple
from local_config import conf
import config
RATE_NO_LIMIT = 0x00
RATE_GLOBAL = 0x01
@@ -27,12 +27,12 @@ USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:31.0) ' \
def conf_save(obj):
with open(conf('persistent_storage'), 'wb') as config_file:
with open(config.get('persistent_storage'), 'wb') as config_file:
return pickle.dump(obj, config_file)
def conf_load():
path = conf('persistent_storage')
path = config.get('persistent_storage')
if os.path.isfile(path):
with open(path, 'rb') as fd:
fd.seek(0)