KeyError accessing results from Document.view when reduce=False and value is dictionary
まだ誰も着手していません。
評価
調査の方向性
文書化されている Django shell セッションとビュー定義で問題を再現します。まず couchdbkit/client.py の iterator、first、row_wrapper 周辺を確認し、次に couchdbkit/schema/util.py の wrap 周辺を調べます。reduce=False と辞書値を使ってビューの結果にアクセスしても KeyError が発生しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Additional details at mailing list post:
https://groups.google.com/forum/?fromgroups#!topic/couchdbkit/OldePEe3uxU
Ubuntu 12.04
Couchdbkit 0.6.2
Couchdb 1.2
Django 1.5.dev17942
Python 2.7.3
/home/vincent/temp/greeting/views/all contains a file called map.js with the contents:
function(doc) { emit( 1, {'a': 1, 'b': 2} ); }
There is no reduce.js (so reduce=False is unnecessary)
Reproduce via the following interactive Django Python session:
$ ./manage.py shell
from couchdbkit import *
class Greeting(Document):
def __unicode__(self):
return None
server = Server()
db = server.get_or_create_db("greeting")
Greeting.set_db(db)
greet = Greeting()
greet.test = "test"
greet.save()
from couchdbkit.designer import push
push('/home/vincent/temp/greeting', db)
greets = Greeting.view('greeting/all')
greets.count() # returns 1
greets.first()
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/couchdbkit/client.py", line 930, in first
return list(self)[0]
File "/usr/local/lib/python2.7/dist-packages/couchdbkit/client.py", line 920, in iterator
yield wrapper(row)
File "/usr/local/lib/python2.7/dist-packages/couchdbkit/client.py", line 901, in row_wrapper
return schema(data)
File "/usr/local/lib/python2.7/dist-packages/couchdbkit/schema/util.py", line 29, in wrap
cls = classes[doc_type]
KeyError: None
Via the URL http://127.0.0.1:5984/greeting/_design/greeting/_view/all Couchdb gives the output
{"total_rows":1,"offset":0,"rows":[{"id":"49ca1d5086e0c7eb36471d2e621f5a49","key":1,"value":{"a":1,"b":2}}]}
This is the line from the Couchdb log for the Couchdbkit query
[info] [<0.12793.16>] 127.0.0.1 - - GET /greeting/_design/greeting/_view/all?wrap_doc=true 200
- 主要言語
- Python
- スター
- 261
- フォーク
- 90
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
benoitc/couchdbkit のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
benoitc/couchdbkit#181 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
benoitc/couchdbkit#196 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
benoitc/couchdbkit#194 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
benoitc/couchdbkit#193 · コメント 2 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
benoitc/couchdbkit#192 ·
benoitc/couchdbkit の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
-
area:other help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
WingedGuardian/GENesis-AGI#4734 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
peach-mitao/peach#693 ·
メンテナーはふだん 1 日以内に返信
-
Failed result serialization destroys a previously saved JSON result対応中かも @chessing234 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
huggingface/evaluate#867 ·
-
FTP reads inside a transaction use a nonexistent staging path対応中かも @Harsh23Kashyap が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
fsspec/filesystem_spec#2463 ·
メンテナーはふだん 1 日以内に返信