unique objects

Brent Pinkney brent at zamail.co.za
Thu Aug 9 07:55:54 UTC 2007


Hi,

> My guess is you want to display an error if someone tries to add a new
> ULUser with the same #login as another.  So using a Set or MagmaSet
> might not report that a duplicate was attempting to be added, just
> quietly ignore the add, leaving the registering user thinking they
> were successful.

This is not correct: MagmaSet>>#add: will signal a 
MagmaDuplicateObjectInCollection notification when an attempt to add 
duplicate object.

Try:
	[ users add: aUser ]
		on: MagmaDuplicateObjectInCollection
		do: [ self inform: 'user already exists ].

Cheers

Brent


More information about the Magma mailing list