def test_app_globals(): with h.push_context('test', 'wiki', neighborhood='Projects'): assert g.app_static( 'css/wiki.css') == '/nf/_static_/wiki/css/wiki.css', g.app_static('css/wiki.css') assert g.url( '/foo', a='foo bar') == 'http://localhost/foo?a=foo+bar', g.url('/foo', a='foo bar') assert g.url('/foo') == 'http://localhost/foo', g.url('/foo')
def test_app_globals(): g.oid_session() g.oid_session() with h.push_context("test", "wiki", neighborhood="Projects"): assert g.app_static("css/wiki.css") == "/nf/_static_/wiki/css/wiki.css", g.app_static("css/wiki.css") assert g.url("/foo", a="foo bar") == "http://localhost:80/foo?a=foo+bar", g.url("/foo", a="foo bar") assert g.url("/foo") == "http://localhost:80/foo", g.url("/foo")
def test_app_globals(): with h.push_context('test', 'wiki', neighborhood='Projects'): assert g.app_static( 'css/wiki.css') == '/nf/_static_/wiki/css/wiki.css', g.app_static( 'css/wiki.css') assert g.url('/foo', a='foo bar') == 'http://localhost/foo?a=foo+bar', g.url( '/foo', a='foo bar') assert g.url('/foo') == 'http://localhost/foo', g.url('/foo')
def send_verification_link(self): self.nonce = sha256(os.urandom(10)).hexdigest() log.info('Sending verification link to %s', self._id) text = ''' To verify the email address %s belongs to the user %s, please visit the following URL: %s ''' % (self._id, self.claimed_by_user().username, g.url('/auth/verify_addr', a=self.nonce)) log.info('Verification email:\n%s', text) allura.tasks.mail_tasks.sendmail.post( destinations=[self._id], fromaddr=self._id, reply_to='', subject='Email address verification', message_id=h.gen_message_id(), text=text)
def send_verification_link(self): self.set_nonce_hash() log.info('Sending verification link to %s', self.email) text = ''' To verify the email address %s belongs to the user %s, please visit the following URL: %s ''' % (self.email, self.claimed_by_user(include_pending=True).username, g.url('/auth/verify_addr', a=self.nonce)) log.info('Verification email:\n%s', text) allura.tasks.mail_tasks.sendsimplemail.post( fromaddr=g.noreply, reply_to=g.noreply, toaddr=self.email, subject=u'%s - Email address verification' % config['site_name'], message_id=h.gen_message_id(), text=text)