Changeset 498
- Timestamp:
- 08/01/07 23:59:32 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
pagoda/branches/cleanslate/Pagoda/pagoda/models/revision_mapper.py
r497 r498 106 106 group_by=locale_column 107 107 ) 108 109 # The order of tables added to `select_columns` relies on later columns 110 # overwriting earlier columns with the same name. In this case, we want 111 # `content_table` to have the highest precedence, for example. 112 113 select_tables = [localized_table, generic_table, node_table, 114 revision_table, content_table] 108 109 # XXX: Danger! Alert! Caution! Hey! 110 # 111 # The order of these tables is important! We want to ensure that the 112 # columns from `content_table` and `revision_table` are selected before 113 # others! Not only should their names have precedence, but SQLite's 114 # query planner actually returns different results if `revision_table` 115 # does not come first in the FROM clause. 116 # 117 select_tables = [content_table, revision_table, node_table, generic_table, 118 localized_table] 115 119 116 120 select_columns = ColumnCollection() 117 121 118 122 for select_table in select_tables: 119 select_columns.extend(select_table.c) 123 # It would be nice to use `select_columns.extend` here. 124 # However, `ColumnCollection.extend` and `ColumnCollection.add` allow 125 # later additions to overwrite (and change the order of) existing 126 # columns with the same name. We want existing columns to take 127 # precedence instead. 128 for column in select_table.c: 129 if not select_columns.has_key(column.name): 130 select_columns.add(column) 120 131 121 132 select_columns.extend([ pagoda/branches/cleanslate/TestProject/testproject/model.py
r468 r498 105 105 # 106 106 107 pagoda_page_revised = Page(108 content_id=pagoda_page.content_id,109 url='pagoda', parent_id=home_page.content_id, content_locale='en_US',110 nav_show=True, revision_author_id=brian.user_id,111 content_type='page', revision_status=workflow.PENDING,112 title="Welcome! (Now typo free.)"113 )107 # pagoda_page_revised = Page( 108 # content_id=pagoda_page.content_id, 109 # url='pagoda', parent_id=home_page.content_id, content_locale='en_US', 110 # nav_show=True, revision_author_id=brian.user_id, 111 # content_type='page', revision_status=workflow.PENDING, 112 # title="Welcome! (Now typo free.)" 113 # ) 114 114 115 115 # … … 126 126 # ) 127 127 # 128 session.flush()128 # session.flush()
