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
-~----------~----~----~----~------~----~------~--~---

Reply via email to