Add email validator function and clean up commented code in base_views.py; enhan…

…ce is_devel function in depreciated_base.py
1 parent 7aa354f1
...@@ -24,3 +24,7 @@ def get_address2(request): ...@@ -24,3 +24,7 @@ def get_address2(request):
def get_app_name(request): def get_app_name(request):
return get_params('app_name', 'openSIPKD Application') return get_params('app_name', 'openSIPKD Application')
def is_devel(request):
return get_params('devel') == 'true'
...@@ -1207,14 +1207,18 @@ def deferred_status(node, kw): ...@@ -1207,14 +1207,18 @@ def deferred_status(node, kw):
values = kw.get('daftar_status', []) values = kw.get('daftar_status', [])
return widget.SelectWidget(values=values) return widget.SelectWidget(values=values)
from email.utils import parseaddr
def email_validator(node, value):
name, email = parseaddr(value)
if not email or email.find('@') < 0:
raise colander.Invalid(node, 'Invalid email format')
""" """
# def email_validator(node, value):
# name, email = parseaddr(value)
# if not email or email.find('@') < 0:
# raise colander.Invalid(node, 'Invalid email format')
# class Store(dict): # class Store(dict):
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!