Para se integrar o elixir no turbogears 2, basta editar o arquivo model/__init__.py do seu projeto para ficar desse jeito:
# -*- coding: utf-8 -*- from zope.sqlalchemy import ZopeTransactionExtension from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy.ext.declarative import declarative_base import elixir maker = sessionmaker(autoflush=True, autocommit=False, extension=ZopeTransactionExtension()) DBSession = scoped_session(maker) elixir.session = DBSession elixir.options_defaults["shortnames"] = True DeclarativeBase = declarative_base() metadata = DeclarativeBase.metadata elixir.metadata = metadata def init_model(engine): """Call me before using any of the tables or classes in the model.""" DBSession.configure(bind=engine) from xyz.model.auth import User, Group, Permission from xyz.model.entidades import Xyz elixir.setup_all()
E para declarar suas entidades, basta fazer do jeito do Elixir, estendendo a classe elixir.Entity.
Com essa integração conseguimos utilizar o padrão Active Record.
Uma resposta em “Turbogears 2 e Elixir”
If you are planning an expansion to your property its simple
that you need to acquire and then install additional security sensors in order to protect an extended section of your own house.
Wireless alarm systems keep off the thieves and burglaries,
making your home more secure when you are out. All the products on the site come with a manufacturer’s warranty and a 30 day money back offer, so if
you do not like the doorbell that you buy, you can simply return it and
get your money back, no questions asked.