Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1163 (closed defect: fixed)

Opened 12 years ago

Last modified 11 years ago

model.py_tmpl doesn't import assign_mapper (for SQLAlchemy projects)

Reported by: plewis Owned by: anonymous
Priority: normal Milestone: 1.0b2
Component: TurboGears Version: 1.0b1
Severity: normal Keywords:
Cc:

Description

model.py_tmpl doesn't import assign_mapper, and so a NameError? is thrown in projects that use sqlalchemy and identity

All is needed is:

from sqlalchemy.ext.assignmapper import assign_mapper

inserted before the visits_table declaration

I only have SA 0.2, but it looks to me like assign_mapper still comes from ext.assignmapper in 0.3 as well.

Change History

comment:1 Changed 12 years ago by fredlin

  • Status changed from new to closed
  • Resolution set to wontfix

[1997] Replaced SQLAlchemy quickstart code from ActiveMapper? to plain SA , so the problem is not exist anymore, thanks to mention!

comment:2 Changed 12 years ago by matthew@…

  • Status changed from closed to reopened
  • Resolution wontfix deleted

This is still a problem as of revision 2081. Change 1997, which describes itself as "Replaced SQLAlchemy quickstart code using ActiveMapper? with plain SA definitions" in fact removed the ActiveMapper? code but also added the assign_mapper calls.

So, the original problem description stands, as does the fix.

Unless this was an error in change 1997, and the active_mapper calls are not required?

The build tests should include a test to create a new project; that would have picker up this problem.

comment:3 Changed 11 years ago by fredlin

  • Status changed from reopened to closed
  • Resolution set to fixed

fixed in [2149], thanks!

comment:4 Changed 11 years ago by roger.demetrescu

  • Status changed from closed to reopened
  • Resolution fixed deleted

The import line was included inside the block:

#if $sqlalchemy != "True"

which means that it is included when SQLObject is used... !

Should'n it be place below the line:

from sqlalchemy import *

[]s Roger

comment:5 Changed 11 years ago by fredlin

Roger:

I catch this error too, the next commit already fixed it.(#2152)

you could reconfirm it :-)

comment:6 Changed 11 years ago by roger.demetrescu

  • Status changed from reopened to closed
  • Resolution set to fixed

Now it seems to be ok. Thanks. I'm re-closing it.

PS: I think you meant [2152] ... :)

Note: See TracTickets for help on using tickets.