[cc-commits] [SCM] cc.api based on sane cc.license (branch master) updated. 0684c0a53e2fdd3e5c2758fdea25efef221d3688

git version control git at a7.creativecommons.org
Wed Jul 14 20:16:30 EDT 2010


The branch, master has been updated
       via  0684c0a53e2fdd3e5c2758fdea25efef221d3688 (commit)
      from  8ec2561395ddf17db691905e8a1f1bf8779664fb (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 0684c0a53e2fdd3e5c2758fdea25efef221d3688
Author: JED3 <jed at jedpad.(none)>
Date:   Wed Jul 14 17:16:19 2010 -0700

    Latest Unported licenses list

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

Summary of changes (followed by patch):
 cc/api/api_exceptions.py     |    3 +++
 cc/api/app.py                |    2 +-
 cc/api/resources/license.py  |    5 +++--
 cc/api/tests/test_license.py |    8 ++++++++
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/cc/api/api_exceptions.py b/cc/api/api_exceptions.py
index 8c60a4a..8b1c726 100644
--- a/cc/api/api_exceptions.py
+++ b/cc/api/api_exceptions.py
@@ -29,6 +29,9 @@ def _error_tree(error_id, message):
 def invalidclass():
     return _error_tree('invalidclass', 'Invalid License Class.')
 
+def invalidjurisdiction():
+    return _error_tree('invalidjurisdiction', 'Invalid License Jurisdiction.')
+
 def invaliduri():
     return _error_tree('invaliduri', 'Invalid license uri.')
 
diff --git a/cc/api/app.py b/cc/api/app.py
index c85b3d9..dbef018 100644
--- a/cc/api/app.py
+++ b/cc/api/app.py
@@ -31,7 +31,7 @@ urls = ( # tuple of url to resource method mappings
     '/license/([\w\d]+)',       'cc.api.resources.license.index',
     '/license/([\w\d]+)/issue', 'cc.api.resources.license.issue',
     '/license/([\w\d]+)/get',   'cc.api.resources.license.issue_get',
-    '/license/standard/jurisdiction/([\w]+)', 'cc.api.resources.license.jurisdiction',
+    '/license/standard/jurisdiction/([\w]*)', 'cc.api.resources.license.jurisdiction',
     
     '/simple/chooser',        'cc.api.resources.simple.chooser',
     '/simple/chooser.js',     'cc.api.resources.simple.chooser_js',
diff --git a/cc/api/resources/license.py b/cc/api/resources/license.py
index ad6324d..8bf8b45 100644
--- a/cc/api/resources/license.py
+++ b/cc/api/resources/license.py
@@ -160,7 +160,7 @@ class issue_get:
 class jurisdiction:
 
     @render_as('xml')
-    def GET(self, jid):
+    def GET(self, jid=''):
         
         locale = web.input().get('locale', 'en')
 
@@ -181,7 +181,8 @@ class jurisdiction:
         licenses = cc.license.jurisdictions.get_licenses_by_code(str(jid))
 
         if current_only:
-            current_version = cc.license._lib.functions.current_version('by', str(jid))
+            current_version = cc.license._lib.functions.current_version('by',
+                                                                        str(jid))
         
         for l in licenses:
             license = cc.license.by_uri(l)
diff --git a/cc/api/tests/test_license.py b/cc/api/tests/test_license.py
index 1817932..f17b60b 100644
--- a/cc/api/tests/test_license.py
+++ b/cc/api/tests/test_license.py
@@ -312,3 +312,11 @@ class TestLicenseJurisdiction(TestApi):
         assert relax_validate(RELAX_JURISDICTION, past.body)
         current = self.app.get('/license/standard/jurisdiction/es')
         assert len(past.body) > len(current.body)
+
+    def test_get_unported(self):
+        """ license/standard/jurisdiction/ should return latest unported """
+        res = self.app.get('/license/standard/jurisdiction/')
+        assert relax_validate(RELAX_JURISDICTION, res.body)
+        assert 'Unported' in res.body
+    
+    


hooks/post-receive
-- 
cc.api based on sane cc.license



More information about the cc-commits mailing list