Exemple #1
0
    def _create_facebook_button(self, url, locale):
        width = self._facebook_width
        font = self._facebook_font
        layout = self._facebook_layout

        params = {
            'width': width,
            'font': font,
            'layout': layout,
            'send': 'false',
            'action': 'like'
        }
        if url:
            params['url'] = url
        if locale:
            params['locale'] = locale
        src = '//www.facebook.com/plugins/like.php?' + unicode_urlencode(
            params)
        style = 'border:none;overflow:hidden;width:%(width)spx;height:21px' \
                % {'width': width}
        return [
            tag.iframe(src=src,
                       scrolling='no',
                       frameborder='0',
                       style=style,
                       allowTransparency='true'),
        ]
 def noscript_fallback_tag(self):
     return tag.noscript(
         tag.iframe(src=self.noscript_url(),
                    height=300,
                    width=500,
                    frameborder=0),
         tag.br(),
         tag.textarea(name='recaptcha_challenge_field', rows=3, cols=40),
         tag.input(type='hidden',
                   name='recaptcha_response_field',
                   value='manual_challenge'),
     )
def embed_youtube(scheme, netloc, path, query, style):
    """
    Embed youtube player using iframe.
    _EMBED_YOUTUBE_DEFAULT_PARAMETERS is set to the embed player.

    see also: https://developers.google.com/youtube/player_parameters
    """
    query_dict = xform_query(query)
    set_default_parameters(query_dict, _EMBED_YOUTUBE_DEFAULT_PARAMETERS)
    video_id = query_dict.pop('v')
    query = urlencode(query_dict.items())
    url = urlunparse((scheme, netloc, '/embed/%s' % video_id, '', query, ''))
    return tag.iframe(src=url, style=xform_style(style))
    def iframe(self, src, width, height):
        """
        Create iframe.
        
        @param src:     URL to display in the iframe.
        @type src:      ``str``
        @param width:   Width of the frame.
        @type width:    ``int``
        @param height:  Height of the frame.
        @type height:   ``int``
        """
        style = "border:none; overflow:hidden; width:%spx; height:%spx;" % (width, height)

        return tag.iframe(src=src, scrolling="no", frameborder="0",
                          style=style, allowTransparency="true")
def embed_metacafe(scheme, netloc, path, query, style):
    parts = filter(None, path.split('/'))
    try:
        path = '/embed/%s/' % parts[1]
    except:
        msg = "Non-standard URL, "\
              "don't know how to process it, file a ticket please."
        raise TracError(msg)
    return tag.iframe(
        src=urlunparse((scheme, netloc, path, '', '', '')),
        allowFullScreen='true',
        frameborder=0,
        width=style['width'],
        height=style['height'],
        style=xform_style(style)
    )
Exemple #6
0
    def _create_facebook_button(self, url, locale):
        width = self._facebook_width
        font = self._facebook_font
        layout = self._facebook_layout

        params = {'width': width, 'font': font, 'layout': layout,
                  'send': 'false', 'action': 'like'}
        if url:
            params['url'] = url
        if locale:
            params['locale'] = locale
        src = '//www.facebook.com/plugins/like.php?' + unicode_urlencode(params)
        style = 'border:none;overflow:hidden;width:%(width)spx;height:21px' \
                % {'width': width}
        return [
            tag.iframe(src=src, scrolling='no', frameborder='0', style=style,
                       allowTransparency='true'),
        ]