Thanks Adam, the code you suggested is consistent with the other codes
I've seen so far.
Problem is, the type of query that I need to do requires a connection
object.

I know that one way to get the connection object is to get it from the
class itself, for example Company._connection.

However, I need to do processing that spans several classes, using the
same connection object (I assume this is necessary to keep all
processing under one Transaction).

So I needed an alternative way to get a live connection object.  That's
when I noticed that hub.begin() returns a live connection object.

The code that I've written in the first post works.  I just want to
make sure that I am not doing something stupid unknowingly.

-w--


Adam Jones wrote:
> The hubs used by TG wrap around most of the SO functionality for
> transactions. The PackageHub (which is probably what you have) stores
> the transaction internally and is thread-safe. Here is what you
> probably need to get this working:
>
> trans = hub.begin() # we are catching trans as it returns, even through
> we don't use it explicitly
> ... processing code ...
> hub.commit()
> hub.end()
> 
> hth,
> -Adam


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to