Hi, I'm trying to modify my TG1 application with SQLObject into a TG2
version with SQLAlchemy.
First I checked the TG2 tutorials and got the simple object mapping
examples working but now I want to implement a one-to-many
relationship I get a
< NameError: name 'Address' is not defined >
when I add relationship to my model. I compared my file with the
generated auth.py and there's no much difference.
What's more confusing is that SQLAlchemy documentation talks about
mapping with the sqlalchemy.orm.mapper.
The file location.py contains my current two classes:

class City(DeclarativeBase):
    __tablename__ = 'city'

    #{ Columns ## not relevant
    #{ Relations
    adresses     = relation('Address', order_by=Address.id,
backref='city')
    #}

class Address(DeclarativeBase):

    __tablename__ = 'address'

    #{ Columns ## not relevant
    #{ Relations
    city_id   = Column(Integer, ForeignKey('city.id'))
    city       = relation('City', backref=backref('addresses',
order_by=id))

and I have them imported in my /model/__init__.py

Why am I getting this NameError?
Anyone, police?
--~--~---------~--~----~------------~-------~--~----~
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