Permalink
Browse files

Coerce configuration flags from string to bool.

  • Loading branch information...
thruflo committed May 3, 2012
1 parent fff85b9 commit 2ea53b4515aa84a9026a37abdfb6b7b95bc14d92
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/pyramid_basemodel/__init__.py
@@ -32,6 +32,7 @@ class and ``bind_engine`` function.
from sqlalchemy import Column, DateTime, Integer
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
+from pyramid.settings import asbool
from zope.sqlalchemy import ZopeTransactionExtension
Session = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
@@ -158,7 +159,7 @@ def includeme(config):
# Bind the engine.
settings = config.registry.settings
engine = engine_from_config(settings, 'sqlalchemy.')
- should_create = settings.get('basemodel.should_create_all', True)
- should_drop = settings.get('basemodel.should_drop_all', False)
+ should_create = asbool(settings.get('basemodel.should_create_all', True))
+ should_drop = asbool(settings.get('basemodel.should_drop_all', False))
bind_engine(engine, should_create=should_create, should_drop=should_drop)

0 comments on commit 2ea53b4

Please sign in to comment.