
from flask import request
from flask.ext.wtf import SelectField, HiddenField, TextField, validators
from flask.ext.babel import lazy_gettext as _l
from .base import Form

class WFSEditForm(Form):
    def is_submitted(self):
        return request and request.method in ("PUT", "POST") and request.form.get('edit_form')

    layer = SelectField(_l('wfs_layer'))
    external_editor = HiddenField()
    edit_form = HiddenField()

class WFSAddLayerForm(Form):
    def is_submitted(self):
        return request and request.method in ("PUT", "POST") and request.form.get('add_form')

    new_layer = TextField(_l('wfs_new_layer_name'), validators=[
        validators.Regexp(regex='^[\w\- ]+$', message=_l('Only alphanummeric lowercase characters are allowed!')),
    ])
    add_form = HiddenField()

from flask import request
from flask.ext.wtf import SelectField, HiddenField, TextField, validators
from flask.ext.babel import lazy_gettext as _l
from .base import Form

class WFSEditForm(Form):
    def is_submitted(self):
        return request and request.method in ("PUT", "POST") and request.form.get('edit_form')

    layer = SelectField(_l('wfs_layer'))
    external_editor = HiddenField()
    edit_form = HiddenField()

class WFSAddLayerForm(Form):
    def is_submitted(self):
        return request and request.method in ("PUT", "POST") and request.form.get('add_form')

    new_layer = TextField(_l('wfs_new_layer_name'), validators=[validators.Required(),])
    add_form = HiddenField()
Allow all characters for layer title
Allow all characters for layer title

  
  from flask import request
  from flask.ext.wtf import SelectField, HiddenField, TextField, validators
  from flask.ext.babel import lazy_gettext as _l
  from .base import Form
  
  class WFSEditForm(Form):
      def is_submitted(self):
          return request and request.method in ("PUT", "POST") and request.form.get('edit_form')
  
      layer = SelectField(_l('wfs_layer'))
      external_editor = HiddenField()
      edit_form = HiddenField()
  
  class WFSAddLayerForm(Form):
      def is_submitted(self):
          return request and request.method in ("PUT", "POST") and request.form.get('add_form')
  
-     new_layer = TextField(_l('wfs_new_layer_name'), validators=[
+     new_layer = TextField(_l('wfs_new_layer_name'), validators=[validators.Required(),])
-         validators.Regexp(regex='^[\w\- ]+$', message=_l('Only alphanummeric lowercase characters are allowed!')),
-     ])
      add_form = HiddenField()
Allow all characters for layer title
## Code Before:

from flask import request
from flask.ext.wtf import SelectField, HiddenField, TextField, validators
from flask.ext.babel import lazy_gettext as _l
from .base import Form

class WFSEditForm(Form):
    def is_submitted(self):
        return request and request.method in ("PUT", "POST") and request.form.get('edit_form')

    layer = SelectField(_l('wfs_layer'))
    external_editor = HiddenField()
    edit_form = HiddenField()

class WFSAddLayerForm(Form):
    def is_submitted(self):
        return request and request.method in ("PUT", "POST") and request.form.get('add_form')

    new_layer = TextField(_l('wfs_new_layer_name'), validators=[
        validators.Regexp(regex='^[\w\- ]+$', message=_l('Only alphanummeric lowercase characters are allowed!')),
    ])
    add_form = HiddenField()
## Instruction:
Allow all characters for layer title
## Code After:

from flask import request
from flask.ext.wtf import SelectField, HiddenField, TextField, validators
from flask.ext.babel import lazy_gettext as _l
from .base import Form

class WFSEditForm(Form):
    def is_submitted(self):
        return request and request.method in ("PUT", "POST") and request.form.get('edit_form')

    layer = SelectField(_l('wfs_layer'))
    external_editor = HiddenField()
    edit_form = HiddenField()

class WFSAddLayerForm(Form):
    def is_submitted(self):
        return request and request.method in ("PUT", "POST") and request.form.get('add_form')

    new_layer = TextField(_l('wfs_new_layer_name'), validators=[validators.Required(),])
    add_form = HiddenField()