Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Knupp committed Feb 6, 2014
1 parent 899eab1 commit 28f6942
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions sandman/model/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,9 @@ def activate(admin=True, browser=True, name='admin', reflect_all=False):
"""
with app.app_context():
generate_pks = current_app.config.get('SANDMAN_GENERATE_PKS', None) or False
if getattr(current_app, 'class_references', None) is None:
current_app.class_references = {}
generate_endpoint_classes(db, generate_pks)
elif reflect_all:
generate_pks = app.config.get('SANDMAN_GENERATE_PKS', None) or False
if getattr(app, 'class_references', None) is None or reflect_all:
app.class_references = {}
generate_endpoint_classes(db, generate_pks)
else:
Model.prepare(db.engine)
Expand Down
Binary file modified tests/data/foreign_key
Binary file not shown.
1 change: 0 additions & 1 deletion tests/foreign_key_models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Test that foreign keys with non-trivial keys are properly ignored."""
from sandman import app
from sandman.model import activate

activate(admin=False, browser=False, reflect_all=True)
2 changes: 1 addition & 1 deletion tests/test_foreign_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def setup_method(self, _):
self.DB_LOCATION)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////' + self.DB_LOCATION
app.config['SANDMAN_SHOW_PKS'] = False
app.config['SANDMAN_GENERATE_PKS'] = False
app.config['SANDMAN_GENERATE_PKS'] = True
app.config['TESTING'] = True
self.app = app.test_client()
# pylint: disable=unused-variable
Expand Down

0 comments on commit 28f6942

Please sign in to comment.