Nevermind. I see what I was doing. In much of my code it worked fine, just like a dictionary.
But in another part of my code I do: for i in self.attrs: ...blah which works like a list. I remember when I saw the __iter__ implementation requirement noting that that may be confusing. Anyway, thanks for the help. -Ron On Jun 12, 2:22 pm, Ron <[EMAIL PROTECTED]> wrote: > > The association proxy will take care of Attribute construction for > > you, so you can get away with just: > > > class AttributeDictNEW(dict): > > def append(self, item): > > self[item.key] = item > > def __iter__(self): > > return self.itervalues() > > So now I if I try to get something from the dict: > > obj.attr['foo'] > > I get this error: > > KeyError: <schema.Attribute object at 0xb78a8e0c> > > ok, so it looks like something is turning 'foo' into an Attribute. > Fine, so I add this to the AttributeDictNEW: > > def __getitem__(self, item): > return super(AttributeDictNEW, self).__getitem__(item.name) > > But I get: > > return super(AttributeDictNEW, self).__getitem__(item.name) > AttributeError: 'str' object has no attribute 'name' > > if I do a sys.stderr.write(str(type(item))) before the return it > outputs this: > > <class 'schema.Attribute'> > > item is an Attribute, but the error indicates it's a str that doesn't > have a 'name' member variable. So I'm totally confused. > > -Ron --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
