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 #922 (closed task: fixed)

Opened 13 years ago

Last modified 11 years ago

[PATCH] update TG to support sqlalchemy API 0.2

Reported by: max Owned by: anonymous
Priority: normal Milestone: 1.0b1
Component: TurboGears Version: 0.9a6
Severity: major Keywords:
Cc:

Description

There were major changes in SQLAlchemy 0.2 API and TG code need to be updated to work correctly.

Attachments

sa02_threadlocal.patch Download (21.1 KB) - added by Arnar 13 years ago.
SA 0.2 support for TG with the threadlocal mod (against TG rev. 1548)
sa02_r1590.patch Download (22.4 KB) - added by matt 13 years ago.
patch updated for branches/1.0@1590
sa02_r1600.patch Download (27.5 KB) - added by matt 13 years ago.
new patch for branches/1.0@r1600

Change History

comment:1 Changed 13 years ago by Arnar

  • Milestone changed from 1.0 to 1.0b1

The above patch provides working identity/visit with SA 0.2. The threadlocal mod is used - so SA behaves like version 0.1. Don't know yet if that's appropriate for TG.

The patch does not make use of ActiveMapper? or the assign_mapper monkeypatch function.

The table schema used by the identity/visit stuff is identical to the SQLObject one (i.e. integer primary keys called id etc.)

Currently it's lacking any unit tests.

Changed 13 years ago by Arnar

SA 0.2 support for TG with the threadlocal mod (against TG rev. 1548)

comment:2 Changed 13 years ago by Arnar

  • Version changed from 0.9a5 to 0.9a6
  • Component changed from CherryPy to TurboGears

Updated the patch since identity stuff wasn't working properly.

comment:3 Changed 13 years ago by alberto

  • Summary changed from update TG to support sqlalchemy API 0.2 to [PATCH] update TG to support sqlalchemy API 0.2

comment:4 Changed 13 years ago by cduffy

Just curious -- why does this patch move away from use of ActiveMapper?

Changed 13 years ago by matt

patch updated for branches/1.0@1590

comment:6 Changed 13 years ago by matt

I've reattached the patch with minor changes so it applies cleanly to the current 1.0 branch. I also updated the QuickStart template for dev.cfg to provide a valid default sqlalchemy.dburi setting when identity uses SA.

So far I've only tested creating a user though "tg-admin shell":

>>> u = User()
>>> u.user_name = 'test'
>>> u.password = 'test'
>>> u.display_name = 'Test User'
>>> u.email_address = 'test@test.com'
>>> objectstore.current.save(u)
>>> objectstore.current.flush()

Answer no to the prompt when you exit the shell "Do you wish to commit your database changes?" This doesn't currently work with SA.

Changed 13 years ago by matt

new patch for branches/1.0@r1600

comment:7 Changed 13 years ago by matt

Updated the patch again based on r1600. Use the "session" instead of object store now:

session.save(u)
session.flush()

comment:8 Changed 13 years ago by kevin

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.