소스 검색

Merge branch 'develop' into feature/wikitools-core

tags/v0.1^2
Ben Kurtovic 13 년 전
부모
커밋
7639b76d1c
2개의 변경된 파일14개의 추가작업 그리고 3개의 파일을 삭제
  1. +3
    -0
      .gitignore
  2. +11
    -3
      core/config.py

+ 3
- 0
.gitignore 파일 보기

@@ -4,6 +4,9 @@
# Ignore bot-specific config file:
config.json

# Ignore OS X's crud:
*.DS_Store

# Ignore pydev's nonsense:
.project
.pydevproject


+ 11
- 3
core/config.py 파일 보기

@@ -13,7 +13,8 @@ from within config's three global variables and one function:
* config.components - a list of enabled components
* config.wiki - a dict of config information for wiki-editing
* config.irc - a dict of config information for IRC
* config.schedule() - returns a list of tasks scheduled to run now
* config.schedule() - returns a list of tasks scheduled to run at a given
time
"""

import json
@@ -30,6 +31,13 @@ _config = None # holds data loaded from our config file
# set our three easy-config-access global variables to None
components, wiki, irc = (None, None, None)

def is_config_loaded():
"""Return True if our config file has already been loaded, and False if it
hasn't."""
if _config is not None:
return True
return False

def load_config():
"""Load data from our JSON config file (config.json) into _config."""
global _config
@@ -58,7 +66,7 @@ def verify_config():
if choice.lower().startswith("y"):
return make_new_config()
else:
exit()
exit(1)

def parse_config(key):
"""Store data from our config file in three global variables for easy
@@ -120,7 +128,7 @@ def schedule(minute, hour, month_day, month, week_day):
try:
data = _config["schedule"]
except KeyError:
data = []
return [] # nothing is in our schedule
for event in data:
do = True
for key, value in now.items():


불러오는 중...
취소
저장