contrib vs. eula wrangling (bug 561201)

This commit is contained in:
Jeff Balogh 2010-04-23 16:59:11 -07:00
Родитель 8812cc9719
Коммит 8d60b410ec
6 изменённых файлов: 296 добавлений и 4 удалений

Просмотреть файл

@ -79,10 +79,10 @@ class InstallButton(object):
and addon.is_featured(app, lang)
or addon.is_category_featured(app, lang))
self.show_eula = show_eula and addon.has_eula
self.accept_eula = addon.has_eula and not show_eula
self.show_contrib = (show_contrib and addon.takes_contributions
and addon.annoying == amo.CONTRIB_ROADBLOCK)
self.show_eula = not self.show_contrib and show_eula and addon.has_eula
self.show_warning = show_warning and (self.unreviewed or
self.self_hosted)

Просмотреть файл

@ -0,0 +1,273 @@
[
{
"pk": 426,
"model": "translations.translation",
"fields": {
"localized_string_clean": null,
"created": "2007-03-05 13:08:05",
"locale": "en-US",
"modified": "2007-03-22 21:54:38",
"id": 151,
"localized_string": "Add these search engines to the Search Bar in the upper-right corner of %1$s, for quick access to your favorite search sites."
}
},
{
"pk": 258,
"model": "translations.translation",
"fields": {
"localized_string_clean": null,
"created": "2007-03-05 13:08:05",
"locale": "en-US",
"modified": "2007-03-22 21:54:38",
"id": 145,
"localized_string": "Search Engines"
}
},
{
"pk": 83,
"model": "translations.translation",
"fields": {
"localized_string_clean": null,
"created": "2007-03-05 13:08:05",
"locale": "en-US",
"modified": "2007-03-22 21:54:38",
"id": 4,
"localized_string": "Search Engine"
}
},
{
"pk": 603848,
"model": "translations.translation",
"fields": {
"localized_string_clean": null,
"created": "2009-09-17 03:54:26",
"locale": "en-US",
"modified": "2009-09-17 03:55:20",
"id": 559112,
"localized_string": "Raising awareness about IPv6 is important. Start now!"
}
},
{
"pk": 410711,
"model": "translations.translation",
"fields": {
"localized_string_clean": null,
"created": "2009-04-30 16:54:06",
"locale": "en-US",
"modified": "2009-08-31 07:58:03",
"id": 372438,
"localized_string": "!!! THE PLUGIN DOES NOT PROVIDE IPv6 CONNECTIVITY !!!\r\n\r\nFor troubleshooting tips and questions - please visit:\r\nhttp://blog.ooz.ie/2009/05/ipv6-google-search-firefox-plugin.html\r\n\r\nTHERE IS NO WARRANTY FOR THE PLUGIN. IT IS PROVIDED \u201cAS IS\u201d WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PLUGIN IS WITH YOU. SHOULD THE PLUGIN PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\r\n"
}
},
{
"pk": 410710,
"model": "translations.translation",
"fields": {
"localized_string_clean": "Visit\n<a href=\"http://outgoing.mozilla.org/v1/94aabf779ab5c0bbf8c09fcbbdd553ee89201a84/http%3A//blog.ooz.ie/2009/05/ipv6-google-search-firefox-plugin.html\">http://blog.ooz.ie/2009/05/ipv6-google-search-firefox-plugin.html</a> \nfor more info.",
"created": "2009-04-30 16:54:06",
"locale": "en-US",
"modified": "2009-09-05 15:27:55",
"id": 372437,
"localized_string": "Visit\r\nhttp://blog.ooz.ie/2009/05/ipv6-google-search-firefox-plugin.html \r\nfor more info."
}
},
{
"pk": 410708,
"model": "translations.translation",
"fields": {
"localized_string_clean": "An OpenSearch plugin for Google on IPv6.\n\nGot IPv6 connectivity? Be one of the first Internauts to use <a href=\"http://outgoing.mozilla.org/v1/25484e0713c851c7e65de9b708c980e21df186fb/http%3A//ipv6.google.com/\">http://ipv6.google.com/</a> as your default search engine! ",
"created": "2009-04-30 16:54:05",
"locale": "en-US",
"modified": "2009-05-05 16:45:15",
"id": 372435,
"localized_string": "An OpenSearch plugin for Google on IPv6.\r\n\r\nGot IPv6 connectivity? Be one of the first Internauts to use http://ipv6.google.com/ as your default search engine! "
}
},
{
"pk": 410709,
"model": "translations.translation",
"fields": {
"localized_string_clean": "This search plugin will point your search queries to <a href=\"http://outgoing.mozilla.org/v1/25484e0713c851c7e65de9b708c980e21df186fb/http%3A//ipv6.google.com/\">http://ipv6.google.com/</a>\nIPv6 connectivity is a prerequisite.",
"created": "2009-04-30 16:54:06",
"locale": "en-US",
"modified": "2009-05-02 06:45:50",
"id": 372436,
"localized_string": "This search plugin will point your search queries to http://ipv6.google.com/\r\nIPv6 connectivity is a prerequisite."
}
},
{
"pk": 591396,
"model": "translations.translation",
"fields": {
"localized_string_clean": null,
"created": "2009-09-05 15:29:58",
"locale": "en-US",
"modified": null,
"id": 547551,
"localized_string": "http://blog.ooz.ie/2009/05/ipv6-google-search-firefox-plugin.html"
}
},
{
"pk": 410717,
"model": "translations.translation",
"fields": {
"localized_string_clean": null,
"created": "2009-04-30 17:05:20",
"locale": "en-US",
"modified": "2009-05-03 12:38:00",
"id": 372444,
"localized_string": "support@ooz.ie"
}
},
{
"pk": 410716,
"model": "translations.translation",
"fields": {
"localized_string_clean": null,
"created": "2009-04-30 17:05:19",
"locale": "en-US",
"modified": "2009-05-03 12:37:59",
"id": 372443,
"localized_string": "http://blog.ooz.ie/2009/05/ipv6-google-search-firefox-plugin.html"
}
},
{
"pk": 4,
"model": "addons.addontype",
"fields": {
"description": 151,
"name_plural": 145,
"modified": "2009-02-06 08:42:28",
"name": 4,
"created": "2006-08-21 23:53:36"
}
},
{
"pk": 410718,
"model": "translations.translation",
"fields": {
"localized_string_clean": null,
"created": "2009-04-30 17:08:04",
"locale": "en-US",
"modified": null,
"id": 372445,
"localized_string": "IPv6 Google Search"
}
},
{
"pk": 423049,
"model": "translations.translation",
"fields": {
"localized_string_clean": "Minor prettifying changes made, including:\n- removing new line characters from the XML document\n- changing \"/?#q=\" paramenter to \"/search?q=\" .",
"created": "2009-05-21 05:39:12",
"locale": "en-US",
"modified": null,
"id": 384472,
"localized_string": "Minor prettifying changes made, including:\r\n- removing new line characters from the XML document\r\n- changing \"/?#q=\" paramenter to \"/search?q=\" ."
}
},
{
"pk": 6,
"model": "versions.license",
"fields": {
"_custom_text": null,
"_name_field": 2,
"modified": "2009-04-30 23:48:48",
"created": "2009-04-30 23:48:48"
}
},
{
"pk": 11730,
"model": "addons.addon",
"fields": {
"dev_agreement": 1,
"eula": 372438,
"last_updated": "2009-08-27 14:29:14",
"view_source": 0,
"enable_thankyou": 0,
"total_downloads": 9149,
"developer_comments": 372437,
"inactive": 0,
"average_daily_downloads": 28,
"show_beta": 1,
"the_future": null,
"trusted": 0,
"locale_disambiguation": null,
"binary": 0,
"guid": null,
"weekly_downloads": 146,
"support_url": 547551,
"paypal_id": "root@ooz.ie",
"average_rating": "1.0",
"wants_contributions": 1,
"average_daily_users": 0,
"bayesian_rating": 0.0,
"share_count": 0,
"get_satisfaction_company": null,
"homepage": 372443,
"support_email": 372444,
"public_stats": 0,
"status": 4,
"privacy_policy": null,
"description": 372436,
"default_locale": "en-US",
"target_locale": null,
"prerelease": 0,
"thankyou_note": null,
"admin_review": 0,
"external_software": 0,
"highest_status": 4,
"get_satisfaction_product": null,
"name": 372445,
"created": "2009-04-30 16:42:42",
"type": 4,
"icon_type": "image/gif",
"annoying": 3,
"modified": "2009-09-17 04:09:07",
"summary": 372435,
"suggested_amount": "1.00",
"site_specific": 0,
"total_reviews": 0,
"the_reason": 559112,
"nomination_date": "2009-06-27 12:21:35"
}
},
{
"pk": 1,
"model": "files.platform",
"fields": {
"icontype": "",
"modified": "2008-04-07 08:16:55",
"created": "2007-03-05 13:09:27"
}
},
{
"pk": 68776,
"model": "versions.version",
"fields": {
"license": 6,
"created": "2009-05-21 05:37:15",
"releasenotes": 384472,
"approvalnotes": "",
"modified": "2009-05-21 05:39:14",
"version": "20090521",
"addon": 11730
}
},
{
"pk": 53612,
"model": "files.file",
"fields": {
"status": 4,
"codereview": 0,
"hash": "sha256:b2097453fca95fc7d7622164483902abf2e24e2cebdbb8a240e4b0ed05769f5a",
"created": "2009-05-21 05:37:16",
"modified": "2009-08-27 14:29:14",
"filename": "ipv6_google_search-20090521.xml",
"platform": 1,
"version": 68776,
"datestatuschanged": "2009-08-27 14:29:14",
"size": 1
}
}
]

