Skip to content

RecordType.update() adds unwanted subproperties

Summary

When updating a RecordType that already has a reference to another RecordType with properties of its own, these properties are added as subproperties in the referencing RecordType.

Expected Behavior

The update should not change the existing properties. Also a reference to another RecordType should never add the referenced RecordType's properties as subproperties to the referencing RecordType.

Actual Behavior

Subproperties are added to existing reference properties.

Steps to Reproduce the Problem

import linkahead as db
rt1 = db.RecordType(name="TestType1")
rt2 = db.RecordType(name="TestType2")
prop1 = db.Property(name="TestProp", datatype=db.TEXT)
rt2.add_property(prop1)
rt1.add_property(prop2)
db.Container().extend([rt1,rt2,prop1]).insert()

Everything is ok:

grafik

rt1_retrieved = db.RecordType(id=rt1.id).retrieve()  # Probably not necessary, but retrieve freshly from server
new_prop = db.Property(name="TestPropNew", datatype=db.INTEGER).insert()
rt1_retrieved.add_property(new_prop)  # Still ok here, no subproperties
rt1_retrieved.update()

After update, the TestType2 property of TestType1 has subproperties:

grafik

This does not happen when doing this via, e.g., the webinterface

Specifications

  • Version: LinkAhead 0.13.0, Pylib 0.14.1-dev (current dev branch). This does not happen with the currently released version 0.14.0
  • Platform: Python 3.12
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information