Browse Source

Small fixes

pull/66/head
Ruud 14 years ago
parent
commit
168a9a2f95
  1. 2
      couchpotato/api/__init__.py
  2. 4
      couchpotato/core/plugins/userscript/static/userscript.js
  3. 4
      couchpotato/core/settings/__init__.py
  4. 4
      couchpotato/environment.py
  5. 4
      couchpotato/runner.py
  6. 7
      couchpotato/static/scripts/couchpotato.js

2
couchpotato/api/__init__.py

@ -4,7 +4,7 @@ from flask.blueprints import Blueprint
api = Blueprint('api', __name__)
def addApiView(route, func, static = False):
api.add_url_rule(route + ('' if static else '/'), endpoint = route if route else 'index', view_func = func)
api.add_url_rule(route + ('' if static else '/'), endpoint = route.replace('.', '_') if route else 'index', view_func = func)
""" Api view """
def index():

4
couchpotato/core/plugins/userscript/static/userscript.js

@ -99,8 +99,8 @@ window.addEvent('domready', function(){
});
window.addEvent('load', function(){
var your_version = $(document.body).get('data-userscript_version')
latest_version = App.getOption('userscript_version')
var your_version = $(document.body).get('data-userscript_version'),
latest_version = App.getOption('userscript_version') || '',
key = 'cp_version_check',
checked_already = Cookie.read(key);

4
couchpotato/core/settings/__init__.py

@ -54,11 +54,11 @@ class Settings():
def set(self, section, option, value):
return self.p.set(section, option, value)
def get(self, option = '', section = 'core', default = ''):
def get(self, option = '', section = 'core', default = '', type = None):
try:
try: type = self.types[section][option]
except: type = 'unicode'
except: type = 'unicode' if not type else type
if hasattr(self, 'get%s' % type.capitalize()):
return getattr(self, 'get%s' % type.capitalize())(section, option)

4
couchpotato/environment.py

@ -35,13 +35,13 @@ class Env(object):
return setattr(Env, '_' + attr, value)
@staticmethod
def setting(attr, section = 'core', value = None, default = ''):
def setting(attr, section = 'core', value = None, default = '', type = None):
s = Env.get('settings')
# Return setting
if value == None:
return s.get(attr, default = default, section = section)
return s.get(attr, default = default, section = section, type = type)
# Set setting
s.set(section, attr, value)

4
couchpotato/runner.py

@ -73,7 +73,7 @@ def runCouchPotato(options, base_path, args):
Env.set('options', options)
# Determine debug
debug = options.debug or Env.setting('debug', default = False)
debug = options.debug or Env.setting('debug', default = False, type = 'bool')
Env.set('debug', debug)
# Only run once when debugging
@ -146,7 +146,7 @@ def runCouchPotato(options, base_path, args):
from couchpotato import app
api_key = Env.setting('api_key')
url_base = '/' + Env.setting('url_base').lstrip('/') if Env.setting('url_base') else ''
reloader = debug and not options.daemonize
reloader = debug is True and not options.daemonize
# Basic config
app.secret_key = api_key

7
couchpotato/static/scripts/couchpotato.js

@ -32,7 +32,12 @@ var CouchPotato = new Class({
},
getOption: function(name){
return this.options[name];
try {
return this.options[name];
}
catch(e){
return null
}
},
pushState: function(e){

Loading…
Cancel
Save