diff options
author | olly <olly@ollycope.com> | 2013-09-17 09:51:37 +0000 |
---|---|---|
committer | olly <olly@ollycope.com> | 2013-09-17 09:51:37 +0000 |
commit | edf5778a7e46025c074c1cb3d67193da5099d65d (patch) | |
tree | 1ce3feb85e3ab2daef8d79e7d4cc537ae84953b2 | |
parent | f916f4dfc2e93ab0df0b90f67773d10a42dd9919 (diff) | |
download | yoyo-edf5778a7e46025c074c1cb3d67193da5099d65d.tar.gz |
Revert to 2-argument form of exec, fixes #1
This reverts to the 2-argument form of exec used in earlier versions, fixing
the issue with functions in migration scripts not having access to their parent
namespace.
This also uses exec instead of eval in py3, which I think may originally have
been a typo in the compat.py module
-rw-r--r-- | yoyo/__init__.py | 2 | ||||
-rw-r--r-- | yoyo/compat.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/yoyo/__init__.py b/yoyo/__init__.py index bd9f191..7b43b49 100644 --- a/yoyo/__init__.py +++ b/yoyo/__init__.py @@ -321,7 +321,7 @@ def read_migrations(conn, paramstyle, directory, names=None, ns = {'step': step, 'transaction': transaction} try: - exec_(migration_code, globals(), ns) + exec_(migration_code, ns) except Exception: logger.exception("Could not import migration from %r", path) continue diff --git a/yoyo/compat.py b/yoyo/compat.py index 57156f0..56346c9 100644 --- a/yoyo/compat.py +++ b/yoyo/compat.py @@ -16,8 +16,8 @@ else: if PY2: - exec('def exec_(code, globals_, locals_):\n ' - 'exec code in globals_, locals_') + exec('def exec_(code, globals_):\n ' + 'exec code in globals_') else: - def exec_(code, globals_, locals_): - eval(code, globals_, locals_) + def exec_(code, globals_): + exec(code, globals_) |