[billreminder] First cut at handling new relationship between Bill and Category



commit 060b9cf9dc7883704ee972063944cb45178401bc
Author: Og B. Maciel <ogmaciel gnome org>
Date:   Thu Nov 26 18:23:40 2009 -0500

    First cut at handling new relationship between Bill and Category

 src/lib/dal.py |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/lib/dal.py b/src/lib/dal.py
index 9d90e19..eb46da3 100644
--- a/src/lib/dal.py
+++ b/src/lib/dal.py
@@ -45,10 +45,9 @@ class DAL(object):
                     bill.notes = dbobject.notes
                     bill.paid = dbobject.paid
                     if dbobject.category:
-                        bill.category = []
                         try:
-                            category = session.query(Category).filter_by(name=dbobject.category[0].name).one()
-                            bill.category.append(category)
+                            category = session.query(Category).filter_by(name=dbobject.category.name).one()
+                            bill.category = category
                         except Exception, e:
                             print "Failed to retrieve category \"%s\" for bill \"%s\": %s" \
                                 % (dbobject.name, dbobject.category[0].name, str(e))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]