与Camelot的_foreign_keys错误

时间:2011-05-04 22:09:03

标签: python sqlite orm

我尝试使用来自Ubuntu 11.04 repos的SQLAlchemy 0.6.4-3的Camelot 10.07.02-c2-4build1,当我尝试在表视图中引用外键时,我得到以下stacktrace:

ERROR:camelot.view.model_thread.signal_slot_model_thread:exception caught in model thread while executing get_columns -> QueryTableProxy.setColumns
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/camelot/view/model_thread/signal_slot_model_thread.py", line 31, in execute
    result = self._request()
  File "/usr/lib/python2.7/dist-packages/camelot/view/proxy/collection_proxy.py", line 272, in get_columns
    self._columns = columns_getter()
  File "/usr/lib/python2.7/dist-packages/camelot/view/model_thread/__init__.py", line 56, in wrapper
    return original_function( *args, **kwargs )
  File "/usr/lib/python2.7/dist-packages/camelot/admin/object_admin.py", line 418, in get_columns
    for field in self.list_display]
  File "/usr/lib/python2.7/dist-packages/camelot/view/model_thread/__init__.py", line 56, in wrapper
    return original_function( *args, **kwargs )
  File "/usr/lib/python2.7/dist-packages/camelot/view/elixir_admin.py", line 198, in get_field_attributes
    foreign_keys = list(property._foreign_keys)
AttributeError: 'RelationshipProperty' object has no attribute '_foreign_keys'

我的代码必不可少:

class Customer(Entity):
    name = Field(Unicode(200))
    packages = OneToMany("Package")

    class Admin(EntityAdmin):
        list_display = ['name']

class Package(Entity):
    interval_months = Field(Integer)
    customer = ManyToOne("Customer")

    class Admin(EntityAdmin):    
        list_display = ['interval_months', 'customers'] # here is the error

搜索在mailinglist中给了我一些提示,但我真的不明白如何解决这个问题。

1 个答案:

答案 0 :(得分:0)

SQLAlchemy的版本更改了Camelot使用的API,因此需要更新Camelot。