[cc-commits] [SCM] cc.engine: License chooser & etc (branch next) updated. c0cf7eeaaf025375a63fa58cfad6e2f4e97f4869
git version control
git at a7.creativecommons.org
Fri Nov 19 17:51:58 EST 2010
The branch, next has been updated
via c0cf7eeaaf025375a63fa58cfad6e2f4e97f4869 (commit)
via 149f5e562951bfa5b310cee1b128ce426f881b2c (commit)
via 9c4fcfce5076d863d238f9af9d1421a64b0d87a8 (commit)
via a4e1450ba3dfe74a9f5403eccb5214e57c1a2604 (commit)
via fce09aadd1119ab0988c7960fdc943abd032f6bd (commit)
via f439827f6558475a668f6024397308817b00549a (commit)
via 5f1aa14419cae73a87c1a52e05620822341fe8b5 (commit)
via 5375a722e4e966b9b4f19f91dd291a84e5bd30fc (commit)
via b4fa6c2b9147d1c35518209cbcf1c30997512d82 (commit)
from 52e2278abd1ac35123ec5b0bc1e6f4218759f92c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes (followed by patch):
cc/engine/chooser/routing.py | 10 ++-
cc/engine/chooser/views.py | 20 +++--
cc/engine/templates/chooser_pages/gpl.pt | 125 -----------------------------
cc/engine/templates/chooser_pages/lgpl.pt | 123 ----------------------------
cc/engine/templates/licenses/fsf_deed.pt | 7 ++
cc/engine/tests/test_views.py | 35 ++++++++
cc/engine/tests/view_tests.json | 14 +++-
7 files changed, 72 insertions(+), 262 deletions(-)
delete mode 100644 cc/engine/templates/chooser_pages/gpl.pt
delete mode 100644 cc/engine/templates/chooser_pages/lgpl.pt
diff --git a/cc/engine/chooser/routing.py b/cc/engine/chooser/routing.py
index 618ed18..3e0063b 100644
--- a/cc/engine/chooser/routing.py
+++ b/cc/engine/chooser/routing.py
@@ -26,11 +26,13 @@ chooser_routes = [
controller="cc.engine.chooser.views:outdated_choosers_redirect"),
# "Special" choosers
- ## FSF choosers
+ ## FSF choosers...
+ ## (Actually, we no longer handle these ourselves, so they redirect
+ ## to gnu.org.)
Route("choose_gpl", "/cc-gpl",
- controller="cc.engine.chooser.views:gpl_chooser"),
- Route("choose_gpl", "/cc-lgpl",
- controller="cc.engine.chooser.views:lgpl_chooser"),
+ controller="cc.engine.chooser.views:gpl_redirect"),
+ Route("choose_lgpl", "/cc-lgpl",
+ controller="cc.engine.chooser.views:gpl_redirect"),
## Public domain chooser
Route("choose_publicdomain_landing", "/publicdomain-2",
diff --git a/cc/engine/chooser/views.py b/cc/engine/chooser/views.py
index 346a642..8627b18 100644
--- a/cc/engine/chooser/views.py
+++ b/cc/engine/chooser/views.py
@@ -2,7 +2,6 @@ from lxml import etree
from urlparse import urlparse, urljoin
from urllib import quote, unquote_plus, urlencode
from StringIO import StringIO
-from smtplib import SMTPException
from webob import Response, exc
from zope.i18n import translate
@@ -334,6 +333,13 @@ def choose_results_view(request):
context = _base_context(request, target_lang)
request_form = request.GET or request.POST
+
+ # Special case: if anyone is linking to GPL/LGPL (mistake on old
+ # deeds), redirect them to gnu.org
+ if request_form.get('license_code') in ("GPL", "LGPL"):
+ return exc.HTTPMovedPermanently(
+ location='http://www.gnu.org/licenses/gpl-howto.html')
+
license = _issue_license(request_form)
work_dict = _formatter_work_dict(request_form)
license_slim_logo = license.logo_method('80x15')
@@ -485,12 +491,12 @@ def work_email_send(request):
### FSF
-def gpl_chooser(request):
- return util.plain_template_view('chooser_pages/gpl.pt', request)
-
-
-def lgpl_chooser(request):
- return util.plain_template_view('chooser_pages/lgpl.pt', request)
+def gpl_redirect(request):
+ """
+ Redirect GPL and the LGPL to the appropriate location on gnu.org
+ """
+ return exc.HTTPMovedPermanently(
+ location='http://www.gnu.org/licenses/gpl-howto.html')
### Public domain
diff --git a/cc/engine/templates/chooser_pages/gpl.pt b/cc/engine/templates/chooser_pages/gpl.pt
deleted file mode 100644
index 9f884ff..0000000
--- a/cc/engine/templates/chooser_pages/gpl.pt
+++ /dev/null
@@ -1,125 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:tal="http://xml.zope.org/namespaces/tal"
- xmlns:i18n="http://xml.zope.org/namespaces/i18n"
- xmlns:metal="http://xml.zope.org/namespaces/metal"
- metal:use-macro="engine_template/macros/page"
- i18n:domain="cc_org">
- <head>
- <title metal:fill-slot="title">CC GNU GPL</title>
- </head>
-
- <body>
-
- <metal:block fill-slot="sidebar">
- <p><a href="/choose/">« back to licenses</a></p>
- </metal:block>
-
- <metal:right fill-slot="body">
- <p i18n:translate="license.fsf_explain">
- <span i18n:name="license_code">GPL</span>
- <span i18n:name="license_url">http://creativecommons.org/licenses/GPL/2.0/</span>
- <span i18n:name="license_name_full">GNU General Public License</span>
- </p>
-
- <p align="center"
- style="margin-top:20px; margin-bottom:20px; margin-left:14px; margin-right:14px;"
- class="licensebox">
-
- <!-- Creative Commons License -->
- <a href="http://creativecommons.org/licenses/GPL/2.0/">
- <img alt="CC-GNU GPL" border="0" src="http://i.creativecommons.org/l/GPL/2.0/88x62.png" /></a><br />
- <span tal:omit-tag="" i18n:translate="license.fsf_software_licensed">
-
- <span i18n:name="license_code" tal:omit-tag="">GPL</span>
- <span i18n:name="license_url" tal:omit-tag="">
- http://creativecommons.org/licenses/GPL/2.0/
- </span>
- <span i18n:name="license_version" tal:omit-tag="">2.0</span>
-
- </span>
- <!-- /Creative Commons License -->
- </p>
-
- <div align="center" style="margin:14px;">
- <table width="500" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <th width="167" i18n:translate="license.human-readable_commons_deed"/>
- <th width="167" i18n:translate="license.lawyer-readable_legal_code"/>
- <th width="166" i18n:translate="license.machine-readable_digital_code"/>
- </tr>
-
- <tr align="center">
- <td>
- <a href="http://creativecommons.org/licenses/GPL/2.0/"><img src="/images/licensedeeds/deed-gpl.gif" alt="" border="0" /></a>
- </td>
- <td>
- <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html"><img src="/images/licensedeeds/legalcode-gpl.gif" border="0" alt="" /></a>
- </td>
- <td>
- <a href="/choose/work-html-popup?license_code=GPL"
- onclick="window.open('work-html-popup?lang=en&license_code=GPL', 'html_help', width=400,height=350,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=yes,menubar=no,status=yes');return false;"><img src="/images/licensedeeds/code.gif" border="0" alt="" /></a>
- </td>
- </tr>
- </table>
- </div>
-
- <p i18n:translate="license.fsf_how_it_works">
- <span i18n:name="license_code" tal:omit-tag="">GPL</span>
- <span i18n:name="license_name_lower" tal:omit-tag="">gpl-2.0</span>
- <span i18n:name="version_title" tal:omit-tag="">2.0</span>
- <span i18n:name="license_url" tal:omit-tag="">
- http://creativecommons.org/licenses/GPL/2.0/
- </span>
- </p>
-
- <h1 i18n:translate="license.mark_software">Mark Software</h1>
-
- <p i18n:translate="license.fsf_instructions">
- Read the <a href="http://www.gnu.org/licenses/gpl-howto.html">FSF's
- instructions for including the license with your software</a>.
- </p>
-
- <p i18n:translate="license.display_software_icon">
- You can display the icon on any site you offer your software
- for download using the following markup:
- </p>
-
- <div class="textbox">
- <div align="center">
- <form action="">
- <textarea cols="30" rows="8" name="html" style="width:90%;height:150px;">
- <!-- Creative Commons License -->
- <a href="http://creativecommons.org/licenses/GPL/2.0/">
- <img alt="CC-GNU GPL" border="0"
- src="http://i.creativecommons.org/l/GPL/2.0/88x62.png" /></a>
- <br />
- <span tal:omit-tag="" i18n:translate="license.fsf_software_licensed">
- <span i18n:name="license_code" tal:omit-tag="">GPL</span>
- <span i18n:name="license_url"
- tal:omit-tag="">http://creativecommons.org/licenses/GPL/2.0/</span>
- <span i18n:name="license_version" tal:omit-tag="">2.0</span>
- </span>
- <!-- /Creative Commons License -->
- </textarea>
-
- <p>
- <input type="button"
- onclick="form.html.focus();form.html.select()"
- value="" name="grab"
- i18n:attributes="value util.Highlight_Text;" />
- [<a href="work-html-popup?license_code=GPL&lang=en"
- onclick="window.open('work-html-popup?license_code=GPL&lang=en', 'html_help', 'width=400,height=350,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=yes,menubar=no,status=yes');return false;"
- i18n:translate="license.get_html_email">
- </a>]
- </p>
- </form>
- </div>
- </div>
-
- <p> </p>
-
- <p i18n:translate="license.fsf_more_info" />
-
- </metal:right>
- </body>
-</html>
diff --git a/cc/engine/templates/chooser_pages/lgpl.pt b/cc/engine/templates/chooser_pages/lgpl.pt
deleted file mode 100644
index 91eca88..0000000
--- a/cc/engine/templates/chooser_pages/lgpl.pt
+++ /dev/null
@@ -1,123 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:tal="http://xml.zope.org/namespaces/tal"
- xmlns:i18n="http://xml.zope.org/namespaces/i18n"
- xmlns:metal="http://xml.zope.org/namespaces/metal"
- metal:use-macro="engine_template/macros/page"
- i18n:domain="cc_org">
- <head>
- <title metal:fill-slot="title">CC GNU LGPL</title>
- </head>
-
- <body>
- <metal:block fill-slot="sidebar">
- <p><a href="/choose/">« back to licenses</a></p>
- </metal:block>
-
- <metal:right fill-slot="body">
- <p i18n:translate="license.fsf_explain">
- <span i18n:name="license_code">LGPL</span>
- <span i18n:name="license_url">
- http://creativecommons.org/licenses/LGPL/2.1/
- </span>
- <span i18n:name="license_name_full">GNU Lesser General Public License</span>
- </p>
-
- <p align="center"
- style="margin-top:20px; margin-bottom:20px; margin-left:14px; margin-right:14px;" class="licensebox">
-
- <!-- Creative Commons License -->
- <a href="http://creativecommons.org/licenses/LGPL/2.1/">
- <img alt="CC-GNU LGPL" border="0" src="http://i.creativecommons.org/l/LGPL/2.1/88x62.png" /></a>
- <br />
- <span tal:omit-tag="" i18n:translate="license.fsf_software_licensed">
- <span i18n:name="license_code" tal:omit-tag="">LGPL</span>
- <span i18n:name="license_url"
- tal:omit-tag="">http://creativecommons.org/licenses/LGPL/2.1/</span>
- <span i18n:name="license_version" tal:omit-tag="">2.1</span>
- </span>
- <!-- /Creative Commons License -->
- </p>
-
- <div align="center" style="margin:14px;">
- <table width="500" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <th width="167" i18n:translate="license.human-readable_commons_deed"/>
- <th width="167" i18n:translate="license.lawyer-readable_legal_code"/>
- <th width="166" i18n:translate="license.machine-readable_digital_code"/>
- </tr>
-
- <tr align="center">
- <td>
- <a href="http://creativecommons.org/licenses/LGPL/2.1/"><img src="/images/licensedeeds/deed-gpl.gif" alt="" border="0" /></a>
- </td>
- <td>
- <a href="http://creativecommons.org/licenses/LGPL/2.1/legalcode"><img src="/images/licensedeeds/legalcode-gpl.gif" border="0" alt="" /></a>
- </td>
- <td>
- <a href="/choose/work-html-popup?license_code=LGPL"
- onclick="window.open('work-html-popup?lang=en&license_code=LGPL"
- onclick="window.open('work-html-popup?license_code=LGPL"
- onclick="window.open('work-html-popup?lang=en&license_code=LGPL', 'html_help', width=400,height=350,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=yes,menubar=no,status=yes');return false;"><img src="/images/licensedeeds/code.gif" border="0" alt="" /></a>
- </td>
- </tr>
- </table></div>
-
- <p i18n:translate="license.fsf_how_it_works">
- <span i18n:name="license_code" tal:omit-tag="">LGPL</span>
- <span i18n:name="license_name_lower" tal:omit-tag="">lgpl-2.1</span>
- <span i18n:name="version_title" tal:omit-tag="">2.1</span>
- <span i18n:name="license_url" tal:omit-tag="">
- http://creativecommons.org/licenses/LGPL/2.1/
- </span>
- </p>
-
- <h1 i18n:translate="license.mark_software">Mark Software</h1>
-
- <p i18n:translate="license.fsf_instructions">
- Read the <a href="http://www.gnu.org/licenses/gpl-howto.html">FSF's
- instructions for including the license with your software</a>.
- </p>
-
- <p i18n:translate="license.display_software_icon">
- You can display the icon on any site you offer your software
- for download using the following markup:
- </p>
-
- <div class="textbox">
- <div align="center">
- <form action="">
- <textarea cols="30" rows="8" name="html" style="width:90%;height:150px;">
- <!-- Creative Commons License -->
- <a href="http://creativecommons.org/licenses/LGPL/2.1/">
- <img alt="CC-GNU LGPL" border="0"
- src="http://i.creativecommons.org/l/LGPL/2.1/88x62.png" />
- </a>
- <br />
- <span tal:omit-tag="" i18n:translate="license.fsf_software_licensed">
- <span i18n:name="license_code" tal:omit-tag="">LGPL</span>
- <span i18n:name="license_url"
- tal:omit-tag="">http://creativecommons.org/licenses/LGPL/2.1/</span>
- <span i18n:name="license_version" tal:omit-tag="">2.1</span>
- </span>
- <!-- /Creative Commons License -->
- </textarea>
-
- <p>
- <input type="button"
- onclick="form.html.focus();form.html.select()"
- value="" name="grab"
- i18n:attributes="value util.Highlight_Text;" />
- [<a href="work-html-popup?license_code=LGPL&lang=en"
- onclick="window.open('work-html-popup?license_code=LGPL&lang=en', 'html_help', 'width=400,height=350,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=yes,menubar=no,status=yes');return false;" i18n:translate="license.get_html_email">
- </a>]
- </p>
- </form>
- </div>
- </div>
-
- <p> </p>
-
- <p i18n:translate="license.fsf_more_info" />
- </metal:right>
- </body>
-</html>
diff --git a/cc/engine/templates/licenses/fsf_deed.pt b/cc/engine/templates/licenses/fsf_deed.pt
index 06b954f..2a884ad 100644
--- a/cc/engine/templates/licenses/fsf_deed.pt
+++ b/cc/engine/templates/licenses/fsf_deed.pt
@@ -97,5 +97,12 @@
</p>
</div>
+ <metal:use-this-license metal:fill-slot="use-this-license">
+ <a id="get_this" href=""
+ i18n:translate="deed.use_this_license"
+ tal:attributes="href string:http://www.gnu.org/licenses/gpl-howto.html">
+ Use this license for your own work.</a>
+ </metal:use-this-license>
+
</body>
</html>
diff --git a/cc/engine/tests/test_views.py b/cc/engine/tests/test_views.py
index e5c6704..1cbfa3a 100644
--- a/cc/engine/tests/test_views.py
+++ b/cc/engine/tests/test_views.py
@@ -171,6 +171,41 @@ def test_license_to_choose_redirect():
'work_title': ['SubZero']}
+def test_gpl_lgpl_redirects():
+ """
+ /choose/cc-gpl and /choose/cc-lgpl should now redirect to gnu.org,
+ make sure that happens
+ """
+ gpl_redirect = TESTAPP.get('/choose/cc-gpl').location
+ lgpl_redirect = TESTAPP.get('/choose/cc-lgpl').location
+ expected_redirect = 'http://www.gnu.org/licenses/gpl-howto.html'
+ assert gpl_redirect == lgpl_redirect == expected_redirect
+
+
+def test_normalchooser_gpl_redirects():
+ """
+ There was an error on the old GPL/LGPL deeds where they pointed to
+ the chooser when they should have pointed to gnu.org. As such,
+ when license_code=GPL or LGPL, we should redirect.
+ """
+ gpl_redirect = TESTAPP.get(
+ '/choose/results-one'
+ '?license_code=GPL&jurisdiction=&version=2.0&lang=en').location
+ lgpl_redirect = TESTAPP.get(
+ '/choose/results-one'
+ '?license_code=LGPL&jurisdiction=&version=2.0&lang=en').location
+ expected_redirect = 'http://www.gnu.org/licenses/gpl-howto.html'
+ assert gpl_redirect == lgpl_redirect == expected_redirect
+
+ # But, no other license_code should redirect...
+ assert not TESTAPP.get(
+ '/choose/results-one'
+ '?license_code=by&jurisdiction=&version=2.0&lang=en').location
+ assert not TESTAPP.get(
+ '/choose/results-one'
+ '?license_code=by-sa&jurisdiction=&version=2.0&lang=en').location
+
+
def test_deeds_up_for_licenses():
"""
Make sure all licenses that the RDF claims exist show up with 200 OK
diff --git a/cc/engine/tests/view_tests.json b/cc/engine/tests/view_tests.json
index d394b18..5816975 100644
--- a/cc/engine/tests/view_tests.json
+++ b/cc/engine/tests/view_tests.json
@@ -28,6 +28,17 @@
{"path": "/licenses/MIT/legalcode"},
{"path": "/licenses/BSD/legalcode"},
+ {"path": "/licenses/GPL/2.0/",
+ "string_tests": [
+ "GNU General Public License",
+ "The freedom to run the program for any purpose.",
+ "http://www.gnu.org/licenses/gpl-howto.html"]},
+ {"path": "/licenses/LGPL/2.1/",
+ "string_tests": [
+ "GNU Lesser General Public License",
+ "The freedom to run the program for any purpose.",
+ "http://www.gnu.org/licenses/gpl-howto.html"]},
+
{"path": "/licenses/publicdomain/"},
{"path": "/licenses/publicdomain/deed"},
{"path": "/licenses/publicdomain/deed.es"},
@@ -52,9 +63,6 @@
{"path": "/choose/?partner=FreeMusicArchive&jurisdiction_choose=1&exit_url=http%3A%2F%2Ffreemusicarchive.org%2Fcontribute%2FccLicense%2FThe_Wild_Tape%3Flicense_url%3D[license_url]%26license_name%3D[license_name]%26license_button%3D[license_button]%26deed_url%3D[deed_url]"},
{"path": "/choose/get-html?license_url=http%3A%2F%2Fcreativecommons.org%2Flicenses%2Fby-nc-sa%2F2.0%2Fde%2F"},
- {"path": "/choose/cc-gpl"},
- {"path": "/choose/cc-lgpl"},
-
{"path": "/choose/publicdomain-2"},
{"path": "/choose/publicdomain-3"},
{"path": "/choose/publicdomain-4"},
hooks/post-receive
--
cc.engine: License chooser & etc
More information about the cc-commits
mailing list