myslice reputation plugin v0.2
[myslice.git] / portal / reputationview.py
index 4699dd2..520253d 100644 (file)
@@ -192,7 +192,7 @@ class ReputationView (LoginRequiredAutoLogoutView, ThemeView):
         testbeds = []\r
 \r
         for slice in slice_details:\r
-\r
+            \r
             if users_hrn[cur_username] in slice['users']:\r
                 slices_users.append({'slice_hrn':slice['slice_hrn'], 'user':cur_username, 'user_hrn':users_hrn[cur_username] \\r
                                      , 'resource':slice['resource'], 'lease':slice['lease'] })  \r
@@ -244,14 +244,17 @@ class ReputationView (LoginRequiredAutoLogoutView, ThemeView):
 \r
         ###### Get Reputation values from Reputation DB\r
         reps = json_to_rest('http://survivor.lab.netmode.ntua.gr:4567/reputation/showrep', "a")\r
-        env['logging_test'] = reps    \r
+        #env['logging_test'] = reps    \r
         \r
+        #create a services list and a dict containing the services for each testbed\r
+        serv_per_tb = {}\r
         services = []\r
         for item in reps:\r
+            serv_per_tb[item['testbed']]=[]\r
             for serv in item['services']:\r
                 if serv.keys()[0] not in services:\r
                     services.append(serv.keys()[0])\r
-        \r
+                    serv_per_tb[item['testbed']].append(serv.keys()[0])        \r
         \r
         #in json, sevices are in the form: 'services':[{'serv1':x}, {'serv2':y}], so we transform it to 'services':[x,y] based on\r
         # the services dict above. If for a specific service there is no applicable value, we put N/A            \r
@@ -272,6 +275,7 @@ class ReputationView (LoginRequiredAutoLogoutView, ThemeView):
                 \r
         ###### Pass variables to template\r
         env['logging_test'] = json.dumps(all_exp, ensure_ascii=False)\r
+        env['serv_per_tb'] = json.dumps(serv_per_tb, ensure_ascii=False)\r
         env['reputation'] = reps\r
         env['rep_serv'] = services\r
         env['slicelist'] = all_exp\r