old_contents: from wtforms import fields, widgets
  import re
  
  # borrowed from spline
  class MultiCheckboxField(fields.SelectMultipleField):
      """ A multiple-select, except displays a list of checkboxes.
  
      Iterating the field will produce subfields, allowing custom rendering of
      the enclosed checkbox fields.
      """
      widget = widgets.ListWidget(prefix_label=False)
      option_widget = widgets.CheckboxInput()
  
  class MultiTagField(fields.TextField):
  
      def _value(self):
          if self.raw_data:
              return self.raw_data[0]
          elif self.data:
              return u' '.join(sorted(self.data))
          return u''
  
      _tag_re = re.compile(r'^[a-z0-9\s]*$')
      def process_formdata(self, valuelist):
          value = valuelist[0]
          if not self._tag_re.match(value):
              raise ValueError("Tags must be lowercase and alphanumeric")
  
          if value:
              self.data = [x for x in value.strip().split()]
  
new_contents: from wtforms import fields, widgets
  import re
  
  # borrowed from spline
  class MultiCheckboxField(fields.SelectMultipleField):
      """ A multiple-select, except displays a list of checkboxes.
  
      Iterating the field will produce subfields, allowing custom rendering of
      the enclosed checkbox fields.
      """
      widget = widgets.ListWidget(prefix_label=False)
      option_widget = widgets.CheckboxInput()
  
  class MultiTagField(fields.TextField):
  
      def _value(self):
          if self.raw_data:
              return self.raw_data[0]
          elif self.data:
              return u' '.join(sorted(self.data))
          return u''
  
      _tag_re = re.compile(r'^[a-z0-9\s]*$')
      def process_formdata(self, valuelist):
          if not valuelist:
              self.data = []
              return
  
          value = valuelist[0]
          if not self._tag_re.match(value):
              raise ValueError("Tags must be lowercase and alphanumeric")
  
          if value:
              self.data = [x for x in value.strip().split()]
  
subject: Make a tag field return an empty list when blank. #521