You might already be aware of this (I haven't been keeping up with all
that's happening here, but it looks like great stuff)... the following
example works with trunk r174, but not with r183:
class Checkout(Entity):
belongs_to('by', of_kind='Person', ondelete='cascade') # <--
causes trouble
has_field('stamp', DateTime)
can_checkout = associable(Checkout, 'checked_out')
class Article(Entity):
belongs_to('author', of_kind='Person')
has_field('title', Unicode)
has_field('content', Unicode)
can_checkout('checked_out_by', uselist=False)
using_options(tablename='article')
class Person(Entity):
has_field('name', Unicode)
has_many('articles', of_kind='Article', inverse='author')
using_options(tablename='person')
...
Basically, associable isn't seeing related classes declared further
down.
Under r183, the traceback is:
$ tg-admin sql create
Creating tables at sqlite:///devdata.sqlite
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/Current/bin/tg-
admin", line 8, in <module>
load_entry_point('TurboGears==1.0.3.2', 'console_scripts', 'tg-
admin')()
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/TurboGears-1.0.3.2-py2.5.egg/turbogears/
command/base.py", line 389, in main
command.run()
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/TurboGears-1.0.3.2-py2.5.egg/turbogears/
command/base.py", line 115, in run
sacommand(command, sys.argv)
File "<string>", line 5, in sacommand
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/TurboGears-1.0.3.2-py2.5.egg/turbogears/
command/base.py", line 69, in sacreate
get_model()
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/TurboGears-1.0.3.2-py2.5.egg/turbogears/
util.py", line 131, in get_model
package = __import__(package_name, {}, {}, ["model"])
File "/Users/ic/Documents/tgstuff/tryassoc/tryassoc/model.py", line
13, in <module>
can_checkout = associable(Checkout, 'checked_out')
File "/Users/ic/Documents/tgstuff/elixir/elixir/ext/associable.py",
line 120, in associable
interface_name = entity.table.name
File "/Users/ic/Documents/tgstuff/elixir/elixir/entity.py", line
490, in __getattribute__
elixir.setup_all()
File "/Users/ic/Documents/tgstuff/elixir/elixir/__init__.py", line
130, in setup_all
rel.create_keys(False)
File "/Users/ic/Documents/tgstuff/elixir/elixir/relationships.py",
line 372, in create_keys
target_desc = self.target._descriptor
File "/Users/ic/Documents/tgstuff/elixir/elixir/relationships.py",
line 286, in target
self._target = caller_entities[classname]
KeyError: 'Person'
Anyway, HTH...
--Isaac
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---