Removed dependency on plone.api. Following style guidelines: one import per line
This commit is contained in:
parent
0fd9b02c80
commit
15cf0e6336
@ -1,15 +1,19 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""Interfaces for plone.app.discussion
|
"""Interfaces for plone.app.discussion
|
||||||
"""
|
"""
|
||||||
from plone import api
|
|
||||||
from plone.app.discussion import _
|
from plone.app.discussion import _
|
||||||
|
from Products.CMFCore.interfaces import ISiteRoot
|
||||||
|
from Products.CMFCore.utils import getToolByName
|
||||||
from zope import schema
|
from zope import schema
|
||||||
|
from zope.component import getUtility
|
||||||
from zope.component.interfaces import IObjectEvent
|
from zope.component.interfaces import IObjectEvent
|
||||||
from zope.interface import Interface, Invalid
|
from zope.interface import Interface
|
||||||
|
from zope.interface import Invalid
|
||||||
from zope.interface.common.mapping import IIterableMapping
|
from zope.interface.common.mapping import IIterableMapping
|
||||||
|
|
||||||
def isEmail(value):
|
def isEmail(value):
|
||||||
reg_tool = api.portal.get_tool(name='portal_registration')
|
portal = getUtility(ISiteRoot)
|
||||||
|
reg_tool = getToolByName(portal, 'portal_registration')
|
||||||
if not (value and reg_tool.isValidEmail(value)):
|
if not (value and reg_tool.isValidEmail(value)):
|
||||||
raise Invalid(_("Invalid email address."))
|
raise Invalid(_("Invalid email address."))
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user