class ISignature(form.Schema, IImageScaleTraversable): """ Signature """ first_name = schema.TextLine( title=_(u"First Name"), required=True, ) last_name = schema.TextLine( title=_(u"Last Name"), required=True, ) organization = schema.TextLine( title=_(u"Organization"), required=False, ) designation = schema.TextLine( title=_(u"Designation"), required=False, ) city = schema.TextLine( title=_(u"City"), required=False, ) country = schema.TextLine( title=_(u"Country"), required=False, ) email1 = schema.TextLine( title=_(u"Email Address"), constraint=validateaddress, ) email2 = schema.TextLine(title=_(u"Enter the same email address"), constraint=validateaddress) captcha = Captcha( title=_(u'Type the code'), description=_(u'Type the code from the picture shown below.')) @invariant def emailAddressValidation(self): #pattern = r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)" if self.email1 != self.email2: raise Invalid(_("Both email addresses do not match")) #if not bool(re.match(pattern, self.email1)): # raise Invalid(_(u"Email 1 is not a valid email address.")) #elif not bool(re.match(pattern, self.email2 )): # raise Invalid(_(u"Email 2 is not a valid email address.")) pass
from collective.grok import gs from interfaithclimate.signup import MessageFactory as _ @gs.importstep( name=u'interfaithclimate.signup', title=_('interfaithclimate.signup import handler'), description=_('')) def setupVarious(context): if context.readDataFile('interfaithclimate.signup.marker.txt') is None: return portal = context.getSite() # do anything here
def emailAddressValidation(self): #pattern = r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)" if self.email1 != self.email2: raise Invalid(_("Both email addresses do not match"))
class ICaptchaSchema(Interface): captcha = Captcha( title=_(u'Type the code'), description=_(u'Type the code from the picture shown below.'))