[turbogears 0.9a6; tgfastdata 0.9a5]

Maybe I'm missing something, but FastData DataControllers don't seem
to work correctly with ForeignKey columns.

I did search the archives, and saw a number of messages on this topic,
but it appears that the issue was "fixed" at some point, so maybe it's
been re-broken. The Toolbox does appear to work, so it might be
something I'm doing wrong.

To repro:

1. tg-admin quickstart a project (no identity)
2. Use this model:

class Color(SQLObject):
    name = StringCol(length=20, alternateID=True, notNone=True)

class Fruit(SQLObject):
    name = StringCol(length=20, alternateID=True, notNone=True)
    color = ForeignKey('Color', title='Color')

3. Add this to the controllers.py:

import model
import tgfastdata
from tgfastdata import DataController

class FruitDataController(DataController):
    sql_class=model.Fruit

class ColorDataController(DataController):
    sql_class=model.Color

class Root(controllers.RootController):
    fruit = FruitDataController()
    color = ColorDataController()

4. In tg-admin shell:

Color(name="red")
Color(name="yellow")
Fruit(name="apple", color=Color.byName("red"))
hub.commit()

5. Start the app, go to the "fruit" entry point, and edit "apple" to
have color "yellow".

When you do this, you get an traceback, ending with:

"c:\python24\lib\site-packages\sqlobject-0.7.1dev_r1457-py2.4.egg\sqlobject\dbconnection.py",
line 295, in _executeRetry
    return cursor.execute(query)
IntegrityError: fruit.color_id may not be NULL

It appears to have something to do with the SQLObject's "magic"
foreign key name-munging.

Am I just doing something wrong?  If not, I'll file a ticket.

-- 
Tim Lesher <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to