#793: [PATCH] Model designer "Create Tables" fails with multiple Join columns
--------------------------+-------------------------------------------------
Reporter: Philip Walls | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 0.9a5
Component: Toolbox | Version: 0.9a4
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
If you try to create table from the model designer when a class has
multiple ForeignKey or *Join columns, designer/save_and_create fails. The
problem appears to be that SQLObject is loading the model definitions from
BOTH the model.py AND the tmp_model.py files and causing conflicts.
I solved this problem by not bothering with tmp_model, but I'm not sure if
this will cause other kinds of problems. I'm not entirely sure why the
author was making a copy of model.py before importing it. Maybe someone
with more experience in this area can give their insight.
'''Example model'''
{{{
#!python
class Post(SQLObject):
text = StringCol()
parent = ForeignKey("Post")
children = MultipleJoin("Post",joinColumn='parent_id')
}}}
'''Backtrace'''
{{{
File
"/path/to/turbogears/svn/turbogears/thirdparty/sqlobject/sqlobject/classregistry.py",
line 91, in addClass
'__file__', '(unknown)')))
ValueError: class Post is already in the registry (other class is <class
'testproject.model.Post'>, from the module testproject.model in
/path/to/turbogears/Test-Project/testproject/model.pyc; attempted new
class is <class 'testproject.tmp_model.Post'>, from the module
testproject.tmp_model in /path/to/turbogears/Test-
Project/testproject/tmp_model.py)
}}}
--
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/793>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Tickets" 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-tickets
-~----------~----~----~----~------~----~------~--~---