#2204: [PATCH] In the docs, add an example of using the model outside of the
project
---------------------------+------------------------------------------------
Reporter: BruceWebber | Owner: Chris Arndt
Type: enhancement | Status: new
Priority: normal | Milestone: 2.0rc1
Component: Documentation | Version: trunk
Severity: normal | Resolution:
Keywords: |
---------------------------+------------------------------------------------
Comment (by lszyba1):
Alternative example of the real code. The patch has some weird "here"
statement which is not clear....
:
{{{
#tg2 session--------
import os
from paste.deploy import appconfig
import transaction
from sqlalchemy import create_engine
from myapp.model import *
conf_dict = appconfig('config:%s' % os.path.join(os.getcwd(),
'development.ini'))
engine = create_engine(conf_dict['sqlalchemy.url'])
engine.echo=True
init_model(engine)
#end of tg2 session
from myapp.model import DBSession, metadata
from myapp.model.mymodule import mytable
import transaction
#Start code below.
#DBSession.qury(mytable).....etc
#End of my code.
transaction.commit()
}}}
--
Ticket URL: <http://trac.turbogears.org/ticket/2204#comment:1>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---