pallets-eco / wtforms-appengine

WTForms integration for Google App Engine
https://wtforms-appengine.readthedocs.io
Other
42 stars 16 forks source link

Repeated StringProperty only stores the first assigned value instead of all of them #27

Open MihailRussu opened 7 years ago

MihailRussu commented 7 years ago

When assigning more than one value to a repeated StringProperty - only the first one gets stored, i.e.:

from wtforms_appengine.ndb import model_form
from google.appengine.ext import ndb
from webob.multidict import MultiDict

class Model(ndb.Model):
   s = ndb.StringProperty(repeated=True)

ModelForm = model_form(Model)

md = MultiDict()
md.add(key='s', value='x')
md.add(key='s', value='y')

print md # CORRECTLY prints TWO values for the "s" key, i.e. `MultiDict([('s', 'x'), ('s', 'y')])`

mf = ModelForm(md)

print mf.s.data # INCORRECTLY prints only the first value for the "s" key, i.e. `['x']`

Shouldn't the last line in the example above print ['x', 'y'] instead of just ['x']?

Thanks!