Hi Damion, Possibly a dumb question, but I thought I'd ask: if i understand your example, you're basically end-running galaxy due to the fact that for dynamic options you can execute code. When this is called, galaxy passes in an object that lets you access the current history ID. In other contexts, I have seen code within <configfile> or similar blocks that seems to essentially be calling native python code as well. Can a similar approach be used to accomplish what you're doing more directly? For example, the other day John Chilton posted this example for the API key: #from galaxy.managers import api_keys# ${api_keys.ApiKeyManager( $__app__ ).get_or_create_api_key( $__user__ )} If I'm already using non-public APIs to get the current history ID, can it be done more directly using something analogous to the above? Thanks, Ben On Tue, May 5, 2015 at 10:33 AM, Dooley, Damion <Damion.Dooley@bccdc.ca> wrote:
About 1. find UUID of current history in tool XML wrapper? (Ben Bimber) 2. Re: find UUID of current history in tool XML wrapper? (John Chilton)
I think this will work for you, I've simplified the code. I was able to do this somewhat circuitously (=bonfire of time) for my upcoming Versioned Data tool. In your tool XML definition file:
<param name="history_id" display="radio" type="drill_down" dynamic_options="vdb_init_tool_user(__trans__)" /> ... <code file="versioned_data_form.py" />
Not sure if making history_id a hidden field would work (I seemed to recall __trans__ variable only exposed to select param).
And in a script named versioned_data_form.py we have:
def vdb_init_tool_user(trans): """ ... ALSO: squeezing history_id in this way since no other way to pass it. "trans" is provided only by tool form presentation via <code file="..."> ... """ history_id = str(trans.security.encode_id(trans.history.id))
items = [ { 'name': 'think of something to say here', 'value': history_id, 'options':[], 'selected': True } ]
return items ___________________________________________________________ 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: https://lists.galaxyproject.org/
To search Galaxy mailing lists use the unified search at: http://galaxyproject.org/search/mailinglists/