[ckan-changes] commit/ckan: 4 new changesets

Bitbucket commits-noreply at bitbucket.org
Wed Jul 20 14:43:32 UTC 2011


4 new changesets in ckan:

http://bitbucket.org/okfn/ckan/changeset/6e53bf6a8eca/
changeset:   6e53bf6a8eca
user:        dread
date:        2011-07-19 16:30:50
summary:     [build]: Specify exact version for webob, to help deb build scripts.
affected #:  1 file (20 bytes)

--- a/requires/lucid_present.txt	Tue Jul 19 12:50:02 2011 +0100
+++ b/requires/lucid_present.txt	Tue Jul 19 15:30:50 2011 +0100
@@ -10,9 +10,9 @@
 psycopg2==2.0.13
 lxml==2.2.4
 sphinx==0.6.4
-# Specifying not to use later webob because of incompatibility
+# Specifying particular version of WebOb because later version has incompatibility
 # with pylons 0.9.7 (change to imports of Multidict)
-webob<=1.0.8
+webob==1.0.8
 Pylons==0.9.7
 repoze.who==1.0.18
 tempita==0.4


http://bitbucket.org/okfn/ckan/changeset/88e47b68e42d/
changeset:   88e47b68e42d
user:        dread
date:        2011-07-19 16:39:31
summary:     [controller]: #1228 Show errors on openid login. Also use c.userobj more - more efficient and hope to avoid obscure exception where you have c.user but it is not a valid username, seen in logged_in method.
affected #:  2 files (533 bytes)

--- a/ckan/controllers/user.py	Tue Jul 19 15:30:50 2011 +0100
+++ b/ckan/controllers/user.py	Tue Jul 19 15:39:31 2011 +0100
@@ -111,15 +111,16 @@
         return render('user/register.html')
 
     def login(self):
+        if 'error' in request.params:
+            h.flash_error(request.params['error'])
         return render('user/login.html')
     
     def logged_in(self):
-        if c.user:
-            userobj = model.User.by_name(c.user)
-            response.set_cookie("ckan_user", userobj.name)
-            response.set_cookie("ckan_display_name", userobj.display_name)
-            response.set_cookie("ckan_apikey", userobj.apikey)
-            h.flash_success(_("Welcome back, %s") % userobj.display_name)
+        if c.userobj:
+            response.set_cookie("ckan_user", c.userobj.name)
+            response.set_cookie("ckan_display_name", c.userobj.display_name)
+            response.set_cookie("ckan_apikey", c.userobj.apikey)
+            h.flash_success(_("Welcome back, %s") % c.userobj.display_name)
             h.redirect_to(controller='user', action='me', id=None)
         else:
             h.flash_error('Login failed. Bad username or password.')
@@ -136,10 +137,10 @@
         if id is not None:
             user = model.User.get(id)
         else:
-            user = model.User.by_name(c.user)
+            user = c.userobj
         if user is None:
             abort(404)
-        currentuser = model.User.by_name(c.user)
+        currentuser = c.userobj
         if not (ckan.authz.Authorizer().is_sysadmin(unicode(c.user)) or user == currentuser):
             abort(401)
         c.userobj = user


--- a/ckan/tests/functional/test_user.py	Tue Jul 19 15:30:50 2011 +0100
+++ b/ckan/tests/functional/test_user.py	Tue Jul 19 15:39:31 2011 +0100
@@ -395,6 +395,12 @@
         assert 'looks like spam' in main_res, main_res
         assert 'Edit User: ' in main_res, main_res
 
+    def test_login_openid_error(self):
+        # comes back as a params like this:
+        # e.g. /user/login?error=Error%20in%20discovery:%20Error%20fetching%20XRDS%20document:%20(6,%20%22Couldn't%20resolve%20host%20'mysite.myopenid.com'%22)
+        res = self.app.get("/user/login?error=Error%20in%20discovery:%20Error%20fetching%20XRDS%20document:%20(6,%20%22Couldn't%20resolve%20host%20'mysite.myopenid.com'%22")
+        main_res = self.main_div(res)
+        assert "Couldn't resolve host" in main_res, main_res
 
     ############
     # Disabled


http://bitbucket.org/okfn/ckan/changeset/4fcd48932452/
changeset:   4fcd48932452
user:        dread
date:        2011-07-20 15:47:51
summary:     [tests][xs]: Cope with newer versions of ckanclient.
affected #:  1 file (141 bytes)

--- a/ckan/tests/wsgi_ckanclient.py	Tue Jul 19 15:39:31 2011 +0100
+++ b/ckan/tests/wsgi_ckanclient.py	Wed Jul 20 14:47:51 2011 +0100
@@ -2,7 +2,12 @@
 
 import paste.fixture
 
-from ckanclient import CkanClient, Request, CkanApiError
+from ckanclient import CkanClient, CkanApiError
+try:
+    from ckanclient import ApiRequest
+except ImportError:
+    # older versions of ckanclient
+    from ckanclient import Request as ApiRequest
 
 __all__ = ['WsgiCkanClient', 'ClientError']
 
