hi all. I've been using sqlalchemy in one of may projects. I
followed the steps in http://www.sqlalchemy.org/trac/wiki/WhatsNewIn04,
but the I got this backtrace:

Traceback (most recent call last):
  File "./kress.py", line 664, in ?
    main(sys.argv)
  File "./kress.py", line 658, in main
    mainWindow= Kress (app)
  File "./kress.py", line 92, in __init__
    self.fromDatabase ()
  File "./kress.py", line 109, in fromDatabase
    for post in self.model.posts (self.index, self.showPosts, self.activeFeeds, 
self.filteringTags, self.textFilter):
  File 
"/home/mdione/src/projects/kreissy/src/branches/multi-feed-tag/src/kress/model/kressdata.py",
 line 96, in posts
    p= q.all ()
  File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py", line 571, in 
all
    return list(self)
  File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py", line 615, in 
__iter__
    context = self._compile_context()
  File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/query.py", line 864, in 
_compile_context
    
statement.append_order_by(*sql_util.ClauseAdapter(s3).copy_and_process(order_by))
  File "/usr/lib/python2.4/site-packages/sqlalchemy/sql/util.py", line 232, in 
copy_and_process
    self.process_list(list_)
  File "/usr/lib/python2.4/site-packages/sqlalchemy/sql/util.py", line 243, in 
process_list
    list_[i] = self.traverse(list_[i], clone=True)
  File "/usr/lib/python2.4/site-packages/sqlalchemy/sql/visitors.py", line 56, 
in traverse
    for c in t.get_children(**self.__traverse_options__):
  File "/usr/lib/python2.4/site-packages/sqlalchemy/sql/expression.py", line 
1858, in get_children
    return self.bindparams.values()
AttributeError: 'list' object has no attribute 'values'

    the relevant code near that Query.all() is:

    def posts (self, index=0, count=None, feeds=None, tags=None, search=None):
        # apply filters
        constraint= Post.c.state!='deleted'
        
        # this two chunks just adds constraints by or'ing feed and tag names.
        if len (feeds)>0:
            # or'ing feeds
            # by cases
            feedName= feeds[0]
            if len (feeds)==1:
                constraint= constraint & (Feed.c.name==feedName) & 
self.query.join_to ('feed')
            elif len (feeds)>1:
                temp= (Feed.c.name==feedName) & self.query.join_to ('feed')
                for feedName in feeds[1:]:
                    temp= temp | (Feed.c.name==feedName) & self.query.join_to 
('feed')
                constraint= constraint & temp
        
        if len (tags)>0:
            tagName= tags[0]
            if len (tags)==1:
                constraint= constraint & (Tag.c.name==tagName) & 
self.query.join_to ('tags')
            elif len (tags)>1:
                temp= (Tag.c.name==tagName) & self.query.join_to ('tags')
                for tagName in tags[1:]:
                    temp= temp | (Tag.c.name==tagName) & self.query.join_to 
('tags')
                constraint= constraint & temp
        
        if search is not None:
            constraint= constraint & (Post.c.title.like ('%'+search+'%'))
        
        q= self.query.offset (index)
        if count is not None:
            q= q.limit (count)
        q= q.order_by (sqlalchemy.desc ('date'))
        q= q.filter (constraint)
        print self.query.compile () <---
        p= q.all ()
        return p

    that print hightlighted there gives:

SELECT 
    tag_1.id AS tag_1_id, 
    tag_1.name AS tag_1_name, 
    post.id AS post_id, 
    post.guid AS post_guid, 
    post.feed_id AS post_feed_id, 
    post.title AS post_title, 
    post.content AS post_content, 
    post.date AS post_date, 
    post.state AS post_state
FROM 
    post 
        LEFT OUTER JOIN post_tag AS post_tag_2 ON 
            post.id = post_tag_2.post_id 
        LEFT OUTER JOIN tag AS tag_1 ON 
            tag_1.id = post_tag_2.tag_id 
ORDER BY 
    post.oid, post_tag_2.oid


    I will try to minimize the example, but I wanted you opinion in the
meanwhile.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to