Menu ▾ ▴

#1 Nucular.describe returns non-existing Entry instances

open
nobody
None
1
2007-11-27
2007-11-23
wu wei
No

Nucular.describe doesn't return None for missing identity strings, but creates an Entry with the supplied identity name. A test around the descr creation is the quickest fix:

def describe(self, identity):
"extract entry description for id (return None if missing)"
from types import TupleType
descr = {}
index = self.Description.getExistingBaseIndex()
fromKey = (identity,)
toKey = (identity, pquery.MAXIMUMOBJECT)
D = index.rangeDict(fromKey, toKey)
# "for", identity, "got", D
if D:
for k in D:
(idt, att, val) = k
attL = descr.get(att)
if attL is None:
attL = descr[att] = []
if type(val) is TupleType:
# special
#pr "*** describing special", val
(flagname, text) = val
specialval = self.specialValue(flagname, text)
val = specialval
attL.append(val)
result = entry.Entry(identity, descr)
else:
result = None
return result

Discussion

  • Nobody/Anonymous

    Logged In: NO

    This is not necessarily a bug. Maybe it could be an optional behaviour

     
  • Aaron Watters

    Aaron Watters - 2007-11-27
    • priority: 5 --> 1
     

Log in to post a comment.