Thanks for the help John and Dannon. I'll see if it works tomorrow. No need to raise a trello card

Thanks
Neil

From: Dannon Baker [dannon.baker@gmail.com]
Sent: Tuesday, August 05, 2014 11:14 PM
To: John Chilton
Cc: Burdett, Neil (DP&S, Herston - RBWH); galaxy-dev@lists.bx.psu.edu
Subject: Re: [galaxy-dev] error using get( $__user_id__ ) in xml file in new Galaxy

The method John suggests is definitely a better way to get the user's API key.

That said, the 'get' change is due to sqlalchemy version changes that happened quite a while back.  You can no longer 'get' directly from the model, you must use a query object.  So, for example, this line:

    model.User.get( id )

Became:

    sa_session.query( self.model.User).get( id )

Hope that gives a little context,

-Dannon


On Tue, Aug 5, 2014 at 8:56 AM, John Chilton <jmchilton@gmail.com> wrote:
Hmm...

The following should work for the last at least three releases I
think: ${__user__.api_keys[0].key}. Not sure why get/find are
unavailable on the User model class in the cheetah template now. I
think this version is a little better. Is this okay? If not I can
create a Trello card to investigate and restore the old functionality.

-John


On Tue, Aug 5, 2014 at 2:26 AM,  <Neil.Burdett@csiro.au> wrote:
> Hi,
>     I have recently upgraded Galaxy from a version I had last year. In my
> tool xml file I could state:
>
> ${ __app__.model.User.get( $__user_id__ ).api_keys[0].key }
>
> in the <command> section to get the user's API. However, after updating to
> the current version of Galaxy I get the following error when using this
> entry in the xml file:
>
> Traceback (most recent call last):
>   File "/home/bmladmin/galaxy-dist/lib/galaxy/jobs/runners/__init__.py",
> line 153, in prepare_job
>     job_wrapper.prepare()
>   File "/home/bmladmin/galaxy-dist/lib/galaxy/jobs/__init__.py", line 712,
> in prepare
>     self.command_line, self.extra_filenames = tool_evaluator.build()
>   File "/home/bmladmin/galaxy-dist/lib/galaxy/tools/evaluation.py", line
> 348, in build
>     self.__build_command_line( )
>   File "/home/bmladmin/galaxy-dist/lib/galaxy/tools/evaluation.py", line
> 364, in __build_command_line
>     command_line = fill_template( command, context=param_dict )
>   File "/home/bmladmin/galaxy-dist/lib/galaxy/util/template.py", line 9, in
> fill_template
>     return str( Template( source=template_text, searchList=[context] ) )
>   File
> "/home/bmladmin/galaxy-dist/eggs/Cheetah-2.2.2-py2.7-linux-x86_64-ucs4.egg/Cheetah/Template.py",
> line 1004, in __str__
>     return getattr(self, mainMethName)()
>   File "cheetah_DynamicallyCompiledCheetahTemplate_1407207170_7_53169.py",
> line 92, in respond
> NotFound: cannot find 'get' while searching for 'get'
>
> Any ideas?
>
> Thanks
> Neil
>
>
>
> ___________________________________________________________
> 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:
>   http://lists.bx.psu.edu/
>
> To search Galaxy mailing lists use the unified search at:
>   http://galaxyproject.org/search/mailinglists/
___________________________________________________________
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:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/