add modul. "help"; prep "save"; add {desc}

This commit is contained in:
urlbot
2014-09-27 16:06:26 +02:00
parent e721c328f7
commit 951054aff5
3 changed files with 86 additions and 22 deletions

View File

@@ -5,7 +5,8 @@ if '__main__' == __name__:
print '''this is a library file, which is not meant to be executed'''
exit(-1)
import sys, os, time
import sys, os, time, pickle
from local_config import conf
RATE_GLOBAL = 0x01
RATE_NO_SILENCE = 0x02
@@ -43,6 +44,15 @@ def logger(severity, message):
args = (sys.argv[0], time.strftime('%Y-%m-%d.%H:%M:%S'), severity, message)
sys.stderr.write(e('%s %s %s: %s' % args) + '\n')
def conf_save(obj):
with open(conf('persistent_storage'), 'wb') as fd:
return pickle.dump(obj, fd)
def conf_load():
with open(conf('persistent_storage'), 'rb') as fd:
fd.seek(0)
return pickle.load(fd)
def get_version_git():
import subprocess