commit/galaxy-central: jgoecks: Add skeleton for datasets API controller.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/7a9f3f0c7c01/ changeset: 7a9f3f0c7c01 user: jgoecks date: 2012-04-17 17:20:48 summary: Add skeleton for datasets API controller. affected #: 2 files diff -r 4afec5f8e54ae1ed72bea926bba901d326da10ef -r 7a9f3f0c7c010db0859f0c18f3244a6b77f3bf10 lib/galaxy/web/api/datasets.py --- /dev/null +++ b/lib/galaxy/web/api/datasets.py @@ -0,0 +1,44 @@ +""" +API operations on the contents of a dataset. +""" +import logging, os, string, shutil, urllib, re, socket +from cgi import escape, FieldStorage +from galaxy import util, datatypes, jobs, web, util +from galaxy.web.base.controller import * +from galaxy.util.sanitize_html import sanitize_html +from galaxy.model.orm import * + +log = logging.getLogger( __name__ ) + +class DatasetsController( BaseAPIController, UsesHistoryDatasetAssociation ): + + @web.expose_api + def index( self, trans, hda_id, **kwd ): + """ + GET /api/datasets + Lists datasets. + """ + pass + + @web.expose_api + def show( self, trans, id, deleted='False', **kwd ): + """ + GET /api/datasets/{encoded_dataset_id} + Displays information about and/or content of a dataset. + """ + + # Get HDA. + try: + hda = self.get_dataset( trans, id, check_ownership=True, check_accessible=True ) + except Exception, e: + return str( e ) + + # Return information about HDA. + rval = None + try: + rval = hda.get_api_value() + except Exception, e: + rval = "Error in dataset API at listing contents" + log.error( rval + ": %s" % str(e) ) + trans.response.status = 500 + return rval diff -r 4afec5f8e54ae1ed72bea926bba901d326da10ef -r 7a9f3f0c7c010db0859f0c18f3244a6b77f3bf10 lib/galaxy/web/buildapp.py --- a/lib/galaxy/web/buildapp.py +++ b/lib/galaxy/web/buildapp.py @@ -122,6 +122,7 @@ 'permissions', path_prefix='/api/libraries/:library_id', parent_resources=dict( member_name='library', collection_name='libraries' ) ) + webapp.api_mapper.resource( 'dataset', 'datasets', path_prefix='/api' ) webapp.api_mapper.resource( 'library', 'libraries', path_prefix='/api' ) webapp.api_mapper.resource( 'sample', 'samples', path_prefix='/api' ) webapp.api_mapper.resource( 'request', 'requests', path_prefix='/api' ) 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