commit/galaxy-central: 6 new changesets
6 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/87641aaefe47/ changeset: 87641aaefe47 user: chapmanb date: 2012-10-08 11:32:54 summary: Consistently return list of users from users/index for case where API user is not an admin affected #: 1 file diff -r 05fc04a70a3bcbfaeedfcf6f2ec16a7e38fc7c94 -r 87641aaefe47d1892bbbd4a7ea56cc21cab9d68c lib/galaxy/webapps/galaxy/api/users.py --- a/lib/galaxy/webapps/galaxy/api/users.py +++ b/lib/galaxy/webapps/galaxy/api/users.py @@ -33,7 +33,7 @@ if not trans.user_is_admin(): item = trans.user.get_api_value( value_mapper={ 'id': trans.security.encode_id } ) item['url'] = url_for( route, id=item['id'] ) - return item + return [item] for user in query: item = user.get_api_value( value_mapper={ 'id': trans.security.encode_id } ) item['url'] = url_for( route, id=item['id'] ) https://bitbucket.org/galaxy/galaxy-central/changeset/9abbec24c356/ changeset: 9abbec24c356 user: chapmanb date: 2012-10-08 12:25:49 summary: Provide retrieval of the current user and user history via the API affected #: 2 files diff -r 87641aaefe47d1892bbbd4a7ea56cc21cab9d68c -r 9abbec24c3566393b05a0744941361fbfba1a968 lib/galaxy/webapps/galaxy/api/histories.py --- a/lib/galaxy/webapps/galaxy/api/histories.py +++ b/lib/galaxy/webapps/galaxy/api/histories.py @@ -48,6 +48,7 @@ """ GET /api/histories/{encoded_history_id} GET /api/histories/deleted/{encoded_history_id} + GET /api/histories/current Displays information about a history. """ history_id = id @@ -65,8 +66,13 @@ rval[item['state']] = rval[item['state']] + 1 return rval try: - history = self.get_history( trans, history_id, check_ownership=True, check_accessible=True, deleted=deleted ) + if history_id == "current" and len(trans.user.galaxy_sessions) > 0: + # Most recent active history for user sessions, not deleted + history = trans.user.galaxy_sessions[0].histories[-1].history + else: + history = self.get_history( trans, history_id, check_ownership=True, check_accessible=True, deleted=deleted ) except Exception, e: + raise return str( e ) try: item = history.get_api_value(view='element', value_mapper={'id':trans.security.encode_id}) diff -r 87641aaefe47d1892bbbd4a7ea56cc21cab9d68c -r 9abbec24c3566393b05a0744941361fbfba1a968 lib/galaxy/webapps/galaxy/api/users.py --- a/lib/galaxy/webapps/galaxy/api/users.py +++ b/lib/galaxy/webapps/galaxy/api/users.py @@ -45,11 +45,15 @@ """ GET /api/users/{encoded_user_id} GET /api/users/deleted/{encoded_user_id} + GET /api/users/current Displays information about a user. """ deleted = util.string_as_bool( deleted ) try: - user = self.get_user( trans, id, deleted=deleted ) + if id == "current": + user = trans.user + else: + user = self.get_user( trans, id, deleted=deleted ) if not trans.user_is_admin(): assert trans.user == user assert not user.deleted https://bitbucket.org/galaxy/galaxy-central/changeset/f5772000c6d9/ changeset: f5772000c6d9 user: chapmanb date: 2012-10-08 12:27:29 summary: Remove extra debugging statement affected #: 1 file diff -r 9abbec24c3566393b05a0744941361fbfba1a968 -r f5772000c6d9ea5d15b1332f2ea42330e645371d lib/galaxy/webapps/galaxy/api/histories.py --- a/lib/galaxy/webapps/galaxy/api/histories.py +++ b/lib/galaxy/webapps/galaxy/api/histories.py @@ -72,7 +72,6 @@ else: history = self.get_history( trans, history_id, check_ownership=True, check_accessible=True, deleted=deleted ) except Exception, e: - raise return str( e ) try: item = history.get_api_value(view='element', value_mapper={'id':trans.security.encode_id}) https://bitbucket.org/galaxy/galaxy-central/changeset/2bfdbe09caf7/ changeset: 2bfdbe09caf7 user: chapmanb date: 2012-10-09 11:39:15 summary: Defensively check for user and histories before retrieving current history from API affected #: 1 file diff -r f5772000c6d9ea5d15b1332f2ea42330e645371d -r 2bfdbe09caf7fd1e49fb5fcdfbb1665764ed39ed lib/galaxy/webapps/galaxy/api/histories.py --- a/lib/galaxy/webapps/galaxy/api/histories.py +++ b/lib/galaxy/webapps/galaxy/api/histories.py @@ -66,9 +66,12 @@ rval[item['state']] = rval[item['state']] + 1 return rval try: - if history_id == "current" and len(trans.user.galaxy_sessions) > 0: - # Most recent active history for user sessions, not deleted - history = trans.user.galaxy_sessions[0].histories[-1].history + if history_id == "current": + if trans.user and len(trans.user.galaxy_sessions) > 0: + # Most recent active history for user sessions, not deleted + history = trans.user.galaxy_sessions[0].histories[-1].history + else: + history = None else: history = self.get_history( trans, history_id, check_ownership=True, check_accessible=True, deleted=deleted ) except Exception, e: https://bitbucket.org/galaxy/galaxy-central/changeset/e7178dd7f9db/ changeset: e7178dd7f9db user: chapmanb date: 2012-10-10 12:53:33 summary: Rename history retrieval to reflect multiple sessions: most_recently_used affected #: 1 file diff -r 2bfdbe09caf7fd1e49fb5fcdfbb1665764ed39ed -r e7178dd7f9dbb22c880627c2fb9c05cb696392cf lib/galaxy/webapps/galaxy/api/histories.py --- a/lib/galaxy/webapps/galaxy/api/histories.py +++ b/lib/galaxy/webapps/galaxy/api/histories.py @@ -48,7 +48,7 @@ """ GET /api/histories/{encoded_history_id} GET /api/histories/deleted/{encoded_history_id} - GET /api/histories/current + GET /api/histories/most_recently_used Displays information about a history. """ history_id = id @@ -66,7 +66,7 @@ rval[item['state']] = rval[item['state']] + 1 return rval try: - if history_id == "current": + if history_id == "most_recently_used": if trans.user and len(trans.user.galaxy_sessions) > 0: # Most recent active history for user sessions, not deleted history = trans.user.galaxy_sessions[0].histories[-1].history https://bitbucket.org/galaxy/galaxy-central/changeset/666e873a21a0/ changeset: 666e873a21a0 user: jgoecks date: 2012-10-10 15:43:15 summary: Merged in chapmanb/galaxy-central-apicurrent (pull request #77) affected #: 2 files diff -r 220b6683e8dad3028939ff6e5a7acd76d9e994b1 -r 666e873a21a0f8032a2f7b39204b5edb6ee47797 lib/galaxy/webapps/galaxy/api/histories.py --- a/lib/galaxy/webapps/galaxy/api/histories.py +++ b/lib/galaxy/webapps/galaxy/api/histories.py @@ -48,6 +48,7 @@ """ GET /api/histories/{encoded_history_id} GET /api/histories/deleted/{encoded_history_id} + GET /api/histories/most_recently_used Displays information about a history. """ history_id = id @@ -65,7 +66,14 @@ rval[item['state']] = rval[item['state']] + 1 return rval try: - history = self.get_history( trans, history_id, check_ownership=True, check_accessible=True, deleted=deleted ) + if history_id == "most_recently_used": + if trans.user and len(trans.user.galaxy_sessions) > 0: + # Most recent active history for user sessions, not deleted + history = trans.user.galaxy_sessions[0].histories[-1].history + else: + history = None + else: + history = self.get_history( trans, history_id, check_ownership=True, check_accessible=True, deleted=deleted ) except Exception, e: return str( e ) try: diff -r 220b6683e8dad3028939ff6e5a7acd76d9e994b1 -r 666e873a21a0f8032a2f7b39204b5edb6ee47797 lib/galaxy/webapps/galaxy/api/users.py --- a/lib/galaxy/webapps/galaxy/api/users.py +++ b/lib/galaxy/webapps/galaxy/api/users.py @@ -33,7 +33,7 @@ if not trans.user_is_admin(): item = trans.user.get_api_value( value_mapper={ 'id': trans.security.encode_id } ) item['url'] = url_for( route, id=item['id'] ) - return item + return [item] for user in query: item = user.get_api_value( value_mapper={ 'id': trans.security.encode_id } ) item['url'] = url_for( route, id=item['id'] ) @@ -45,11 +45,15 @@ """ GET /api/users/{encoded_user_id} GET /api/users/deleted/{encoded_user_id} + GET /api/users/current Displays information about a user. """ deleted = util.string_as_bool( deleted ) try: - user = self.get_user( trans, id, deleted=deleted ) + if id == "current": + user = trans.user + else: + user = self.get_user( trans, id, deleted=deleted ) if not trans.user_is_admin(): assert trans.user == user assert not user.deleted Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket