Skip to content

Commit

Permalink
Merge branch 'master' of github.com:pajlada/pajbot
Browse files Browse the repository at this point in the history
  • Loading branch information
pajlada committed Sep 19, 2016
2 parents 6ab4d91 + f7a49f4 commit 2cf0d98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 8 additions & 4 deletions pajbot/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,15 @@ def sql_save(self, save_to_db=True):
if not self.model_loaded:
return

if save_to_db and not self.shared_db_session:
with DBManager.create_session_scope(expire_on_commit=False) as db_session:
db_session.add(self.user_model)
try:
if save_to_db and not self.shared_db_session:
with DBManager.create_session_scope(expire_on_commit=False) as db_session:
# log.debug('Calling db_session.add on {}'.format(self.user_model))
db_session.add(self.user_model)

UserSQLCache.save(self.user_model)
UserSQLCache.save(self.user_model)
except:
log.exception('Caught exception in sql_save while saving {}'.format(self.user_model))

@property
def id(self):
Expand Down
6 changes: 4 additions & 2 deletions pajbot/web/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def init(args):

log = logging.getLogger(__name__)

log.info('XD')

config = configparser.ConfigParser()

config = load_config(args.config)
Expand All @@ -50,6 +48,10 @@ def init(args):
salt = generate_random_salt()
config.set('web', 'pleblist_password_salt', salt.decode('utf-8'))

if 'pleblist_password' not in config['web']:
salt = generate_random_salt()
config.set('web', 'pleblist_password', salt.decode('utf-8'))

if 'secret_key' not in config['web']:
salt = generate_random_salt()
config.set('web', 'secret_key', salt.decode('utf-8'))
Expand Down

0 comments on commit 2cf0d98

Please sign in to comment.