thinkle / gourmet

Gourmet Recipe Manager
GNU General Public License v2.0
339 stars 138 forks source link

Issues with ingredients and importing #285

Open ockham opened 11 years ago

ockham commented 11 years ago

Converted from SourceForge issue 3084429, submitted by SourceForge user nobody on 2010-10-09 21:19:18 UTC.

Using gourmet 0.15.6 and sqlalchemy 0.6.4 there are a number of issues that are resolved by downgrading to sqlalchemy 0.6.3 - see below for the bug description

There are a few things that are acting strangely. First, when I try to import recipes from webpages, I no longer get the dialog box that allows me to select a picture for that recipe. To get the recipe to import, I have to close the recipe import window which causes the recipe to appear in the main gourmet window. This is not a big deal but is annoying.

However, once I look at the new recipe, there are no ingredients listed even though there were some tagged as such when I imported it. I can add ingredients to the recipe, but Gourmet won't let me save those changes.

Reproducible: Always

Here is what happens when I try to add an ingredient and saver

AttributeError: 'NoneType' object has no attribute 'lastrowid' parse_ingredient: conv argument is now ignored Problem adding {'inggroup': None, 'deleted': False, 'item': u'kidney beans', 'amount': 1.0, 'recipe_id': 248, 'position': 9, 'ingkey': u'kidney beans', 'optional': False, 'unit': u'can'} Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/gourmet/reccard.py", line 1021, in save_cb newdict = m.save(newdict) File "/usr/lib/python2.6/site-packages/gourmet/reccard.py", line 1222, in save self.ingtree_ui.ingController.commit_ingredients() File "/usr/lib/python2.6/site-packages/gourmet/reccard.py", line 2120, in commit_ingredients n = commit_iter(iter,n) File "/usr/lib/python2.6/site-packages/gourmet/reccard.py", line 2111, in commit_iter self.commited_items_converter[ing] = self.rg.rd.add_ing_and_update_keydic(d) File "/usr/lib/python2.6/site-packages/gourmet/backends/db.py", line 1198, in add_ing_and_update_keydic return self.add_ing(dic) File "/usr/lib/python2.6/site-packages/gourmet/backends/db.py", line 1203, in add_ing return self.do_add_ing(dic) File "/usr/lib/python2.6/site-packages/gourmet/backends/db.py", line 1281, in do_add_ing return self.do_add_and_return_item(self.ingredients_table,dic,id_prop='id') File "/usr/lib/python2.6/site-packages/gourmet/backends/db.py", line 1277, in do_add_and_return_item select = table.select(getattr(table.c,id_prop)==result_proxy.lastrowid) File "/usr/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 2310, in lastrowid return self.cursor.lastrowid AttributeError: 'NoneType' object has no attribute 'lastrowid'

ockham commented 11 years ago

Submitted by SourceForge user thomas_hinkle on 2010-10-10 13:52:58 UTC.

Yeah, the advantage of moving to sqlalchemy was that now we use a widely adoped library for our interface with the database and take advantage of all that work.

The disadvantage is that sqlalchemy keeps making API-breaking updates that are rather hard to keep up with.