Roundup Tracker - Issues

Issue 564271

classification
find() and new properties
Type: Severity: normal
Components: Database Versions:
process
Status: closed fixed
:
: richard : pohly, richard
Priority: normal :

Created on 2002-06-04 08:46 by pohly, last changed 2002-06-11 06:51 by richard.

Messages
msg246 Author: [hidden] (pohly) Date: 2002-06-04 08:46
I have extended my database scheme to include a new
multilink property, then I used Class.find() to search for
nodes that linked to a certain node.

This did not work because not all nodes have this valid
property:

        # ok, now do the find
        cldb = self.db.getclassdb(self.classname)
        l = []
        for id in self.db.getnodeids(self.classname, cldb):
            node = self.db.getnode(self.classname, id,
cldb)
            if node.has_key(self.db.RETIRED_FLAG):
                continue
            for propname, nodeid in propspec:
                 property = node[propname]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
=>   File
"/Projects/psp/roundup/roundup-0.4.1/lib/python2.1/site-packages/roundup/hyperdb.py",
line 752, in find
    property = node[propname]
KeyError: product

I replaced the marked line with

                try:
                    property = node[propname]
                except KeyError:
                    # old node without this property
                    continue
msg247 Author: [hidden] (richard) Date: 2002-06-11 06:51
Logged In: YES 
user_id=6405

Fixed, thanks. 
 
History
Date User Action Args
2002-06-04 08:46:45pohlycreate