Changeset 6980


Ignore:
Timestamp:
1 Nov 2011, 08:34:05 (13 years ago)
Author:
Henrik Bettermann
Message:

We have to create a real (deep) list copy of self.keys() when deleting items of self. Otherwise the deletion of some of the items might fail.

I have no idea how to write regression tests with justifiable expenditure.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/imagestorage.py

    r6528 r6980  
    5858        blobs that has to be called explicitly, for instance in tests.
    5959        """
    60         key_list = self.keys()
     60        key_list = list(self.keys())
    6161        for key in key_list:
    6262            item = self[key]
  • main/waeup.sirp/trunk/src/waeup/sirp/testing.py

    r6754 r6980  
    290290    if collector is None:
    291291        return
    292     keys = collector.keys()
     292    keys = list(collector.keys())
    293293    for key in keys:
    294294        del collector[key]
  • main/waeup.sirp/trunk/src/waeup/sirp/university/certificate.py

    r6839 r6980  
    4141        """Delete a course referrer denoted by its code.
    4242        """
    43         for key in self.keys():
     43        keys = list(self.keys()) # create list copy
     44        for key in keys:
    4445            if self[key].getCourseCode() != code:
    4546                continue
Note: See TracChangeset for help on using the changeset viewer.