Description
From thret...@gmail.com on August 27, 2009 20:00:03
If a document is loaded, and the ListField/DictField specified in the schema class is not pre-
existing, the Fields do not work. What steps will reproduce the problem? 1. Create and save a document
2. Add ListField/DictField to schema class and re-load the document
3. ListField/DictField are non-functional What is the expected output? What do you see instead? The ListField should be represented by a schema.Proxy object, instead it is a standard python list
object. When storing the document, any values placed in the list will be ignored. What version of the product are you using? On what operating system? Python 2.5.2
CouchDB 0.9.1 Please provide any additional information below. Small app to demonstrate:
"""
!/usr/bin/env python
import couchdb
from couchdb import schema
server = couchdb.Server('http://localhost:5984/'
db = server['list-tests']
class TestDoc(schema.Document):
title = schema.TextField()
class TestDocAlt(schema.Document):
title = schema.TextField()
test_list = schema.ListField(schema.TextField())
t1 = TestDoc()
t1.title = 'Test'
t1.store(db)
t2 = TestDocAlt.load(db, t1.id)
Will print "<type 'list'>" not "<class 'couchdb.schema.Proxy'>"
print type(t2.test_list)
t2.test_list.append('ham')
t2.store(db)
t3 = db.get(t2.id)
Will print "False" becuase the list was never stored as part of t2 on line 25
print t3.has_key('test_list')
"""
Original issue: http://code.google.com/p/couchdb-python/issues/detail?id=88