Ok, I think I've got something working. My results with the turbotunes
tutorial and a PostgreSQL backend are as follows:

  - original: "tg-admin sql create" fails

  - with soClasses workaround: "create" works but "drop" fails

  - with patch (no soClasses): both "create" and "drop" work

Again newbie alert: this is my first time diving into TG/SQLObject
code... so, is anyone up for a quick code review? Also, any help with
regards to how to write a test for this would be greatly appreciated.

The code is available here:
http://trac.turbogears.org/turbogears/attachment/ticket/279/command.patch

Some details about the patch:

The patch is basically a big self-contained function, but with three
distinct components. The reason for that is that I did not want to
touch anything else but command.py and I also wanted to avoid namespace
contamination.

Ideally, I guess the "findReverseDependencies()" and
"calculateDependencyLevel()" functions could be integrated into
SQLObject, maybe as a "_SO_depended()" method (mirroring
"_SO_depends()"), and some kind of dependency_level sqlmeta dynamic
attribute, but being a TG/SO newbie, I would not feel comfortable doing
that yet.

Also, the patch checks for circular references, which would prevent it
to work. If one is detected, it prints a warning and falls back safely
to the original behavior.

Note: the patch also contains the sql drop "__reversed__()" fix already
proposed in ticket #882.


Cheers,

-- 
Yves-Eric


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