Towards an DbEngine, for a variety of reasons

svn: r14035
This commit is contained in:
Doug Blank
2010-01-11 19:45:17 +00:00
parent f15f18056b
commit bdefba55ca
2 changed files with 162 additions and 20 deletions

View File

@@ -115,11 +115,12 @@ class Gramplet(object):
def get_active_object(self, nav_type):
"""
Return the object of the active object for the given navigation type.
Return the object of the active handle for the given navigation type.
Assumes nav_type is one of the codes of Db.get_by_name.
"""
handle = self.uistate.get_active(nav_type, self.nav_group)
if handle:
return getattr(self.dbstate.db, "get_%s_from_handle" % nav_type.lower())(handle)
if nav_type in self.dbstate.db.engine and handle:
return self.dbstate.db.engine[nav_type].get(handle=handle)
def set_active(self, nav_type, handle):
"""