Fixed up the setup-app procedure to bypass pulling a theme.

This commit is contained in:
Raoul Snyman 2010-01-18 22:04:49 +02:00
parent df8bd84520
commit f85297a5d2
2 changed files with 10 additions and 9 deletions

View File

@ -20,12 +20,12 @@ def load_environment(global_conf, app_conf):
engine = engine_from_config(app_conf, 'sqlalchemy.') engine = engine_from_config(app_conf, 'sqlalchemy.')
init_model(engine) init_model(engine)
# Pull out theme variable theme_name = None
theme = Session.query(Variable).get(u'theme') if not app_conf.get('setup-app'):
if theme: # Pull out theme variable
theme_name = theme.value theme = Session.query(Variable).get(u'theme')
else: if theme:
theme_name = None theme_name = theme.value
# Set up Pylons paths # Set up Pylons paths
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

View File

@ -32,6 +32,7 @@ log = logging.getLogger(__name__)
def setup_app(command, conf, vars): def setup_app(command, conf, vars):
"""Place any commands to setup scribeengine here""" """Place any commands to setup scribeengine here"""
conf.local_conf['setup-app'] = True
load_environment(conf.global_conf, conf.local_conf) load_environment(conf.global_conf, conf.local_conf)
import hashlib import hashlib
@ -56,10 +57,10 @@ def setup_app(command, conf, vars):
role_admin = Role(name=u'Administrator') role_admin = Role(name=u'Administrator')
role_admin.permissions.extend([perm_addposts, perm_editmyposts, perm_delmyposts]) role_admin.permissions.extend([perm_addposts, perm_editmyposts, perm_delmyposts])
password = unicode(hmac.new(conf[u'security.salt'], u'omigosh', password = unicode(hmac.new(conf[u'security.salt'], u'password',
hashlib.sha256).hexdigest(), u'utf-8') hashlib.sha256).hexdigest(), u'utf-8')
user = User(email=u'raoul.snyman@saturnlaboratories.co.za', user = User(email=u'admin@scribeengine.org',
password=password, nick=u'raoul') password=password, nick=u'admin')
user.roles.append(role_admin) user.roles.append(role_admin)
Session.add_all([blog_title, blog_slogan, user]) Session.add_all([blog_title, blog_slogan, user])