Roundup Tracker - Issues

Message8548

Author rouilj
Recipients rouilj, schlatterbeck
Date 2026-10-08.16:41:38
Message-id <1791477698.82.0.161317072662.issue2551433@roundup-tracker.org>
In-reply-to
Blech. ## marks my comments and are not in code.

In roundup/roundupdb.py generateChangeNote() we have this code:

          for key in oldvalues:
            ## [... ]
            # the old value might be non existent
            # this happens when property was added
            try:
                old_value = oldvalues[key]
                if isinstance(new_value, list):
                    new_value.sort()
                    old_value.sort()
                if new_value != old_value:
                    changed[key] = old_value
            except Exception:
                changed[key] = new_value

We have set() in hyperdb.py and a couple of other places where getprops
is iterated over
for a similar purpose. So I think this is valid.

Before the loop I have:

        props = cl.getprops(protected=0)

I think I can change:

          for key in oldvalues:

to

          for key in props:

and eliminate these statements inside the loop:

        if key in ('actor', 'activity', 'creator', 'creation'):
                continue
            # not all keys from oldvalues might be available in database
            # this happens when property was deleted
            try:
                new_value = cl.get(issueid, key)
            except KeyError:
                continue

since deleted and protected props won't be in props.

However I need to add the assignment of new_value to:

            # the old value might be non existent
            # this happens when property was added
            try:
                new_value = cl.get(issueid, key)  ## add this since key
is always a valid prop
                ## can raise KeyError
                old_value = oldvalues[key]
                if isinstance(new_value, list):
                    new_value.sort()
                    ## could be a non-list, but this would be a change
of type for the property
                    ## which is not allowed. However it could raise
ArttributeError
                    old_value.sort() 
                if new_value != old_value:
                    changed[key] = old_value
            except Exception:  ## change to (AttributeError, KeyError) 
                changed[key] = new_value

which should be safe since only props present in the db are being
iterated over.
It also cleans up a bare Exception handler.

Also nosymessage() used with note_filter(..., oldvalues) needs to be
audited by
the tracker admin and added to updating doc.

Ralf any thoughts?
History
Date User Action Args
2026-10-08 16:41:38rouiljsetmessageid: <1791477698.82.0.161317072662.issue2551433@roundup-tracker.org>
2026-10-08 16:41:38rouiljsetrecipients: + rouilj, schlatterbeck
2026-10-08 16:41:38rouiljlinkissue2551433 messages
2026-10-08 16:41:38rouiljcreate