-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Il 12/04/2012 20:45, Michael Bayer ha scritto:
> [...]
>> I have another question, about coding style.
>> Current SQLAlchemy code create the connection and transaction objects in
>> the Engine.begin method, and then return an instance of
>> Engine._trans_ctx class.
> 
>> What about, instead, creating the connection and transaction objects
>> inside the __enter__ method of the Engine._trans_ctx class?
> 
>> Doing this way, one can prevent incorrect usage of the context manager;
>> that is doing so:
> 
>>   ctx = db.begin()
> 
>> should not create a connection that will never be explicitly closed.
> 
> oh that's a nice idea, if you create a pull request from 
> https://bitbucket.org/sqlalchemy/sqlalchemy I can pull that in, thanks !  
> you'll need to adjust my new test 
> test.engine.test_execute:ConvenienceExecuteTest.test_transaction_engine_ctx_begin_fails
>  to use testing.run_as_contextmanager in order to hit the exception in that 
> case.
> 

Sure, just give me some more time.
The test suite should probably be renamed in something like
test_transaction_engine_ctx_enter_fails (since it is no more the begin
method that is failing); not sure.



Regards  Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+IUnEACgkQscQJ24LbaUT8aACePkDebBAOhVbhLJuAtiYg/SyS
tgoAnjR6Cz/cm7mNq29DOC5ytbD9+F8w
=Tq/Y
-----END PGP SIGNATURE-----

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