2008/5/2 [EMAIL PROTECTED] <[EMAIL PROTECTED]>:

> > Inside a controller your code will be running in a transaction -
> > whereas elsewhere it won't.  There's a bit of stuff here:
> >
> > http://docs.turbogears.org/1.0/ModelOutsideTG
>
> I printed that and read it.  Can you please elaborate how you modify
> database
> outside of a controller?  I'm still having problems.


A very simple example.
I have the following script:
#####
import turbogears

turbogears.update_config(configfile="dev.cfg",
                         modulename="tblog.config")

from tblog.model import Hutch

def displayHutch():
    print 'start displaying Hutch'
    for hutch in Hutch.select():
        print hutch.name
    print 'done displaying Hutch'

displayHutch()
for i in ['A', 'B']:
    for j in range(1, 6):
        Hutch(name = i + str(j))
displayHutch()
#####

and this gives the following output:
#####
start displaying Hutch
done displaying Hutch
start displaying Hutch
A1
A2
A3
A4
A5
B1
B2
B3
B4
B5
done displaying Hutch
#####

-- 
Cecil Westerhof

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