Mercurial > p > roundup > code
comparison roundup/hyperdb.py @ 6228:f40c6b5de370
Fix reverse multilink iteration
Adding a reverse multilink to *the same class* would trigger a traceback
about a modified dictionary on iteration
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Wed, 15 Jul 2020 13:28:58 +0200 |
| parents | bb198596f85c |
| children | 6834bb5473da |
comparison
equal
deleted
inserted
replaced
| 6227:5105df69145d | 6228:f40c6b5de370 |
|---|---|
| 873 at least during regression testing. | 873 at least during regression testing. |
| 874 """ | 874 """ |
| 875 done = getattr(self, 'post_init_done', None) | 875 done = getattr(self, 'post_init_done', None) |
| 876 for cn in self.getclasses(): | 876 for cn in self.getclasses(): |
| 877 cl = self.getclass(cn) | 877 cl = self.getclass(cn) |
| 878 for p in cl.properties: | 878 # This will change properties if a back-multilink happens to |
| 879 # have the same class, so we need to iterate over .keys() | |
| 880 for p in cl.properties.keys(): | |
| 879 prop = cl.properties[p] | 881 prop = cl.properties[p] |
| 880 if not isinstance (prop, (Link, Multilink)): | 882 if not isinstance (prop, (Link, Multilink)): |
| 881 continue | 883 continue |
| 882 if prop.rev_multilink: | 884 if prop.rev_multilink: |
| 883 linkcls = self.getclass(prop.classname) | 885 linkcls = self.getclass(prop.classname) |
