def __getitem__(self, name): composite = aq_parent(aq_inner(self)) slots = composite.filled_slots try: return slots[name] except (KeyError, AttributeError): # Generate a new slot. s = Slot(name) if composite._v_generating: # Persist the slot immediately. slots._setObject(s.getId(), s) else: # Persist automatically if the slot changes jar = AddOnChangeJar(slots) s._p_jar = jar return s.__of__(slots)