2

在我的应用程序中,我想为item_lookup_field我的一些资源端点使用该设置。我也需要版本控制。

settings.py我有以下内容:

[...]
VERSIONING = True
ITEM_URL = 'regex("[a-z0-9]{0,24}")'
DOMAIN = {
    'people': {
        'item_lookup_field': 'lastname',
        'type': 'dict',
        'schema': {
            'firstname': { 'type': 'string' },
            'lastname': { 'type': 'string', 'required': True, 'unique': True },
        } 
    }
}

GET端点上的 A有效/people/obama,但/people/obama?version=1会创建以下 KeyError:

Traceback (most recent call last):
  File "/foobar/eve0.5_env/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)

[...]

  File "/foobar/eve0.5_env/lib/python2.7/site-packages/Eve-0.5_dev-py2.7.egg/eve/methods/get.py", line 210, in getitem
resource, req, lookup, document, version)
  File "/foobar/eve0.5_env/lib/python2.7/site-packages/Eve-0.5_dev-py2.7.egg/eve/versioning.py", line 257, in get_old_document
    lookup[versioned_id_field()] = lookup[app.config['ID_FIELD']]
KeyError: '_id'

我需要更改我的配置吗?

这是一个错误吗?


PS:第一次发帖,有需要的请告诉我

4

2 回答 2

2

我没有足够的“声誉”来发表评论,所以这不是答案,而是对 Nicola 答案的评论:

同意,我认为我们根本没有实现该功能。请在Github上开票(并提交拉取请求?!)。

于 2014-12-08T22:29:00.537 回答
2

我相信文档版本控制仅在标准端点 ( ID_FIELD) 上受支持,而不在item_lookup_filter. 不过,您可能想为此开一张票,因此 Josh 和其他从事版本控制的人可以查看添加对替代端点的支持是否可行。

于 2014-12-08T08:55:12.600 回答