Просмотреть файл

@ -4,5 +4,5 @@
{% block content %}
<h2>{{ _('Eula for {0}')|f(addon.name) }}</h2>
{{ install_button(addon, show_eula=False, show_warning=False) }}
{{ install_button(addon, show_contrib=False, show_eula=False, show_warning=False) }}
{% endblock content %}

Просмотреть файл

@ -5,6 +5,7 @@ from pyquery import PyQuery
import test_utils
import amo
from amo.urlresolvers import reverse
from addons.buttons import install_button
@ -87,6 +88,14 @@ class TestButtonSetup(ButtonTest):
b = self.get_button()
assert not b.show_eula
def test_eula_and_contrib(self):
"""If show_eula is True, show_contrib should be off."""
self.addon.has_eula = True
self.addon.annoying = amo.CONTRIB_ROADBLOCK
b = self.get_button(show_eula=False)
assert not b.show_eula
assert b.show_contrib
def test_src(self):
"""src defaults to '', and can be in the context or request.GET."""
b = self.get_button()
@ -387,3 +396,13 @@ class TestButtonHtml(ButtonTest):
self.addon.has_eula = True
doc = self.render()
eq_(doc('.eula .os').text(), '')
class TestViews(test_utils.TestCase):
fixtures = ['addons/eula+contrib-addon']
def test_eula_with_contrib_roadblock(self):
url = reverse('addons.eula', args=[11730, 53612])
response = self.client.get(url, follow=True)
doc = PyQuery(response.content)
eq_(doc('[data-search]').attr('class'), 'install accept')

@ -1 +1 @@
Subproject commit 521ae5997f93a0034a87da5cd25bf33c9c1a56b6
Subproject commit e20e78c323f9c103465ded9fcae9e035a4ed54a4

@ -1 +1 @@
Subproject commit 9bbdb3d0351b30a8e966ce68a2730472c71068a3
Subproject commit cd4439ec06098cde646ee7715a979afbba7ab4f3