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 #896 (closed defect: duplicate)

Opened 13 years ago

Last modified 12 years ago

Catwalk browse.py 'join_foreign_key' Problem

Reported by: dan@… Owned by: anonymous
Priority: normal Milestone: 0.9
Component: TurboGears Version: 0.9a6
Severity: normal Keywords: catwalk browse


In the browse.py file of Catwalk, join_foreign_key has problems if the table name contains underscore characters.


class Info(SQLObject):

data = StringCol?() user = ForeignKey?('User')

class User(SQLObject):

class sqlmeta:


info = MultipleJoin?('Info')

In this example join_foreign_key will look for a field named tgID. This is incorrect, it should be looking for infoID.

I think this can be fixed by changing the index from 0 to -2. Rather than getting the first element, it should take the second to last element.

Change line 196 to the following:

foreign_key = '%sID'% column.joinColumn.split('_')[-2]


Change History

comment:1 Changed 13 years ago by anonymous

Sorry this is a duplicate of problem #701. His solution is also better.

comment:2 Changed 13 years ago by jorge.vargas

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