def processContent(self, speakerWrapper): fullUrl = UHCollaborationElectronicAgreementForm().getURL(self._conf.getId(), speakerWrapper.getUniqueIdHash()) url = "<a href='%s'>%s</a>"%(fullUrl, fullUrl) talkTitle = speakerWrapper.getContribution().getTitle() if speakerWrapper.getContribution() else self._conf.getTitle() mailEnv = dict(url=url, talkTitle = talkTitle, name= speakerWrapper.getObject().getDirectFullName()) return permissive_format(self.content, mailEnv)
def processContent(self, speakerWrapper): fullUrl = UHCollaborationElectronicAgreementForm().getURL( self._conf.getId(), speakerWrapper.getUniqueIdHash()) url = "<a href='%s'>%s</a>" % (fullUrl, fullUrl) talkTitle = speakerWrapper.getContribution().getTitle( ) if speakerWrapper.getContribution() else self._conf.getTitle() mailEnv = dict(url=url, talkTitle=talkTitle, name=speakerWrapper.getObject().getDirectFullName()) return permissive_format(self.content, mailEnv)
def testTextParenthesesFormatting(self): params = dict(url="www.cern.ch", name="My Name", other="Nothing") texts = ["This is a text without parameters.", "This is the url: {url} and name: {name}} and url: {url} one more time", "This text contains missing parentheses: {url}{url} {url name}", "This text contains missing parentheses: {name}} {} }{test{}}}", "This text contains unused parameters: {one}{name}{two}", "Parameter inside parameter: {url{url}}", ] results = ["This is a text without parameters.", "This is the url: www.cern.ch and name: My Name} and url: www.cern.ch one more time", "This text contains missing parentheses: www.cern.chwww.cern.ch {url name}", "This text contains missing parentheses: My Name} {} }{test{}}}", "This text contains unused parameters: {one}My Name{two}", "Parameter inside parameter: {urlwww.cern.ch}", ] for text, result in zip(texts, results): self.assertEqual(permissive_format(text, params), result)