On 9/23/06, Doug Grainger <[EMAIL PROTECTED]> wrote:
>
> does anyone know why this works perfectly:
>
> clientList = list(Client.select("client.active = 't' and " +
>         "client.systemclient = 'f'"))
> clients = [(client.clientid) for client in clientList]
> for client in clients:
>     object = ClientObject()
>     object.getClientByID(client)
>     self._list.append(object)
>
> but this, which is more succinct and should be functionally equivalent
> (not to mention saves me from looping twice):
>
> clientList = list(Client.select("client.active = 't' and " +
>         "client.systemclient = 'f'"))
> for client in clientList:
>     object = ClientObject()
>     object.getClientByID(client.clientid)
>     self._list.append(object)
>
the way I see it when you call the list it's transforming the iterator
so it's actually going to the db.

so when you do clientById it's trying to go again and then is when you
get the error. cause your going twice to the db.

by the way why don't you use Client.selectBy(active = 't', systemclient='f')

this should fetch the object. which is what you need right?

> raises this from sqlobject.dbconnection.py:
>
> AssertionError: This transaction has already gone through ROLLBACK;
> begin another transaction
>
> i have not explicitly made any reference to hub in any previous code,
> and the only references i can find about it are at
> http://trac.turbogears.org/turbogears/ticket/80, which should be fixed
> (but maybe it needs to be reopened?).  i've removed all of my old
> versions of TurboGears, SQLObject, etc (i'm running 1.0b1)
>
>
> >
>

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

Reply via email to