Thanks everyone, your help is appreciated! On Mon, 2010-02-01 at 07:46 -0700, Alec Henriksen wrote: > Hello list, > > I am defining my storm tables like this (in a file called objects.py): > > class Article(object): > """ > This is a Storm table: articles > """ > __storm_table__ = "articles" > id_ = Int(primary=True) > url_id = Unicode() > title = Unicode() > tags = Unicode() > author = Unicode() > timestamp = Unicode() > content = Unicode() > comments = ReferenceSet(id_, Comment.article_id) > comment_count = len(comments) > ip = Unicode() > active = Int() > > > class Comment(object): > """ > This is a Storm table: articles > """ > __storm_table__ = "comments" > id_ = Int(primary=True) > author = Unicode() > article_id = Int() > article = Reference(article_id, Article.id_) > thread_id = Int() > timestamp = Unicode() > email = Unicode() > website = Unicode() > text = Unicode() > > The problem is, obviously enough, I can't reference Comment.article_id > before I've defined Comment. I also can't switch the two classes around, > because both Comment and Article reference each other. Python gives me > this: > > File "/var/www/alecwh/objects.py", line 34, in Article, referer: > http://localhost/ > comments = ReferenceSet(id_, Comment.article_id), referer: > http://localhost/ > NameError: name 'Comment' is not defined, referer: http://localhost/ > > So, does anybody have any recommendations for resolving this? Perhaps > I'm not thinking about this correctly. Thanks a lot in advance. >
-- Alec Henriksen <[email protected]> @ http://alecwh.com/ -- storm mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
