示例#1
0
    def get_flag_html(self, scale=1.0):
        # flags are expected to be 32x21
        width = int(round(32.0 * scale))
        height = int(round(21.0 * scale))

        html = '<img src="{}"  width="{}" height="{}">'
        output = html.format(countries.get_flag_img_path(self.flag), width,
                             height)
        return Markup(output)
示例#2
0
    def get_flag_html(self, scale=1.0):
        # flags are expected to be 32x21
        width = int(round(32.0 * scale))
        height = int(round(21.0 * scale))

        html = '<img src="{}"  width="{}" height="{}">'
        output = html.format(
            countries.get_flag_img_path(self.flag), width, height)
        return Markup(output)
示例#3
0
 def test_get_flag_img_path(self):
     self.assertEqual(get_flag_img_path(
         'us'), '/static/img/valve_flags/us.png')
     self.assertEqual(get_flag_img_path(
         'US'), '/static/img/valve_flags/us.png')
     self.assertEqual(get_flag_img_path(
         'fr'), '/static/img/valve_flags/fr.png')
     self.assertEqual(get_flag_img_path(
         'FR'), '/static/img/valve_flags/fr.png')
     self.assertEqual(get_flag_img_path('f'), '/static/img/_unknown.png')
     self.assertEqual(get_flag_img_path(''), '/static/img/_unknown.png')
示例#4
0
 def test_get_flag_img_path(self):
     self.assertEqual(get_flag_img_path('us'),
                      '/static/img/valve_flags/us.png')
     self.assertEqual(get_flag_img_path('US'),
                      '/static/img/valve_flags/us.png')
     self.assertEqual(get_flag_img_path('fr'),
                      '/static/img/valve_flags/fr.png')
     self.assertEqual(get_flag_img_path('FR'),
                      '/static/img/valve_flags/fr.png')
     self.assertEqual(get_flag_img_path('f'), '/static/img/_unknown.png')
     self.assertEqual(get_flag_img_path(''), '/static/img/_unknown.png')