Beispiel #1
0
 def test_mail_to(self):
     self.assertEqual(u'<a href="mailto:[email protected]">[email protected]</a>', mail_to("*****@*****.**"))
     self.assertEqual(
         u'<a href="mailto:[email protected]">Justin Example</a>', mail_to("*****@*****.**", "Justin Example")
     )
     self.assertEqual(
         u'<a class="admin" href="mailto:[email protected]">Justin Example</a>',
         mail_to("*****@*****.**", "Justin Example", class_="admin"),
     )
Beispiel #2
0
 def test_mail_to_with_hex(self):
     self.assertEqual(
         u'<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d">My email</a>',
         mail_to("*****@*****.**", "My email", encode="hex"),
     )
     self.assertEqual(
         u'<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d">&#109;&#101;&#64;&#100;&#111;&#109;&#97;&#105;&#110;&#46;&#99;&#111;&#109;</a>',
         mail_to("*****@*****.**", None, encode="hex"),
     )
Beispiel #3
0
 def test_mail_to_with_replace_options(self):
     self.assertEqual(
         u'<a href="mailto:[email protected]">wolfgang(at)stufenlos(dot)net</a>',
         mail_to("*****@*****.**", None, replace_at="(at)", replace_dot="(dot)"),
     )
     self.assertEqual(
         u'<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d">&#109;&#101;&#40;&#97;&#116;&#41;&#100;&#111;&#109;&#97;&#105;&#110;&#46;&#99;&#111;&#109;</a>',
         mail_to("*****@*****.**", None, encode="hex", replace_at="(at)"),
     )
     self.assertEqual(
         u'<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d">My email</a>',
         mail_to("*****@*****.**", "My email", encode="hex", replace_at="(at)"),
     )
     self.assertEqual(
         u'<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d">&#109;&#101;&#40;&#97;&#116;&#41;&#100;&#111;&#109;&#97;&#105;&#110;&#40;&#100;&#111;&#116;&#41;&#99;&#111;&#109;</a>',
         mail_to("*****@*****.**", None, encode="hex", replace_at="(at)", replace_dot="(dot)"),
     )
     self.assertEqual(
         u"<script type=\"text/javascript\">\n//<![CDATA[\neval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b'))\n//]]>\n</script>",
         mail_to("*****@*****.**", "My email", encode="javascript", replace_at="(at)", replace_dot="(dot)"),
     )
Beispiel #4
0
 def test_mail_to_with_options(self):
     self.assertEqual(
         u'<a href="mailto:[email protected]?cc=ccaddress%40example.com&amp;bcc=bccaddress%40example.com&amp;subject=This%20is%20an%20example%20email&amp;body=This%20is%20the%20body%20of%20the%20message.">My email</a>',
         mail_to(
             "*****@*****.**",
             "My email",
             cc="*****@*****.**",
             bcc="*****@*****.**",
             subject="This is an example email",
             body="This is the body of the message.",
         ),
     )
Beispiel #5
0
    def users(self):
        checkLogin()

        c.site = "User administration"
        c.name = session['project_id']
        c.menu = genMenu(self)

        p = Project()
        p.load(c.name, getConfig())
        c.header = ('Login', 'EMail', "Remove?")

        c.rows = [(x[0], mail_to(x[3]), link_to("Remove", \
                url(controller="project", action='userRemove', id = x[0]), \
                confirm="Are You sure?")) \
                for x in p.getUsers()]

        c.style = "width: 70%; text-align: center;"

        c.content = render("/table.html")

        return render("/temp.html")
Beispiel #6
0
    def users(self):
        checkLogin()

        c.site = "User administration"
        c.name = session['project_id']
        c.menu = genMenu(self)

        p = Project()
        p.load(c.name, getConfig())
        c.header = ('Login', 'EMail', "Remove?")

        c.rows = [(x[0], mail_to(x[3]), link_to("Remove", \
                url(controller="project", action='userRemove', id = x[0]), \
                confirm="Are You sure?")) \
                for x in p.getUsers()]

        c.style = "width: 70%; text-align: center;"

        c.content = render("/table.html")

        return render("/temp.html")
Beispiel #7
0
    def usersRequests(self):
        checkLogin()

        c.site = "User requests"
        c.name = session['project_id']
        c.menu = genMenu(self)

        p = Project()
        p.load(c.name, getConfig())
        c.header = ('Login', 'EMail', 'Accept as member', "Decline")

        c.rows = [(x[0], mail_to(x[1]), link_to("Accept", \
                url(controller="project", action='requestAccept', id = x[0])), \
                link_to("Decline", \
                url(controller="project", action='requestDecline', id = x[0]))) \
                for x in p.getRequests()]

        c.style = "width: 70%; text-align: center;"

        c.content = render("/table.html")

        return render("/temp.html")
Beispiel #8
0
    def usersRequests(self):
        checkLogin()

        c.site = "User requests"
        c.name = session['project_id']
        c.menu = genMenu(self)

        p = Project()
        p.load(c.name, getConfig())
        c.header = ('Login', 'EMail', 'Accept as member', "Decline")

        c.rows = [(x[0], mail_to(x[1]), link_to("Accept", \
                url(controller="project", action='requestAccept', id = x[0])), \
                link_to("Decline", \
                url(controller="project", action='requestDecline', id = x[0]))) \
                for x in p.getRequests()]

        c.style = "width: 70%; text-align: center;"

        c.content = render("/table.html")

        return render("/temp.html")
Beispiel #9
0
 def link(self):
     return mail_to(self.email_address, self.display_name, subject=u'[SAUCE] ')
Beispiel #10
0
 def link(self):
     return mail_to(self.email_address,
                    self.display_name,
                    subject=u'[SAUCE] ')
Beispiel #11
0
 def test_mail_to_with_img(self):
     self.assertEqual(
         u'<a href="mailto:[email protected]"><img src="/feedback.png" /></a>',
         mail_to("*****@*****.**", HTML.literal('<img src="/feedback.png" />')),
     )
Beispiel #12
0
 def test_mail_to_with_javascript(self):
     self.assertEqual(
         u"<script type=\"text/javascript\">\n//<![CDATA[\neval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b'))\n//]]>\n</script>",
         mail_to("*****@*****.**", "My email", encode="javascript"),
     )