Commits

James Crasta  committed e8b07f7

Update ext.appengine.fields for unicode_literals. Fixes #153.

  • Participants
  • Parent commits 198dc0f

Comments (0)

Files changed (1)

File wtforms/ext/appengine/fields.py

     widget = widgets.Select()
 
     def __init__(self, label=None, validators=None, reference_class=None,
-                 get_label=None, allow_blank=False, blank_text=u'', **kwargs):
+                 get_label=None, allow_blank=False, blank_text='', **kwargs):
         super(KeyPropertyField, self).__init__(label, validators, **kwargs)
         if get_label is None:
             self.get_label = lambda x: x
 
     def iter_choices(self):
         if self.allow_blank:
-            yield (u'__None', self.blank_text, self.data is None)
+            yield ('__None', self.blank_text, self.data is None)
 
         for obj in self.query:
             key = str(obj.key.id())
                 if self.data.key == obj.key:
                     break
             else:
-                raise ValueError(self.gettext(u'Not a valid choice'))
+                raise ValueError(self.gettext('Not a valid choice'))
         elif not self.allow_blank:
-            raise ValueError(self.gettext(u'Not a valid choice'))
+            raise ValueError(self.gettext('Not a valid choice'))
 
 
 class StringListPropertyField(fields.TextAreaField):
         if self.raw_data:
             return self.raw_data[0]
         else:
-            return self.data and unicode("\n".join(self.data)) or u''
+            return text_type('\n'.join(self.data)) if self.data else ''
 
     def process_formdata(self, valuelist):
         if valuelist:
             try:
                 self.data = [int(value) for value in valuelist[0].splitlines()]
             except ValueError:
-                raise ValueError(self.gettext(u'Not a valid integer list'))
+                raise ValueError(self.gettext('Not a valid integer list'))
 
 
 class GeoPtPropertyField(fields.TextField):