First load failed to start app

This commit is contained in:
Ruud committed 2012-01-08 23:17:39 +01:00
1 parent 7a49beb505
commit d89f2207b9
3 files changed
+18 -12

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@ class Desktop(Plugin):
if not Env.get('binary_port'): if not Env.get('binary_port'):
return return
addEvent('app.load', self.settingsToDesktop) addEvent('app.load', self.settingsToDesktop, priority = 2)
def settingsToDesktop(self): def settingsToDesktop(self):
+3 -3
View File
@@ -27,7 +27,7 @@ class StatusPlugin(Plugin):
addEvent('status.get', self.add) # Alias for .add addEvent('status.get', self.add) # Alias for .add
addEvent('status.get_by_id', self.getById) addEvent('status.get_by_id', self.getById)
addEvent('status.all', self.all) addEvent('status.all', self.all)
addEvent('app.load', self.fill) addEvent('app.initialize', self.fill)
addApiView('status.list', self.list) addApiView('status.list', self.list)
@@ -64,7 +64,7 @@ class StatusPlugin(Plugin):
if not s: if not s:
s = Status( s = Status(
identifier = identifier, identifier = identifier,
label = identifier.capitalize() label = toUnicode(identifier.capitalize())
) )
db.add(s) db.add(s)
db.commit() db.commit()
@@ -87,6 +87,6 @@ class StatusPlugin(Plugin):
) )
db.add(s) db.add(s)
s.label = label s.label = toUnicode(label)
db.commit() db.commit()
+14 -8
View File
@@ -3,7 +3,7 @@ from couchpotato.api import addApiView
from couchpotato.core.event import addEvent, fireEvent from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.helpers.encoding import isInt, toUnicode from couchpotato.core.helpers.encoding import isInt, toUnicode
from couchpotato.core.helpers.request import getParams, jsonified from couchpotato.core.helpers.request import getParams, jsonified
from couchpotato.core.helpers.variable import mergeDicts from couchpotato.core.helpers.variable import mergeDicts, tryInt
import ConfigParser import ConfigParser
import os.path import os.path
import time import time
@@ -19,11 +19,11 @@ class Settings():
addApiView('settings', self.view) addApiView('settings', self.view)
addApiView('settings.save', self.saveView) addApiView('settings.save', self.saveView)
def setFile(self, file): def setFile(self, config_file):
self.file = file self.file = config_file
self.p = ConfigParser.RawConfigParser() self.p = ConfigParser.RawConfigParser()
self.p.read(file) self.p.read(config_file)
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
self.log = CPLog(__name__) self.log = CPLog(__name__)
@@ -70,17 +70,23 @@ class Settings():
return default return default
def getEnabler(self, section, option): def getEnabler(self, section, option):
return self.p.getboolean(section, option) return self.getBool(section, option)
def getBool(self, section, option): def getBool(self, section, option):
return self.p.getboolean(section, option) try:
return self.p.getboolean(section, option)
except:
return self.p.get(section, option)
def getInt(self, section, option): def getInt(self, section, option):
return self.p.getint(section, option) try:
return self.p.getint(section, option)
except:
return tryInt(self.p.get(section, option))
def getUnicode(self, section, option): def getUnicode(self, section, option):
value = self.p.get(section, option) value = self.p.get(section, option)
return toUnicode(value.strip()) return toUnicode(value).strip()
def getValues(self): def getValues(self):
values = {} values = {}