Hi Simon,

But creating the two table might be exactly was is intended, or it might make more sense to have class Z have a reference to A than the other way around.

What do you think?

Best regards,

Miguel Tavares

2009/8/12 Simon Cross <hodgestar@gmail.com>
2009/8/12 José Miguel Pereira Tavares <migtavares@gmail.com>:
> When trying to create a Many-to-Many relationship between two classes I
> came across the following bug (I presume): when checking for the join
> tables that need to be created the following lines are run:
>
> sqlobject/main.py:
> 1469            if join.soClass.__name__ > join.otherClass.__name__:
> 1470                continue
> 1471            joins.append(join)
>
> What this lines seam to do is stop any Many-to-Many relations where the
> first class as a "lower" name than the second on.
>
> Is this intended? If so why?

It is intended. It's there to stop SQLObject attempting to create the
join table twice when the tables for the both the classes in the join
are created.

Without it,

 Capability.createTable()
 Target.createTable()

would attempt to create the mapping table twice.

Schiavo
Simon