Skip to content

Commit

Permalink
Adding WebTrends meta tags and test for them.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Socol committed May 28, 2010
1 parent 8c7185f commit cb19e8c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/search/templates/results.html
Expand Up @@ -2,6 +2,8 @@
{% extends "common/base.html" %}
{% set title = _('Search') %}
{% set styles = ('search',) %}
{% set meta = (('WT.oss', q),
('WT.oss_r', num_results)) %}

{% block content %}
<div id="basic-search" class="search-refine">
Expand Down
11 changes: 10 additions & 1 deletion apps/search/tests/test_search.py
Expand Up @@ -12,8 +12,9 @@

import mock
from nose import SkipTest
from nose.tools import assert_raises
from nose.tools import assert_raises, eq_
import test_utils
from pyquery import PyQuery as pq
import jingo

from manage import settings
Expand Down Expand Up @@ -353,6 +354,14 @@ def test_clean_excerpt(self):
self.assertEquals('<b>test</b>&lt;/style&gt;',
wc.excerpt('test</style>', 'test'))

def test_meta_tags(self):
url_ = reverse('search')
response = self.client.get(url_, {'q': 'contribute'})

doc = pq(response.content)
metas = doc('meta')
eq_(3, len(metas))


def test_sphinx_down():
"""
Expand Down
6 changes: 6 additions & 0 deletions templates/layout/base.html
Expand Up @@ -13,6 +13,12 @@
{{ css(style) }}
{% endfor %}

{% if meta %}
{% for tag in meta %}
<meta name="{{ tag[0] }}" content="{{ tag[1] }}">
{% endfor %}
{% endif %}

</head>
<body{% if classes %} class="{{ classes }}"{% endif %}>

Expand Down

0 comments on commit cb19e8c

Please sign in to comment.