i just made a tiny SVN update (rev 1014) that should fix this but I
havent tried it.....guessing that the execption raised was blowing up
your session, so i added a try/finally clause to insure that it
cleans itself out.
On Feb 21, 2006, at 7:06 PM, marek wrote:
I just updated my version of SA by checking out what is in TRUNK, and
noticed the following which seems like a bug. I run the following
code:
uow = objectstore.begin()
s = Session()
s.secret = 'secret'
s.logon = 'testuser'
uow.commit()
# Works just fine
uow = objectstore.begin()
s2 = Session()
s2.secret = 'secret2'
s2.logon = 'testuser2'
uow.commit()
# Wroks just fine
uow = objectstore.begin()
s3 = Session()
s3.secret = 'secret3'
s3.logon = 'testuser3'
s3.timestamp = datetime.datetime.now()
uow.commit()
# Returns the following exception: TypeError: argument 1 must be
DateTime, not datetime.datetime
# and I continue
uow = objectstore.begin()
s4 = Session()
s4.secret = 'secret3'
s4.logon = 'testuser3'
uow.commit()
# The commit no longer works! As a matter of fact no new create of a
Session object works after the exception!
Now the exception arose because I was using datetime instead of mx's
DateTime, however it does seem strange that commits would stop working
because of an exception.
Below are all the definitions which I hope can help reproduce the
problem:
CREATE TABLE sessions (
sess_id VARCHAR(128) NOT NULL PRIMARY KEY,
sess_logon TEXT NOT NULL,
sess_ts TIMESTAMP WITH TIME ZONE DEFAULT
CURRENT_TIMESTAMP,
FOREIGN KEY (sess_logon) REFERENCES users (usr_logon) ON DELETE
cascade ON UPDATE cascade
) WITHOUT OIDS;
CREATE TABLE users (
usr_id BIGSERIAL NOT NULL PRIMARY KEY,
usr_logon TEXT NOT NULL,
usr_name TEXT NOT NULL,
usr_passwd TEXT NOT NULL,
UNIQUE(usr_logon)
) WITHOUT OIDS;
users = Table('users', db,
Column('usr_id', Integer, Sequence('users_id_seq',optional=False),
primary_key=True),
Column('usr_logon', String, nullable=False),
Column('usr_pp', String, nullable=False),
Column('usr_name', String, nullable=False))
sessions = Table('sessions', db,
Column('sess_id', Integer,
Sequence('sessions_id_seq',optional=False), primary_key=True),
Column('sess_logon', String, ForeignKey('users.usr_logon'),
nullable=False),
Column('sess_ts', DateTime, nullable=True))
assign_mapper(Session, tables.sessions, properties={
'secret': tables.sessions.c.sess_id,
'logon': tables.sessions.c.sess_logon,
'timestamp': tables.sessions.c.sess_ts,})
assign_mapper(User, tables.users, properties={
'usr_id': tables.users.c.usr_id,
'logon': tables.users.c.usr_logon,
'passwd': tables.users.c.usr_passwd,
'name':
tables.users.c.usr_name,})--------------------------------------------
-----------
This SF.net email is sponsored by: Splunk Inc. Do you grep through
log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD
SPLUNK!
http://sel.as-us.falkag.net/sel?
cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users