From: Thierry Parmentelat Date: Sat, 14 Dec 2013 13:55:15 +0000 (+0100) Subject: the validatebutton test view in trash accepts special argument ‘logged’ so we can... X-Git-Tag: myslice-0.3-0~78 X-Git-Url: http://git.onelab.eu/?p=myslice.git;a=commitdiff_plain;h=d69ebaca198cc1fc7884a95753369b43779ec52b the validatebutton test view in trash accepts special argument ‘logged’ so we can pass ‘$user_hrn’ in the pi_authorities query, like our real views will do --- diff --git a/trash/simplevalidatebutton.py b/trash/simplevalidatebutton.py index ff77ee2f..b4bd6382 100644 --- a/trash/simplevalidatebutton.py +++ b/trash/simplevalidatebutton.py @@ -16,8 +16,10 @@ class SimpleValidateButtonView (TemplateView): # mention a user name in the URL as .../trash/simplevalidatebutton/ple.inria.thierry_parmentelat def get (self, request, username='ple.inria.thierry_parmentelat'): + if username=='logged': username='$user_hrn' + page=Page(request) - page.expose_js_metadata() + query_pi_auths = Query.get('ple:user').filter_by('user_hrn', '==', username ).select('pi_authorities') page.enqueue_query(query_pi_auths) @@ -28,16 +30,16 @@ class SimpleValidateButtonView (TemplateView): # see above domid='topmenu-validation', query=query_pi_auths, - # this one is the target for a $.show() when the query comes back + # this one is the target for enabling when the query comes back button_domid="topmenu-validation") + # there is a need to call render() for exposing the query and creating the js plugin + # even though this returns an empty string + validatebutton.render(request) + # variables that will get passed to the view-unfold1.html template template_env = {} - # there is a need to call render() for exposing the query and creating the js plugin - # even though this returns an empty string - rendered=validatebutton.render(request) - # write something of our own instead template_env ['unfold_main'] = '

Some title

'