Hi, I've been trying on the new futures of composite classes of SQLAlchemy 0.7, and I don't have any problems with the read-only default mapping. However, just when I inherit from MutableComposite I start to get an AttributeError exception when I set the value to None (AttributeError: type object 'MutableComposite' has no attribute 'coerce' in /sqlalchemy/ext/mutable.py", line 386, in set). I am running SQLAlchemy version 0.7.1. My mapping and classes are the following:
class ContactInformation(object): # this gets changed to MutableComposite def __init__(self, *args, **kwargs): props = ['home_page', 'phone', 'fax', 'nextel'] if len(args) > 0: for i in range(len(args)): kwargs[props[i]] = args[i] self.home_page = kwargs.get('home_page', None) self.phone = kwargs.get('phone', None) self.fax = kwargs.get('fax', None) self.nextel = kwargs.get('nextel', None) def __composite_values__(self): return self.home_page, self.phone, self.fax, self.nextel def __setattr__(self, name, value): object.__setattr__(self, name, value) # the following line gets uncommented when changed to MutableComposite #self.changed() def __eq__(self, other): return other is not None and \ str(self.home_page) == str(other.home_page) and \ self.phone == other.phone and \ self.fax == other.fax and \ self.nextel == other.nextel def __ne__(self, other): return not self.__eq__(other) user = Table( 'User', metadata, Column('ID', UUID(as_uuid=True), primary_key=True), Column('HomePage', String(300), nullable=True), Column('Telephone', String(30), nullable=True), Column('Fax', String(30), nullable=True), Column('Nextel', String(30), nullable=True) ) class User(object): def __init__(self, contact): self.id = uuid.uuid1() self.contact = contact # If I remove the properties and synonym the error is still there @property def contact(self): return self._contact @contact.setter def contact(self, value): # Right in this line the error is raised when is set to None self._contact = value orm.mapper(User, user, properties={ 'id': user.c.ID, '_contact': orm.composite(ContactInformation, user.c.HomePage, user.c.Telephone, user.c.Fax, user.c.Nextel), # I get the error with or without the synonym 'contact': orm.synonym('_contact') }) I've simplified the real classes, but the error remains. Anyone has an idea if I'm doing something wrong? Thanks -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy/-/gL7nOW3E6eYJ. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.