Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Revamped polymorphic support #5

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
827352a
manage unicode string
steeeveb Nov 26, 2010
35e889e
Initial tables for polymorphic associations tests.
xadhoom Jan 21, 2011
8435d82
Initial definition of a polymorphic association
xadhoom Jan 21, 2011
7109b0c
Fix definition with a better syntax.
xadhoom Jan 21, 2011
1bfea03
Initial skel for test. Yes now fails. To be finished.
xadhoom Jan 21, 2011
88cf11d
Fix table definition, initial test setup now works.
xadhoom Jan 24, 2011
5e7e03f
Initial polymorphic commit. From owned to owner works. Now we must fi…
xadhoom Jan 24, 2011
a45aeb0
polymorphic relations now works. need to add and cleanup tests
xadhoom Jan 25, 2011
8150538
more tests. tests name cleanup. hasone poly works also :)
xadhoom Jan 25, 2011
682b0dd
fix set method for poly hasone relations
xadhoom Jan 25, 2011
d13196e
fix set method for hasmany
xadhoom Jan 25, 2011
ce2dcda
fix loadrelation test and dboject for polymorphic relations
xadhoom Jan 25, 2011
0a4cb12
fix more serious polymorphic tests names
xadhoom Jan 25, 2011
ff0d663
Merge branch 'master' of https://github.com/steeeveb/twistar
xadhoom Jan 25, 2011
063a1aa
Merge branch 'master' of https://github.com/bmuller/twistar
xadhoom Jan 25, 2011
90ac9d4
Add polymorphic test tables also on pgsql. Anyone willing to test?
xadhoom Jan 26, 2011
da6845b
alter polymorphics relations tests names and variables to reflect a r…
xadhoom Jan 26, 2011
7a4347a
moved to a dictionary approach. Changed Registry to better support al…
xadhoom Jan 27, 2011
c5037cb
remove unneeded func
xadhoom Jan 27, 2011
378f61f
Whops :)
xadhoom Jan 27, 2011
ed235e6
Code cleanup, removed unneeded code
xadhoom Jan 27, 2011
5c760eb
Remove not used setattr
xadhoom Jan 28, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Initial tables for polymorphic associations tests.
  • Loading branch information
xadhoom committed Jan 21, 2011
commit 35e889e67afdcec6f1f988eb4a88fba847520629
8 changes: 8 additions & 0 deletions twistar/tests/mysql_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def runInitTxn(txn):
txn.execute("""CREATE TABLE favorite_colors (id INT AUTO_INCREMENT, name VARCHAR(255), PRIMARY KEY (id))""")
txn.execute("""CREATE TABLE favorite_colors_users (favorite_color_id INT, user_id INT)""")
txn.execute("""CREATE TABLE coltests (id INT AUTO_INCREMENT, `select` VARCHAR(255), `where` VARCHAR(255), PRIMARY KEY (id))""")
# poly tables
txn.execute("""CREATE TABLE child (id INT AUTO_INCREMENT, `name` VARCHAR(255), parent_id INT, parent_type VARCHAR(32))""")
txn.execute("""CREATE TABLE mother (id INT AUTO_INCREMENT, name VARCHAR(255))""")
txn.execute("""CREATE TABLE father (id INT AUTO_INCREMENT, name VARCHAR(255))""")
return CONNECTION.runInteraction(runInitTxn)


Expand All @@ -27,5 +31,9 @@ def runTearDownDB(txn):
txn.execute("DROP TABLE favorite_colors")
txn.execute("DROP TABLE favorite_colors_users")
txn.execute("DROP TABLE coltests")
# poly tables
txn.execute("DROP TABLE child")
txn.execute("DROP TABLE mother")
txn.execute("DROP TABLE father")
return CONNECTION.runInteraction(runTearDownDB)

10 changes: 10 additions & 0 deletions twistar/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,15 @@ class FakeObject(DBObject):
class Coltest(DBObject):
pass

class Child(DBObject):
BELONGSTO = ['parent']

class Mother(DBObject):
HAS_MANY = ['childs']

class Father(DBObject):
HAS_MANY = ['childs']

Registry.register(Picture, User, Avatar, FakeObject, FavoriteColor)
Registry.register(Pen, Mother, Father)