Hi Peter, Thanks for the update and your contributions. Would you like me to continue with the work you've started, or would you like to continue yourself? I'll try to fit this in this week if you want to hand it off to me. Please let me know. Thanks! Greg Von Kuster On Jan 31, 2013, at 11:49 AM, Peter Cock wrote:
On Tue, Jan 29, 2013 at 4:44 PM, Peter Cock <p.j.a.cock@googlemail.com> wrote:
On Tue, Jan 29, 2013 at 4:17 PM, Greg Von Kuster <greg@bx.psu.edu> wrote:
Hi Peter,
The tool shed source is mostly in the following places.
~/lib/galaxy/webapps/community/ /lib/galaxy/tool_shed/ /lib/galaxy/util/shed_util_common.py /lib/galaxy/util/shed_util.py /template/webapps/community/
I'll get to this as soon as I can, but glad you're willing to take a look.
And according to http://wiki.galaxyproject.org/HostingALocalToolShed it gets launched via run_community.sh and is configured via community_wsgi.ini - that makes sense.
This is looking to be a bigger job than I had hoped (given the learning curve to first understand the way the ToolShed webapp works).
I do have some progress to report :)
I could get http://example.org/repositoties/owner/name to work, but http://example.org/repositoties/owner would conflict with the other URLs used as actions by the repository controller. Perhaps there is an elegant solution in the routing? For now, I am using http://example.org/view/owner/name and http://example.org/view/owner instead.
I haven't worked out how to show a full frame set, rather than just the content frame - but the following is close to what I want to do. Also, I'm using a redirect (rather than staying at the citable URL) as some of the URLs in the displayed page.
Peter
$ hg diff diff -r 04e221996871 lib/galaxy/webapps/community/buildapp.py --- a/lib/galaxy/webapps/community/buildapp.py Wed Jan 30 16:47:20 2013 -0500 +++ b/lib/galaxy/webapps/community/buildapp.py Thu Jan 31 16:42:52 2013 +0000 @@ -63,6 +63,8 @@ # Create the universe WSGI application webapp = CommunityWebApplication( app, session_cookie='galaxycommunitysession', name="community" ) add_ui_controllers( webapp, app ) + webapp.add_route( '/view/{owner}/', controller='repository', action='citable_owner' ) + webapp.add_route( '/view/{owner}/{name}/', controller='repository', action='citable_repository' ) webapp.add_route( '/:controller/:action', action='index' ) webapp.add_route( '/:action', controller='repository', action='index' ) webapp.add_route( '/repos/*path_info', controller='hg', action='handle_request', path_info='/' ) diff -r 04e221996871 lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py Wed Jan 30 16:47:20 2013 -0500 +++ b/lib/galaxy/webapps/community/controllers/repository.py Thu Jan 31 16:42:52 2013 +0000 @@ -688,6 +688,60 @@
id=trans.security.encode_id( repository.id ),
changeset_revision=v ) ) return self.repository_grid( trans, **kwd ) + + @web.expose + def citable_owner( self, trans, owner): + """Support for citeable URL for each contributor's tools, e.g. http://example.org/view/owner""" + try: + user = suc.get_user_by_username( trans, owner ) + except: + user = None + if user is None: + #Would a specific 404 error page be better? + message = "Unknown repository owner %s" % owner + return trans.response.send_redirect( web.url_for( controller='repository', + action='browse_categories', + id=None, + name=None, + owner=None, + message=message, + status='error' ) ) + #TODO - Ideally this would load the frameset, not just the frame! + #TODO - Remove the redirect (assuming the links on the page OK) + id = trans.security.encode_id( user.id ) + return trans.response.send_redirect( web.url_for( controller='repository', + action='browse_repositories', + operation="repositories_by_user", + user_id=id) ) + + @web.expose + def citable_repository( self, trans, owner, name): + """Support for citeable URL for each tool, e.g. http://example.org/view/owner/name""" + try: + repository = suc.get_repository_by_name_and_owner( trans, name, owner ) + except: + repository = None + if repository is None: + #TODO - If the owner is OK, show their repositories? + #Would a specific 404 error page be better? + message = "Unknown repository %s/%s" % (owner, name) + return trans.response.send_redirect( web.url_for( controller='repository', + action='browse_categories', + id=None, + name=None, + owner=None, + message=message, + status='error' ) ) + #Good, found the repository + id = trans.security.encode_id( repository.id ) + #TODO - Ideally this would load the frameset, not just the frame! + #TODO - Remove the redirect (assuming the links on the page OK) + #return self.view_repository(trans, id) + return trans.response.send_redirect( web.url_for( controller='repository', + action='view_repository', + id=id) ) + + @web.expose def browse_repository( self, trans, id, **kwd ): params = util.Params( kwd ) ___________________________________________________________ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: