i have upgraded to 0.5.5 Now the error changed to AttributeError: 'NoneType' object has no attribute 'modified_event' Module sqlalchemy.orm.attributes:150 in __set__ view << def __set__(self, instance, value): self.impl.set(instance_state(instance), instance_dict (instance), value, None)
def __delete__(self, instance): >> self.impl.set(instance_state(instance), instance_dict(instance), value, >> None) Module sqlalchemy.orm.attributes:447 in set view << else: old = dict_.get(self.key, NO_VALUE) state.modified_event(dict_, self, False, old) if self.extensions: >> state.modified_event(dict_, self, False, old) AttributeError: 'NoneType' object has no attribute 'modified_event' it seems instance_state(instance) returns None. On Jul 30, 7:51 pm, "Michael Bayer" <mike...@zzzcomputing.com> wrote: > theres nothing about the given code that should cause any issue (and I > tried it on 0.5.1). Upgrade to 0.5.5 in any case and that will almost > certainly resolve the issue. > > rajasekhar911 wrote: > > > I am using declarative method to map objects. > > I am getting the following error when i try to create the object > > > My Class is > > from sqlalchemy.ext.declarative import declarative_base > > DeclarativeBase = declarative_base() > > class User(DeclarativeBase): > > __tablename__='managed_nodes' > > id = Column(String(50), primary_key=True) > > username=Column(String(50)) > > > def __init__(self,username = None,id = None): > > self.username = username > > if not id: > > self.id = username > > else: > > self.id = id > > > u = User(username='xxx') > > > Module model.User:63 in __init__ > > self.username = username > > >>> self.username = username > > Module sqlalchemy.orm.attributes:151 in __set__ view > > << def __set__(self, instance, value): > > self.impl.set(instance_state(instance), value, None) > > > def __delete__(self, instance): > >>> self.impl.set(instance_state(instance), value, None) > > Module sqlalchemy.orm.attributes:440 in set view > > << old = self.get(state) > > else: > > old = state.dict.get(self.key, NO_VALUE) > > > state.modified_event(self, False, old) > >>> old = state.dict.get(self.key, NO_VALUE) > > AttributeError: 'NoneType' object has no attribute 'dict' > > > what can be the possible reason?? > > my sqlalchemy version is 0.5.1 on centos5.2... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. 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 -~----------~----~----~----~------~----~------~--~---