> testcase please
Here is the sample code which works perfectly till 0.3.4 and produces
error in newer versions in my system:
from sqlalchemy import *
from sqlalchemy.ext.assignmapper import assign_mapper
from sqlalchemy.ext.sessioncontext import SessionContext
context = SessionContext(create_session)
session = context.current
metadata = BoundMetaData('sqlite:///satest', echo=False)
task_tbl = Table('task', metadata,
Column("task_id", Integer, primary_key=True, autoincrement=True),
Column("descr", Unicode(30), nullable=False))
metadata.drop_all()
metadata.create_all()
class Task(object):
pass
from sqlalchemy import EXT_PASS
class TaskExtension(object):
def get_session(self):
return EXT_PASS
def select_by(self, query, *args, **kwargs):
return EXT_PASS
def select(self, query, *args, **kwargs):
return EXT_PASS
def get_by(self, query, *args, **kwargs):
return EXT_PASS
def get(self, query, *args, **kwargs):
return EXT_PASS
def create_instance(self, mapper, selectcontext, row, class_):
return EXT_PASS
def append_result(self, mapper, selectcontext, row, instance,
identitykey, result, isnew):
return EXT_PASS
def populate_instance(self, mapper, selectcontext, row, instance,
identitykey, isnew):
mapper.populate_instance(selectcontext, instance, row,
identitykey, isnew)
def before_insert(self, mapper, connection, instance):
return EXT_PASS
def before_update(self, mapper, connection, instance):
return EXT_PASS
def after_update(self, mapper, connection, instance):
return EXT_PASS
def after_insert(self, mapper, connection, instance):
return EXT_PASS
def before_delete(self, mapper, connection, instance):
return EXT_PASS
def after_delete(self, mapper, connection, instance):
return EXT_PASS
assign_mapper(context, Task, task_tbl, extension=TaskExtension())
t = Task(descr='xyz')
t.flush()
session.clear()
t = Task.get(1) # produces exception
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---