X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fslicetabexperiment.py;h=023c2060464ea77b287ed37db6ac0c0705d360a2;hb=0026ae2959012d3ebb007f86c38ae63f57083dc8;hp=b1020a16e7652162b3519fe3f8396f9883c808cc;hpb=1f8c2c50c3810598d61659dd7b1a238ef4def369;p=unfold.git diff --git a/portal/slicetabexperiment.py b/portal/slicetabexperiment.py index b1020a16..023c2060 100644 --- a/portal/slicetabexperiment.py +++ b/portal/slicetabexperiment.py @@ -8,6 +8,8 @@ from django.shortcuts import render from unfold.loginrequired import FreeAccessView +from manifold.core.query import Query +from manifoldapi.manifoldapi import execute_query from manifoldapi.manifoldresult import ManifoldResult from ui.topmenu import topmenu_items, the_user from myslice.configengine import ConfigEngine @@ -24,5 +26,23 @@ class ExperimentView (FreeAccessView, ThemeView): split_slicename = slicename.split('.') ple_slicename = split_slicename[0] + '8' + split_slicename[1] + '_' + split_slicename[2] - return render_to_response(self.template, { 'theme' : self.theme,'slicename':slicename, 'ple_slicename':ple_slicename, 'username':username }, context_instance=RequestContext(request)) + query_current_resources = Query.get('slice').select('resource').filter_by('slice_hrn','==',slicename) + current_resources = execute_query(request, query_current_resources) + + formatted_resource_list=[] + try: + for resources in current_resources: + list_res = resources['resource'] + for res in list_res: + split_list = res.split('+') # split the resource urn + if [s for s in split_list if 'ple' in s]: # search only ple resources + res_hrn = split_list[-1] # last element is resource hrn + formatted_resource_list.append(res_hrn) + except Exception,e: + print "Exception in slicetabexperiment.py in ple resource search %s" % e + + print "list of ple resource hrns" + print formatted_resource_list + + return render_to_response(self.template, { 'theme' : self.theme,'slicename':slicename, 'ple_slicename':ple_slicename, 'username':username, 'ple_resources':formatted_resource_list }, context_instance=RequestContext(request))