mirror of https://github.com/evilhero/mylar
FIX: Ultron Error-Checker could not find exceptions file if not in root, IMP: will copy the _sample.csv now on startup if not present for use with UE-C
This commit is contained in:
parent
45e42bea2c
commit
00fb374a59
|
@ -22,6 +22,7 @@ import webbrowser
|
|||
import sqlite3
|
||||
import itertools
|
||||
import csv
|
||||
import shutil
|
||||
|
||||
from lib.apscheduler.scheduler import Scheduler
|
||||
from lib.configobj import ConfigObj
|
||||
|
@ -698,7 +699,12 @@ def csv_load():
|
|||
csvfile = open(str(EXCEPTIONS_FILE), "rb")
|
||||
except (OSError,IOError):
|
||||
if i == 1:
|
||||
logger.error("No Custom Exceptions found. Using base exceptions only.")
|
||||
logger.info("No Custom Exceptions found - Using base exceptions only. Creating blank custom_exceptions for your personal use.")
|
||||
try:
|
||||
shutil.copy(os.path.join(DATA_DIR,"custom_exceptions_sample.csv"), EXCEPTIONS_FILE)
|
||||
except (OSError,IOError):
|
||||
logger.error("Cannot create custom_exceptions.csv in " + str(DATA_DIR) + ". Make sure _sample.csv is present and/or check permissions.")
|
||||
return
|
||||
else:
|
||||
logger.error("Could not locate " + str(EXCEPTIONS[i]) + " file. Make sure it's in datadir: " + DATA_DIR)
|
||||
break
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mylar. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import with_statement
|
||||
|
||||
import os
|
||||
import cherrypy
|
||||
import datetime
|
||||
|
@ -177,9 +179,17 @@ class WebInterface(object):
|
|||
#99, (comicid), (gcdid), none
|
||||
logger.info("saving new information into custom_exceptions.csv...")
|
||||
except_info = "none #" + str(comicname) + "-(" + str(comicyear) + ")"
|
||||
with open('custom_exceptions.csv', 'a') as f:
|
||||
except_file = os.path.join(mylar.DATA_DIR,"custom_exceptions.csv")
|
||||
if not os.path.exists(except_file):
|
||||
try:
|
||||
csvfile = open(str(except_file), 'rb')
|
||||
csvfile.close()
|
||||
except (OSError,IOError):
|
||||
logger.error("Could not locate " + str(except_file) + " file. Make sure it's in datadir: " + mylar.DATA_DIR + " with proper permissions.")
|
||||
return
|
||||
|
||||
with open(str(except_file), 'a') as f:
|
||||
f.write('%s,%s,%s,%s\n' % ("99", str(comicid), str(gcdid), str(except_info)) )
|
||||
|
||||
logger.info("re-loading csv file so it's all nice and current.")
|
||||
mylar.csv_load()
|
||||
|
||||
|
|
Loading…
Reference in New Issue