[cc-commits] [SCM] cc.engine: License chooser, public domain chooser, deeds (branch master) updated. 849595be469a14f78c52a5de7c370882353bdda7

Gitosis User git at gandi0.creativecommons.org
Mon Jan 30 17:56:53 EST 2012


The branch, master has been updated
       via  849595be469a14f78c52a5de7c370882353bdda7 (commit)
       via  e005d1998f1f5cdb2063f135c00cc9fe4e531f2f (commit)
       via  75dad6329bffe42fb0dea54a8d978539e7d1de16 (commit)
       via  57f9d7a5f7d97d4e803ff0cb51174ed0df056d05 (commit)
       via  0882931bb4774298010d049792d2d0640aed1898 (commit)
       via  d589ba300328d2887247642364829cd96bfc49ec (commit)
      from  a01ad707f0b4d631c45587f847307cd3a369cbb5 (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 -----------------------------------------------------------------
commit 849595be469a14f78c52a5de7c370882353bdda7
Merge: e005d19 75dad63
Author: Jonathan Palecek <jonathan at creativecommons.org>
Date:   Mon Jan 30 16:08:04 2012 -0600

    Merge branch 'issue_1011' into next

commit e005d1998f1f5cdb2063f135c00cc9fe4e531f2f
Merge: 0882931 57f9d7a
Author: Jonathan Palecek <jonathan at creativecommons.org>
Date:   Mon Jan 30 16:07:42 2012 -0600

    Merge branch 'next' of code.creativecommons.org:cc.engine into next

commit 75dad6329bffe42fb0dea54a8d978539e7d1de16
Author: Jonathan Palecek <jonathan at creativecommons.org>
Date:   Mon Jan 30 16:06:42 2012 -0600

    removed exraneous name attribute from anchor tags

commit 57f9d7a5f7d97d4e803ff0cb51174ed0df056d05
Merge: d589ba3 a01ad70
Author: Christopher Allan Webber <cwebber at dustycloud.org>
Date:   Mon Jan 30 12:54:02 2012 -0600

    Merge branch 'master' into next

commit 0882931bb4774298010d049792d2d0640aed1898
Author: Jonathan Palecek <jonathan at creativecommons.org>
Date:   Fri Jan 27 16:24:45 2012 -0600

    adjusted test to validate correctly

commit d589ba300328d2887247642364829cd96bfc49ec
Author: Jonathan Palecek <jonathan at creativecommons.org>
Date:   Thu Jan 26 18:00:49 2012 -0600

    Added a w3 validation test for some of the deed pages.

-----------------------------------------------------------------------

Summary of changes (followed by patch):
 cc/engine/templates/licenses/pdmark_deed.html |   21 +++----
 cc/engine/templates/licenses/zero_deed.html   |    9 ++--
 cc/engine/tests/test_views.py                 |   73 +++++++++++++++++++++++++
 setup.py                                      |    1 +
 4 files changed, 87 insertions(+), 17 deletions(-)

diff --git a/cc/engine/templates/licenses/pdmark_deed.html b/cc/engine/templates/licenses/pdmark_deed.html
index 0ded2e9..d0a6c89 100644
--- a/cc/engine/templates/licenses/pdmark_deed.html
+++ b/cc/engine/templates/licenses/pdmark_deed.html
@@ -23,8 +23,7 @@
         <div>
           <ul>
             <li class="license usage-guidelines" style="display:none;">
-              <a href="#" id="usage_guidelines"
-                 name="usage_guidelines">Non-binding use guidelines</a>
+              <a href="#" id="usage_guidelines">Non-binding use guidelines</a>
               apply to this work.
             </li>
             <li class="license nolaw" style="display:none;">
@@ -32,8 +31,7 @@
               waived any and all copyrights he or she may have in the
               work, including all related and neighboring rights, to the
               extent allowed by law.
-              <a href="" class="helpLink" id="zero_help"
-                 name="zero_help">
+              <a href="" class="helpLink" id="zero_help">
                 <img src="http://creativecommons.org/images/information.png"
                      alt="Information" style="border: none; float:inherit;
                                               margin-bottom:-5px" /></a>
@@ -58,7 +56,7 @@
 
             <li id="work-attribution-container" style="margin-top: 25px; display:none;">
               <strong>
-                {% trans %}You can <a href="" class="helpLink" id="citation_help" name="citation_help">cite</a> this work with this HTML:{% endtrans %}
+                {% trans %}You can <a href="" class="helpLink" id="citation_help">cite</a> this work with this HTML:{% endtrans %}
               </strong>
               <br />
               <input id="work-attribution" value="" />
@@ -76,19 +74,19 @@
         <strong>{% trans %}Other Information{% endtrans %}</strong>
         <ul>
           <li>
-            {% trans %}The work may not be free of known copyright restrictions in all <a href="" class="helpLink" id="all_jurisdictions" name="all_jurisdictions">jurisdictions</a>.{% endtrans %}
+            {% trans %}The work may not be free of known copyright restrictions in all <a href="" class="helpLink" id="all_jurisdictions">jurisdictions</a>.{% endtrans %}
           </li>
           <li>
-            {% trans %}Persons may have other rights in or related to the work, such as patent or trademark rights, and others may have rights in how the work is used, such as <a href="http://wiki.creativecommons.org/Frequently_Asked_Questions#When_are_publicity_rights_relevant.3F" class="helpLink" id="publicity_rights" name="publicity_rights">publicity or privacy</a> rights.{% endtrans %}
+            {% trans %}Persons may have other rights in or related to the work, such as patent or trademark rights, and others may have rights in how the work is used, such as <a href="http://wiki.creativecommons.org/Frequently_Asked_Questions#When_are_publicity_rights_relevant.3F" class="helpLink" id="publicity_rights">publicity or privacy</a> rights.{% endtrans %}
           </li>
           <li>
-            {% trans %}In some jurisdictions <a href="" class="helpLink" id="moral_rights" name="moral_rights">moral rights</a> of the author may persist beyond the term of copyright. These rights may include the right to be identified as the author and the right to object to derogatory treatments.{% endtrans %}
+            {% trans %}In some jurisdictions <a href="" class="helpLink" id="moral_rights">moral rights</a> of the author may persist beyond the term of copyright. These rights may include the right to be identified as the author and the right to object to derogatory treatments.{% endtrans %}
           </li>
           <li>
             {% trans %}Unless expressly stated otherwise, the person who identified the work makes no warranties about the work, and disclaims liability for all uses of the work, to the fullest extent permitted by applicable law.{% endtrans %}
           </li>
           <li>
-            {% trans %}When using or citing the work, you should not imply <a href="" class="helpLink" id="endorsement" name="endorsement">endorsement</a> by the author or the person who identified the work.{% endtrans %}
+            {% trans %}When using or citing the work, you should not imply <a href="" class="helpLink" id="endorsement">endorsement</a> by the author or the person who identified the work.{% endtrans %}
           </li>
         </ul>
       </li>
@@ -178,7 +176,7 @@
 
 {% block footer %}
   <a href="" id="disclaimer"
-     class="helpLink" name="disclaimer">{% trans %}Disclaimer{% endtrans %}</a>
+     class="helpLink">{% trans %}Disclaimer{% endtrans %}</a>
   <div id="cc-link">
     <a rel="dc:creator dct:creator" href="http://creativecommons.org/">
       <span property="dc:title dct:title">{% trans %}Creative Commons{% endtrans %}</span>
@@ -193,6 +191,5 @@
 {% endblock footer %}
 
 {% block use_this_license %}
-  <a id="get_this" href="/publicdomain/"
-     name="get_this">{% trans %}Use this tool to mark other public domain works.{% endtrans %}</a>
+  <a id="get_this" href="/publicdomain/">{% trans %}Use this tool to mark other public domain works.{% endtrans %}</a>
 {% endblock use_this_license %}
diff --git a/cc/engine/templates/licenses/zero_deed.html b/cc/engine/templates/licenses/zero_deed.html
index 60f139e..343ec9d 100644
--- a/cc/engine/templates/licenses/zero_deed.html
+++ b/cc/engine/templates/licenses/zero_deed.html
@@ -41,8 +41,7 @@
         <div>
           <ul>
             <li class="license usage-guidelines" style="display:none;">
-              <a href="#" id="usage_guidelines"
-                 name="usage_guidelines">Non-binding use guidelines</a>
+              <a href="#" id="usage_guidelines">Non-binding use guidelines</a>
               apply to this work.
             </li>
 
@@ -64,7 +63,7 @@
 
             <li id="work-attribution-container" style="margin-top: 25px; display:none;">
               <strong>
-                {% trans %}You can <a href="" class="helpLink" id="citation_help" name="citation_help">cite</a> this work with this HTML:{% endtrans %}
+                {% trans %}You can <a href="" class="helpLink" id="citation_help">cite</a> this work with this HTML:{% endtrans %}
               </strong>
               <br />
               <input id="work-attribution" value="" />
@@ -81,7 +80,7 @@
         <strong>{% trans %}Other Information{% endtrans %}</strong>
         <ul>
           <li>
-            {% trans %}In no way are the patent or trademark rights of any person affected by CC0, nor are the rights that other persons may have in the work or in how the work is used, such as <a href="http://wiki.creativecommons.org/Frequently_Asked_Questions#When_are_publicity_rights_relevant.3F" class="helpLink" id="publicity_rights" name="publicity_rights">publicity or privacy</a> rights.{% endtrans %}
+            {% trans %}In no way are the patent or trademark rights of any person affected by CC0, nor are the rights that other persons may have in the work or in how the work is used, such as <a href="http://wiki.creativecommons.org/Frequently_Asked_Questions#When_are_publicity_rights_relevant.3F" class="helpLink" id="publicity_rights">publicity or privacy</a> rights.{% endtrans %}
           </li>
 
           <li>
@@ -89,7 +88,7 @@
           </li>
 
           <li>
-            {% trans %}When using or citing the work, you should not imply <a href="" class="helpLink" id="endorsement" name="endorsement">endorsement</a> by the author or the affirmer.{% endtrans %}
+            {% trans %}When using or citing the work, you should not imply <a href="" class="helpLink" id="endorsement">endorsement</a> by the author or the affirmer.{% endtrans %}
           </li>
         </ul>
       </li>
diff --git a/cc/engine/tests/test_views.py b/cc/engine/tests/test_views.py
index ad299fb..5b24127 100644
--- a/cc/engine/tests/test_views.py
+++ b/cc/engine/tests/test_views.py
@@ -5,6 +5,12 @@ import urllib
 import unittest
 from lxml import html as lxml_html
 import StringIO
+from poster.encode import multipart_encode
+from poster.streaminghttp import register_openers
+import urllib2
+import shutil
+import tempfile
+import os.path
 
 try:
     import json
@@ -772,3 +778,70 @@ def test_license_catcher():
     assert_equal(
         get_license_links(TESTAPP.get('/publicdomain/zero/', status=404)),
         ['http://creativecommons.org/publicdomain/zero/1.0/'])
+
+
+def test_deed_w3_validation():
+    """
+    Tests to see if the deeds pass the w3c validator.
+    """
+
+    paths = [
+        "/licenses/by/3.0/",
+        "/licenses/by-sa/3.0/",
+        "/licenses/by-nc/3.0/",
+        "/licenses/by-nc-sa/3.0/",
+        "/licenses/by-nc-nd/3.0/",
+        "/licenses/by-nd/3.0/",
+        "/publicdomain/zero/1.0/",
+        "/publicdomain/mark/1.0/",
+        ]
+    temp_dir = tempfile.mkdtemp()
+    failures = []
+
+    try:
+        print "\n"
+        for path in paths:
+            view_result = TESTAPP.get(path).text.encode('utf-8')
+            temp_path = os.path.join(temp_dir, "validate_me.html")
+            storage = file(temp_path, mode="w+b")
+            storage.write(view_result)
+            storage.close()
+
+            register_openers()
+            data, headers = multipart_encode({
+                    "uploaded_file" : open(temp_path),
+                    "charset" : "(detect automatically)",
+                    "doctype" : "Inline",
+                    "group" : 0,
+                    })
+            req = urllib2.Request("http://validator.w3.org/check", 
+                                  data, headers)
+            try:
+                raw = urllib2.urlopen(req).read()
+            except urllib2.HTTPError:
+                print "(proxy error... waiting 30 seconds before retry...)"
+                import time; time.sleep(30)
+                raw = urllib2.urlopen(req).read()
+            html = lxml_html.fromstring(raw)
+            result = html.get_element_by_id("result")
+            if result.findall("h3")[0].text == "Congratulations":
+                print "\n==>", path, "passes the w3c validator :D\n"
+                continue
+            else:
+                print "\n==>", path, "fails the w3c validator:\n"
+                errors = html.get_element_by_id("error_loop").findall("*")
+                error_count = len(errors)
+                failures.append((path, error_count))
+                for error in errors:
+                    text = [i.text for i in error.findall("*") if i.text]
+                    info = map(str.strip, text.pop(0).split("\n"))
+                    info = "".join(info).split(",")
+                    info.append("".join(text).strip())
+                    print " {0} {1}\n   {2}\n".format(*info)
+                import pdb; pdb.set_trace()
+    except:
+        # clean up tempfiles before raising an error
+        shutil.rmtree(temp_dir)
+        raise
+
+    assert not failures
diff --git a/setup.py b/setup.py
index 5e571b6..213391f 100644
--- a/setup.py
+++ b/setup.py
@@ -47,6 +47,7 @@ setup(
         'flup==1.0.2',
         'simplejson',
         'jinja2',
+        'poster', # for validation tests
         ],
 
     dependency_links = [


hooks/post-receive
-- 
cc.engine: License chooser, public domain chooser, deeds


More information about the cc-commits mailing list