If the only dict behavior you need is accessing elements with [], another approach is that you could implement __getitem__ in your model but not inherit from dict.
On Sat, Mar 29, 2008 at 3:08 PM, Mike Bernson <[EMAIL PROTECTED]> wrote: > > I am trying to use models that inherit from dict. > > The models use attribute access for the sqlachemy attributes and dict style > access for gui stuff. > This allow me to do things like model[column_name].editable for gui to see > if item should be grayed > out and model.column_name for access the column value. > > I am getting 'TypeError: dict objects are unhashable' so I created a > __hash__ method as that is > def __hash__(self): > return id(self) > > Will this cause me other problem with Sqlalchemy. > > I can not use the primary key as the has because it may not alway exist. > Some primary keys are auto increment. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
