コード例 #1
0
def responses():
    """Renders recent Responses, with links to logs."""
    responses = Response.query().order(-Response.updated).fetch(20)

    for r in responses:
        r.source_link = util.pretty_link(r.source())
        r.target_link = util.pretty_link(r.target())
        r.log_url_path = '/log?' + urllib.parse.urlencode({
          'key': r.key.id(),
          'start_time': calendar.timegm(r.updated.timetuple()),
        })

    return render_template('responses.html', responses=responses)
コード例 #2
0
    def template_vars(self):
        responses = Response.query().order(-Response.updated).fetch(20)

        for r in responses:
            r.source_link = util.pretty_link(r.source())
            r.target_link = util.pretty_link(r.target())
            r.log_url_path = '/log?' + urllib.parse.urlencode({
              'key': r.key.id(),
              'start_time': calendar.timegm(r.updated.timetuple()),
            })

        return {
            'responses': responses,
        }
コード例 #3
0
    def template_vars(self):
        responses = Response.query().order(-Response.updated).fetch(20)

        for r in responses:
            r.source_link = util.pretty_link(r.source())
            r.target_link = util.pretty_link(r.target())
            # TODO: support inbound too
            if r.direction == 'out' and r.updated >= VERSION_1_DEPLOYED:
                r.log_url_path = '/log?' + urllib.urlencode({
                    'key': r.key.id(),
                    'start_time': calendar.timegm(r.updated.timetuple()),
                })

        return {
            'responses': responses,
        }
コード例 #4
0
ファイル: util.py プロジェクト: stedn/bridgy
  def preprocess_source(self, source):
    """Prepares a source entity for rendering in the source.html template.

    - convert image URLs to https if we're serving over SSL
    - set 'website_links' attr to list of pretty HTML links to domain_urls

    Args:
      source: :class:`models.Source` entity
    """
    if source.picture:
      source.picture = util.update_scheme(source.picture, self)
    source.website_links = [
      util.pretty_link(url, attrs={'rel': 'me', 'class': 'u-url'})
      for url in source.domain_urls]
    return source
コード例 #5
0
ファイル: util.py プロジェクト: snarfed/bridgy
  def preprocess_source(self, source):
    """Prepares a source entity for rendering in the source.html template.

    - use id as name if name isn't provided
    - convert image URLs to https if we're serving over SSL
    - set 'website_links' attr to list of pretty HTML links to domain_urls

    Args:
      source: :class:`models.Source` entity
    """
    if not source.name:
      source.name = source.key.string_id()
    if source.picture:
      source.picture = util.update_scheme(source.picture, self)
    source.website_links = [
      util.pretty_link(url, attrs={'rel': 'me', 'class': 'u-url'})
      for url in source.domain_urls]
    return source
コード例 #6
0
ファイル: util.py プロジェクト: LennonFlores/bridgy
    def preprocess_source(self, source):
        """Prepares a source entity for rendering in the source.html template.

    - use id as name if name isn't provided
    - convert image URLs to https if we're serving over SSL
    - set 'website_links' attr to list of pretty HTML links to domain_urls

    Args:
      source: Source entity
    """
        if not source.name:
            source.name = source.key.string_id()
        if source.picture:
            source.picture = util.update_scheme(source.picture, self)
        source.website_links = [
            util.pretty_link(url, attrs={
                'rel': 'me',
                'class': 'u-url'
            }) for url in source.domain_urls
        ]
        return source