示例#1
0
def _handle_upload(file_cache, path, body, cache_token=None):
    source = body
    if cache_token:
        cached_file = file_cache.destination(cache_token)
        source = open(cached_file, 'rb')
        log.info("Copying cached file %s to %s" % (cached_file, path))
    copy_to_path(source, path)
    return {"path": path}
示例#2
0
def _handle_upload(file_cache, path, body, cache_token=None):
    source = body
    if cache_token:
        cached_file = file_cache.destination(cache_token)
        source = open(cached_file, 'rb')
        log.info("Copying cached file %s to %s" % (cached_file, path))
    copy_to_path(source, path)
    return {"path": path}
示例#3
0
 def execute(self, command, args={}, data=None, input_path=None, output_path=None):
     # If data set, should be unicode (on Python 2) or str (on Python 3).
     from lwr.web import routes
     from lwr.web.framework import build_func_args
     controller = getattr(routes, command)
     action = controller.func
     body_args = dict(body=self.__build_body(data, input_path))
     args = build_func_args(action, args.copy(), self.__app_args(), body_args)
     result = action(**args)
     if controller.response_type != 'file':
         return controller.body(result)
     else:
         # TODO: Add to Galaxy.
         from galaxy.util import copy_to_path
         with open(result, 'rb') as result_file:
             copy_to_path(result_file, output_path)
示例#4
0
 def execute(self,
             command,
             args={},
             data=None,
             input_path=None,
             output_path=None):
     # If data set, should be unicode (on Python 2) or str (on Python 3).
     from lwr.web import routes
     from lwr.web.framework import build_func_args
     controller = getattr(routes, command)
     action = controller.func
     body_args = dict(body=self.__build_body(data, input_path))
     args = build_func_args(action, args.copy(), self.__app_args(),
                            body_args)
     result = action(**args)
     if controller.response_type != 'file':
         return controller.body(result)
     else:
         # TODO: Add to Galaxy.
         from galaxy.util import copy_to_path
         with open(result, 'rb') as result_file:
             copy_to_path(result_file, output_path)