diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-03-07 23:09:02 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-03-07 23:09:02 +0000 |
| commit | 1a6e9e316162caeba171735372b32982bc2ede43 (patch) | |
| tree | 8610c39c74b15212cb7a957d043c16e3e7e12abd | |
| parent | 9ccc37802589656907c6608eb6e008dbe9bcf075 (diff) | |
| download | pyramid-1a6e9e316162caeba171735372b32982bc2ede43.tar.gz pyramid-1a6e9e316162caeba171735372b32982bc2ede43.tar.bz2 pyramid-1a6e9e316162caeba171735372b32982bc2ede43.zip | |
- The ``__name__`` value assigned to the returned object in the
``bfg_alchemy`` application template's ``MyApp`` model was an
integer. This was incorrect. It is now a string.
| -rw-r--r-- | CHANGES.txt | 16 | ||||
| -rwxr-xr-x | repoze/bfg/paster_templates/alchemy/+package+/models.py | 6 |
2 files changed, 17 insertions, 5 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 5b43d7292..fd02f07ea 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,16 @@ +Next release +============ + +Bug Fixes +--------- + +- Defer conditional import of IPython to avoid breakage under mod_wsgi. + http://bugs.repoze.org/issue138 + +- The ``__name__`` value assigned to the returned object in the + ``bfg_alchemy`` application template's ``MyApp`` model was an + integer. This was incorrect. It is now a string. + 1.2 (2010-02-10) ================ @@ -17,9 +30,6 @@ Backwards Incompatibilities Bug Fixes --------- -- Defer conditional import of IPython to avoid breakage under mod_wsgi. - http://bugs.repoze.org/issue138 - - More correct conversion of provided ``renderer`` values to resource specification values (internal). diff --git a/repoze/bfg/paster_templates/alchemy/+package+/models.py b/repoze/bfg/paster_templates/alchemy/+package+/models.py index c3b1eda02..7d973c628 100755 --- a/repoze/bfg/paster_templates/alchemy/+package+/models.py +++ b/repoze/bfg/paster_templates/alchemy/+package+/models.py @@ -35,10 +35,12 @@ class MyApp(object): def __getitem__(self, key): session= DBSession() try: - key = int(key) + id = int(key) except (ValueError, TypeError): raise KeyError(key) - query = session.query(MyModel).filter_by(id=key) + + query = session.query(MyModel).filter_by(id=id) + try: item = query.one() item.__parent__ = self |
