-
Notifications
You must be signed in to change notification settings - Fork 38
Conversation
Going to make it fail.
…x opposite direction
…eal case. thanks to Agile Web Development with Rails
…iasing and avoid duplication. Fixed tests.
Hello xadhoom - thanks for your work. I was reviewing your changes and saw a number of things that did not make sense to me (for instance, I don't know why aliasing is necessary). I decided to go ahead and implement the changes necessary for polymorphism - they are now in master. The only changes I made were to the relationships.py file. You can find the docs for the addition of polymorphic support at http://findingscience.com/twistar/doc/relationship_examples.html#auto4 and tests in the test_relationships.py file. If there is anything I have left out of my implementation that you would like to see, let me know. Thanks, |
The full aliasing support is needed to refer to the interface instead of referring to the 'name', like AR does. In your doc : should be: otherwise makes little sense specifing an interface and then refer to it in two different ways... what do you think about ? |
Ok, So can be ok, just to be more "standard". But I liked the full aliasing :) |
In your example, using: doesn't make sense to me, because boyOrGirl is what is nicknameable. Boys and girls can be nicknamed. Therefore, the property you are setting is their nicknames, not a property they have that is nicknameable. In the same way you would use a regular many relationships set - boy.nicknames.set() when you want to set a boy's many nicknames. It's the other way around - when you have a nickname - that you would want to get whatever is nicknameable - so nickname.nicknameable.get() should return something that is nicknameable - in this case, a boy or a girl. |
ok, makes sense. Last thing, not polymorphic related, is about this commit: that makes twistar work with unicode strings, otherwise saving "exotic" charset will fail. |
It was added - see 3bab792 Thanks again for contributing. Let me know if there's anything else I can do to make twistar more useful! B |
thanks for now! I'll going on using it and report back! Great work :) |
Hi,
following your suggestions I've rewrote the support for polymorphic relations using a way better dict approach.
A couple of things (based on my small experience):
to save additional informations used for alias lookup. Maybe is slower on lookup but saves more infos.
Tests has been updated to be more "real".
If is ok for you, I'll write some doc.