@@ -27,7 +32,7 @@
         if data != None:
             data = urllib.urlencode({data: 1})
         # Don't use request beyond getting the method
-        req = Request(location, data, headers, method=method)
+        req = ApiRequest(location, data, headers, method=method)
 
         # Make header values ascii strings
         for key, value in headers.items():


http://bitbucket.org/okfn/ckan/changeset/703c52d3941b/
changeset:   703c52d3941b
user:        dread
date:        2011-07-20 16:30:42
summary:     [merge]
affected #:  4 files (694 bytes)

--- a/ckan/controllers/user.py	Tue Jul 19 19:46:35 2011 +0100
+++ b/ckan/controllers/user.py	Wed Jul 20 15:30:42 2011 +0100
@@ -111,15 +111,16 @@
         return render('user/register.html')
 
     def login(self):
+        if 'error' in request.params:
+            h.flash_error(request.params['error'])
         return render('user/login.html')
     
     def logged_in(self):
-        if c.user:
-            userobj = model.User.by_name(c.user)
-            response.set_cookie("ckan_user", userobj.name)
-            response.set_cookie("ckan_display_name", userobj.display_name)
-            response.set_cookie("ckan_apikey", userobj.apikey)
-            h.flash_success(_("Welcome back, %s") % userobj.display_name)
+        if c.userobj:
+            response.set_cookie("ckan_user", c.userobj.name)
+            response.set_cookie("ckan_display_name", c.userobj.display_name)
+            response.set_cookie("ckan_apikey", c.userobj.apikey)
+            h.flash_success(_("Welcome back, %s") % c.userobj.display_name)
             h.redirect_to(controller='user', action='me', id=None)
         else:
             h.flash_error('Login failed. Bad username or password.')
@@ -136,10 +137,10 @@
         if id is not None:
             user = model.User.get(id)
         else:
-            user = model.User.by_name(c.user)
+            user = c.userobj
         if user is None:
             abort(404)
-        currentuser = model.User.by_name(c.user)
+        currentuser = c.userobj
         if not (ckan.authz.Authorizer().is_sysadmin(unicode(c.user)) or user == currentuser):
             abort(401)
         c.userobj = user


--- a/ckan/tests/functional/test_user.py	Tue Jul 19 19:46:35 2011 +0100
+++ b/ckan/tests/functional/test_user.py	Wed Jul 20 15:30:42 2011 +0100
@@ -395,6 +395,12 @@
         assert 'looks like spam' in main_res, main_res
         assert 'Edit User: ' in main_res, main_res
 
+    def test_login_openid_error(self):
+        # comes back as a params like this:
+        # e.g. /user/login?error=Error%20in%20discovery:%20Error%20fetching%20XRDS%20document:%20(6,%20%22Couldn't%20resolve%20host%20'mysite.myopenid.com'%22)
+        res = self.app.get("/user/login?error=Error%20in%20discovery:%20Error%20fetching%20XRDS%20document:%20(6,%20%22Couldn't%20resolve%20host%20'mysite.myopenid.com'%22")
+        main_res = self.main_div(res)
+        assert "Couldn't resolve host" in main_res, main_res
 
     ############
     # Disabled


--- a/ckan/tests/wsgi_ckanclient.py	Tue Jul 19 19:46:35 2011 +0100
+++ b/ckan/tests/wsgi_ckanclient.py	Wed Jul 20 15:30:42 2011 +0100
@@ -2,7 +2,12 @@
 
 import paste.fixture
 
-from ckanclient import CkanClient, Request, CkanApiError
+from ckanclient import CkanClient, CkanApiError
+try:
+    from ckanclient import ApiRequest
+except ImportError:
+    # older versions of ckanclient
+    from ckanclient import Request as ApiRequest
 
 __all__ = ['WsgiCkanClient', 'ClientError']
 
@@ -27,7 +32,7 @@
         if data != None:
             data = urllib.urlencode({data: 1})
         # Don't use request beyond getting the method
-        req = Request(location, data, headers, method=method)
+        req = ApiRequest(location, data, headers, method=method)
 
         # Make header values ascii strings
         for key, value in headers.items():


--- a/requires/lucid_present.txt	Tue Jul 19 19:46:35 2011 +0100
+++ b/requires/lucid_present.txt	Wed Jul 20 15:30:42 2011 +0100
@@ -10,9 +10,9 @@
 psycopg2==2.0.13
 lxml==2.2.4
 sphinx==0.6.4
-# Specifying not to use later webob because of incompatibility
+# Specifying particular version of WebOb because later version has incompatibility
 # with pylons 0.9.7 (change to imports of Multidict)
-webob<=1.0.8
+webob==1.0.8
 Pylons==0.9.7
 repoze.who==1.0.18
 tempita==0.4

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list