translate most modules to using print() as imported from __future__
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 30 Mar 2015 15:44:25 +0000 (17:44 +0200)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 30 Mar 2015 15:44:25 +0000 (17:44 +0200)
43 files changed:
activity/__init__.py
localauth/views.py
manifoldapi/manifoldproxy.py
manifoldapi/metadata.py
myslice/settings.py
plugins/form/__init__.py
plugins/querygrid/__init__.py
plugins/querytable/__init__.py
plugins/univbris/__init__.py
plugins/univbrisfoam/__init__.py
plugins/univbrisfv/__init__.py
plugins/univbristopo/__init__.py
plugins/univbrisvtam/__init__.py
portal/accountview.py
portal/actions.py
portal/dashboardview.py
portal/emailactivationview.py
portal/forms.py
portal/homeview.py
portal/institution.py
portal/joinview.py
portal/managementtababout.py
portal/managementtabrequests.py
portal/platformview.py
portal/projectrequestview.py
portal/registrationview.py
portal/resourceview.py
portal/slicerequestview.py
portal/sliceresourceview.py
portal/slicetabexperiment.py
portal/validationview.py
rest/__init__.py
rest/create.py
rest/get.py
rest/sfa_api.py
rest/update.py
unfold/collectstatic.py
unfold/composite.py
unfold/loginrequired.py
unfold/page.py
unfold/plugin.py
unfold/prelude.py
unfold/tests.py

index 4719a61..e8eb5c3 100644 (file)
@@ -6,6 +6,8 @@
 # The secret is a 64 chars string that is used to sign the request
 # The generated signature is a SHA256 hes digest
 
 # The secret is a 64 chars string that is used to sign the request
 # The generated signature is a SHA256 hes digest
 
+from __future__ import print_function
+
 import urllib, urllib2
 import threading
 import hmac
 import urllib, urllib2
 import threading
 import hmac
@@ -37,10 +39,10 @@ else :
 def logWrite(request, action, message, objects = None):
     
     if not apikey :
 def logWrite(request, action, message, objects = None):
     
     if not apikey :
-        print "===============>> activity: no apikey"
+        print("===============>> activity: no apikey")
         return
     if not secret :
         return
     if not secret :
-        print "===============>> activity: no secret"
+        print("===============>> activity: no secret")
         return
     
     timestamp = time.mktime(datetime.datetime.today().timetuple())
         return
     
     timestamp = time.mktime(datetime.datetime.today().timetuple())
@@ -69,12 +71,12 @@ def logWrite(request, action, message, objects = None):
     
     try :
         result = urllib2.urlopen(server, urllib.urlencode(log))
     
     try :
         result = urllib2.urlopen(server, urllib.urlencode(log))
-        print "===============>> activity: %s <%s> %s" % (action, request.user,message)
+        print("===============>> activity: %s <%s> %s" % (action, request.user,message))
         content = result.read()
     except urllib2.URLError as e:
         content = result.read()
     except urllib2.URLError as e:
-        print "===============>> activity: connection to " + server + " impossible, could not log action"
-        print e.strerror
-        print ""
+        print("===============>> activity: connection to " + server + " impossible, could not log action")
+        print(e.strerror)
+        print("")
 
 def log(request, action, message, objects = None):
     # Create a new thread in Daemon mode to send the log entry
 
 def log(request, action, message, objects = None):
     # Create a new thread in Daemon mode to send the log entry
@@ -93,4 +95,4 @@ def getClientIp(request):
 #
 # sign the request with the secret key
 def sign(secret, message):
 #
 # sign the request with the secret key
 def sign(secret, message):
-    return hmac.new(secret, msg=message, digestmod=hashlib.sha256).hexdigest()
\ No newline at end of file
+    return hmac.new(secret, msg=message, digestmod=hashlib.sha256).hexdigest()
index b959e73..e782b6f 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from django.contrib.auth import logout
 from django.http import HttpResponseRedirect
 
 from django.contrib.auth import logout
 from django.http import HttpResponseRedirect
 
@@ -8,7 +10,7 @@ def logout_user (request):
     # check that we're indeed logged in
     if not request.user.is_authenticated():
         return HttpResponseRedirect ('/')
     # check that we're indeed logged in
     if not request.user.is_authenticated():
         return HttpResponseRedirect ('/')
-    print "LOGGING OUT"
+    print("LOGGING OUT")
     
     # log user activity
     activity.user.logout(request)
     
     # log user activity
     activity.user.logout(request)
index a6f29c3..d9b9861 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 import json
 import os.path
 
 import json
 import os.path
 
@@ -85,7 +87,7 @@ def proxy (request,format):
         #
         # resource reservation
         if (manifold_query.action.lower() == 'update') :
         #
         # resource reservation
         if (manifold_query.action.lower() == 'update') :
-            print result['value'][0]
+            print(result['value'][0])
             if 'resource' in result['value'][0] :
                 for resource in result['value'][0]['resource'] :
                     activity.slice.resource(request, 
             if 'resource' in result['value'][0] :
                 for resource in result['value'][0]['resource'] :
                     activity.slice.resource(request, 
@@ -114,5 +116,5 @@ def proxy (request,format):
 # this however turns out disappointing/not very informative
 failure_answer=[ "csrf_failure" ]
 def csrf_failure(request, reason=""):
 # this however turns out disappointing/not very informative
 failure_answer=[ "csrf_failure" ]
 def csrf_failure(request, reason=""):
-    print "CSRF failure with reason '%s'"%reason
+    print("CSRF failure with reason '%s'"%reason)
     return HttpResponseForbidden (json.dumps (failure_answer), mimetype="application/json")
     return HttpResponseForbidden (json.dumps (failure_answer), mimetype="application/json")
index 300397c..e4be9e0 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 import json 
 import os.path
 
 import json 
 import os.path
 
@@ -34,10 +36,10 @@ class MetaData:
         # xxx need a way to export error messages to the UI
         if result['code'] == 1: # warning
             # messages.warning(request, result['description'])
         # xxx need a way to export error messages to the UI
         if result['code'] == 1: # warning
             # messages.warning(request, result['description'])
-            print ("METADATA WARNING -",request,result['description'])
+            print(("METADATA WARNING -",request,result['description']))
         elif result['code'] == 2:
             # messages.error(request, result['description'])
         elif result['code'] == 2:
             # messages.error(request, result['description'])
-            print ("METADATA ERROR -",request,result['description'])
+            print(("METADATA ERROR -",request,result['description']))
             # XXX FAIL HERE XXX
             return
 
             # XXX FAIL HERE XXX
             return
 
@@ -58,5 +60,5 @@ class MetaData:
         return self.hash_by_object[object]['column'].sort()
 
     def get_field_type(self, object, field):
         return self.hash_by_object[object]['column'].sort()
 
     def get_field_type(self, object, field):
-        if debug: print "Temp fix for metadata::get_field_type() -> consider moving to manifold.core.metadata soon"
+        if debug: print("Temp fix for metadata::get_field_type() -> consider moving to manifold.core.metadata soon")
         return field
         return field
index b0e6a57..9cea436 100644 (file)
@@ -269,7 +269,7 @@ BROKER_URL = "amqp://myslice:myslice@localhost:5672/myslice"
 
 for aux in auxiliaries:
     if os.path.isdir(os.path.join(ROOT,aux)): 
 
 for aux in auxiliaries:
     if os.path.isdir(os.path.join(ROOT,aux)): 
-        print("Using devel auxiliary",aux)
+        print(("Using devel auxiliary",aux))
         INSTALLED_APPS.append(aux)
 
 ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
         INSTALLED_APPS.append(aux)
 
 ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
index d4dce75..d232811 100644 (file)
@@ -5,7 +5,6 @@ class CreateForm (Plugin):
 
     def __init__ (self, **settings):
         Plugin.__init__(self, **settings)
 
     def __init__ (self, **settings):
         Plugin.__init__(self, **settings)
-        print "SETTINGS", settings
         assert 'page'   in settings, "You should specify page"
         assert 'object' in settings, "You should specify object"
 
         assert 'page'   in settings, "You should specify page"
         assert 'object' in settings, "You should specify object"
 
index 587637a..49de253 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from unfold.plugin import Plugin
 
 class QueryGrid (Plugin):
 from unfold.plugin import Plugin
 
 class QueryGrid (Plugin):
@@ -67,7 +69,7 @@ Current implementation makes the following assumptions
         if self.checkboxes:
             # we use aoColumnDefs rather than aoColumns -- ignore user-provided aoColumns
             if 'aoColumns' in self.datatables_options:
         if self.checkboxes:
             # we use aoColumnDefs rather than aoColumns -- ignore user-provided aoColumns
             if 'aoColumns' in self.datatables_options:
-                print 'WARNING: querygrid uses aoColumnDefs, your aoColumns spec. is discarded'
+                print('WARNING: querygrid uses aoColumnDefs, your aoColumns spec. is discarded')
                 del self.datatables_options['aoColumns']
             # set aoColumnDefs in datatables_options - might already have stuff in there
             aoColumnDefs = self.datatables_options.setdefault ('aoColumnDefs',[])
                 del self.datatables_options['aoColumns']
             # set aoColumnDefs in datatables_options - might already have stuff in there
             aoColumnDefs = self.datatables_options.setdefault ('aoColumnDefs',[])
index fe486d5..981d376 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from unfold.plugin import Plugin
 
 class QueryTable (Plugin):
 from unfold.plugin import Plugin
 
 class QueryTable (Plugin):
@@ -50,7 +52,7 @@ Current implementation makes the following assumptions
             _columns = columns
             _hidden_columns = []
         elif self.query:
             _columns = columns
             _hidden_columns = []
         elif self.query:
-            print "self.query.fields = ", self.query_all.fields
+            print("self.query.fields = ", self.query_all.fields)
             # Columns displayed by default
             if self.default_fields is not None:
                 _columns = [field for field in self.default_fields if not field == 'urn']
             # Columns displayed by default
             if self.default_fields is not None:
                 _columns = [field for field in self.default_fields if not field == 'urn']
@@ -59,7 +61,7 @@ Current implementation makes the following assumptions
             if query_all:
                 # We need a list because sets are not JSON-serializable
                 if self.default_fields is not None:
             if query_all:
                 # We need a list because sets are not JSON-serializable
                 if self.default_fields is not None:
-                    print self.query_all.fields
+                    print(self.query_all.fields)
                     _hidden_columns = list(self.query_all.fields - set(self.default_fields))
                 else:
                     _hidden_columns = list(self.query_all.fields - self.query.fields)
                     _hidden_columns = list(self.query_all.fields - set(self.default_fields))
                 else:
                     _hidden_columns = list(self.query_all.fields - self.query.fields)
@@ -70,11 +72,11 @@ Current implementation makes the following assumptions
             _columns = []
             _hidden_columns = []
 
             _columns = []
             _hidden_columns = []
 
-        print "_columns=", _columns
+        print("_columns=", _columns)
         self.columns = { self.mapping.get(c, c) : c for c in _columns }
         self.hidden_columns = { self.mapping.get(c, c) : c for c in _hidden_columns }
         self.columns = { self.mapping.get(c, c) : c for c in _columns }
         self.hidden_columns = { self.mapping.get(c, c) : c for c in _hidden_columns }
-        print "self.columns", self.columns
-        print "self.hidden_columns", self.hidden_columns
+        print("self.columns", self.columns)
+        print("self.hidden_columns", self.hidden_columns)
 
         self.init_key=init_key
         self.datatables_options=datatables_options
 
         self.init_key=init_key
         self.datatables_options=datatables_options
@@ -84,7 +86,7 @@ Current implementation makes the following assumptions
         if self.checkboxes:
             # we use aoColumnDefs rather than aoColumns -- ignore user-provided aoColumns
             if 'aoColumns' in self.datatables_options:
         if self.checkboxes:
             # we use aoColumnDefs rather than aoColumns -- ignore user-provided aoColumns
             if 'aoColumns' in self.datatables_options:
-                print 'WARNING: querytable uses aoColumnDefs, your aoColumns spec. is discarded'
+                print('WARNING: querytable uses aoColumnDefs, your aoColumns spec. is discarded')
                 del self.datatables_options['aoColumns']
             # set aoColumnDefs in datatables_options - might already have stuff in there
             aoColumnDefs = self.datatables_options.setdefault ('aoColumnDefs',[])
                 del self.datatables_options['aoColumns']
             # set aoColumnDefs in datatables_options - might already have stuff in there
             aoColumnDefs = self.datatables_options.setdefault ('aoColumnDefs',[])
index 89b3ec5..6e32801 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from unfold.plugin import Plugin
 
 class Univbris(Plugin):
 from unfold.plugin import Plugin
 
 class Univbris(Plugin):
@@ -5,21 +7,21 @@ class Univbris(Plugin):
     def __init__ (self, query=None, **settings):
         Plugin.__init__ (self, **settings)
         self.query=query
     def __init__ (self, query=None, **settings):
         Plugin.__init__ (self, **settings)
         self.query=query
-       self.query_uuid = query.query_uuid if query else None
-       print "called univbris plugin"
+        self.query_uuid = query.query_uuid if query else None
+        print("called univbris plugin")
 
     def template_file (self):
         try:
             return "univbris_welcome.html"
         except Exception:
 
     def template_file (self):
         try:
             return "univbris_welcome.html"
         except Exception:
-                   print "error template"
+            print("error template")
 
     def requirements (self):
         reqs = {
             'js_files' : [ "js/spin-presets.js", "js/spin.min.js", "js/jquery.spin.js",
                            "js/manifold.js", "js/manifold-query.js",
                            "js/unfold-helper.js",
 
     def requirements (self):
         reqs = {
             'js_files' : [ "js/spin-presets.js", "js/spin.min.js", "js/jquery.spin.js",
                            "js/manifold.js", "js/manifold-query.js",
                            "js/unfold-helper.js",
-                'js/univbris.js',
+                           'js/univbris.js',
             ],
             'css_files': [
                 'css/univbris.css',
             ],
             'css_files': [
                 'css/univbris.css',
@@ -31,7 +33,7 @@ class Univbris(Plugin):
         # query_uuid will pass self.query results to the javascript
         # and will be available as "record" in :
         # on_new_record: function(record)
         # query_uuid will pass self.query results to the javascript
         # and will be available as "record" in :
         # on_new_record: function(record)
-        return ['plugin_uuid', 'domid', 'query_uuid','init_key',]
+        return ['plugin_uuid', 'domid', 'query_uuid', 'init_key', ]
 
     def export_json_settings (self):
         return True
 
     def export_json_settings (self):
         return True
index 254fda2..3e39595 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from unfold.plugin import Plugin
 
 class UnivbrisFoam (Plugin):
 from unfold.plugin import Plugin
 
 class UnivbrisFoam (Plugin):
@@ -49,20 +51,20 @@ Current implementation makes the following assumptions
         # Until we have a proper way to access queries in Python
         self.query_all      = query_all
         self.query_all_uuid = query_all.query_uuid if query_all else None
         # Until we have a proper way to access queries in Python
         self.query_all      = query_all
         self.query_all_uuid = query_all.query_uuid if query_all else None
-       self.sync_query_uuid = sync_query.query_uuid if sync_query else None
+        self.sync_query_uuid = sync_query.query_uuid if sync_query else None
         self.checkboxes     = checkboxes
         # XXX We need to have some hidden columns until we properly handle dynamic queries
         if columns is not None:
             self.columns=columns
             self.hidden_columns = []
         elif self.query:
         self.checkboxes     = checkboxes
         # XXX We need to have some hidden columns until we properly handle dynamic queries
         if columns is not None:
             self.columns=columns
             self.hidden_columns = []
         elif self.query:
-           self.columns = list (['testbed','head node id/port','tail node id/port','link type','selected'])
-           #replace production
+            self.columns = list (['testbed','head node id/port','tail node id/port','link type','selected'])
+            #replace production
             #self.columns = self.query.fields
             if query_all:
                 #replace production
             #self.columns = self.query.fields
             if query_all:
                 #replace production
-               self.hidden_columns = []
-               # We need a list because sets are not JSON-serializable
+                self.hidden_columns = []
+                # We need a list because sets are not JSON-serializable
                 #self.hidden_columns = #list(self.query_all.fields - self.query.fields)
             else:
                 self.hidden_columns = []
                 #self.hidden_columns = #list(self.query_all.fields - self.query.fields)
             else:
                 self.hidden_columns = []
@@ -77,7 +79,7 @@ Current implementation makes the following assumptions
         if self.checkboxes:
             # we use aoColumnDefs rather than aoColumns -- ignore user-provided aoColumns
             if 'aoColumns' in self.datatables_options:
         if self.checkboxes:
             # we use aoColumnDefs rather than aoColumns -- ignore user-provided aoColumns
             if 'aoColumns' in self.datatables_options:
-                print 'WARNING: querytable uses aoColumnDefs, your aoColumns spec. is discarded'
+                print('WARNING: querytable uses aoColumnDefs, your aoColumns spec. is discarded')
                 del self.datatables_options['aoColumns']
             # set aoColumnDefs in datatables_options - might already have stuff in there
             aoColumnDefs = self.datatables_options.setdefault ('aoColumnDefs',[])
                 del self.datatables_options['aoColumns']
             # set aoColumnDefs in datatables_options - might already have stuff in there
             aoColumnDefs = self.datatables_options.setdefault ('aoColumnDefs',[])
index 6c9aef2..9ca631f 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from unfold.plugin import Plugin
 
 class UnivbrisFv (Plugin):
 from unfold.plugin import Plugin
 
 class UnivbrisFv (Plugin):
@@ -55,13 +57,13 @@ Current implementation makes the following assumptions
             self.columns=columns
             self.hidden_columns = []
         elif self.query:
             self.columns=columns
             self.hidden_columns = []
         elif self.query:
-           self.columns = list (['Flowspace Name', 'Edit', 'Delete'])
-           #replace production
+            self.columns = list (['Flowspace Name', 'Edit', 'Delete'])
+            #replace production
             #self.columns = self.query.fields
             if query_all:
                 #replace production
             #self.columns = self.query.fields
             if query_all:
                 #replace production
-               self.hidden_columns = []
-               # We need a list because sets are not JSON-serializable
+                self.hidden_columns = []
+                # We need a list because sets are not JSON-serializable
                 #self.hidden_columns = #list(self.query_all.fields - self.query.fields)
             else:
                 self.hidden_columns = []
                 #self.hidden_columns = #list(self.query_all.fields - self.query.fields)
             else:
                 self.hidden_columns = []
@@ -69,7 +71,7 @@ Current implementation makes the following assumptions
             self.columns = []
             self.hidden_columns = []
 
             self.columns = []
             self.hidden_columns = []
 
-       self.columns = list (['Flowspace Name', 'Edit', 'Delete'])
+        self.columns = list (['Flowspace Name', 'Edit', 'Delete'])
         self.init_key=init_key
         self.datatables_options=datatables_options
         # if checkboxes were required, we tell datatables about this column's type
         self.init_key=init_key
         self.datatables_options=datatables_options
         # if checkboxes were required, we tell datatables about this column's type
@@ -78,7 +80,7 @@ Current implementation makes the following assumptions
         if self.checkboxes:
             # we use aoColumnDefs rather than aoColumns -- ignore user-provided aoColumns
             if 'aoColumns' in self.datatables_options:
         if self.checkboxes:
             # we use aoColumnDefs rather than aoColumns -- ignore user-provided aoColumns
             if 'aoColumns' in self.datatables_options:
-                print 'WARNING: querytable uses aoColumnDefs, your aoColumns spec. is discarded'
+                print('WARNING: querytable uses aoColumnDefs, your aoColumns spec. is discarded')
                 del self.datatables_options['aoColumns']
             # set aoColumnDefs in datatables_options - might already have stuff in there
             aoColumnDefs = self.datatables_options.setdefault ('aoColumnDefs',[])
                 del self.datatables_options['aoColumns']
             # set aoColumnDefs in datatables_options - might already have stuff in there
             aoColumnDefs = self.datatables_options.setdefault ('aoColumnDefs',[])
@@ -98,12 +100,13 @@ Current implementation makes the following assumptions
     def requirements (self):
         reqs = {
             'js_files' : [ "js/spin-presets.js", "js/spin.min.js", "js/jquery.spin.js",
     def requirements (self):
         reqs = {
             'js_files' : [ "js/spin-presets.js", "js/spin.min.js", "js/jquery.spin.js",
- "js/dataTables.js",  "js/dataTables.bootstrap.js", "js/with-datatables.js", "js/jquery.jeditable.js", 
+                           "js/dataTables.js",  "js/dataTables.bootstrap.js",
+                           "js/with-datatables.js", "js/jquery.jeditable.js", 
                            "js/manifold.js", "js/manifold-query.js", 
                            "js/unfold-helper.js",
                           # querytable.js needs to be loaded after dataTables.js as it extends 
                           # dataTableExt.afnSortData
                            "js/manifold.js", "js/manifold-query.js", 
                            "js/unfold-helper.js",
                           # querytable.js needs to be loaded after dataTables.js as it extends 
                           # dataTableExt.afnSortData
-                         # "js/jquery-ui.min.js" "js/jquery.dataTables.editable.js", "js/jquery.validate.js",
+                          # "js/jquery-ui.min.js" "js/jquery.dataTables.editable.js", "js/jquery.validate.js",
                            "js/univbrisfv.js",#"js/univbrisfv.js",
                            ] ,
             'css_files': [ "css/dataTables.bootstrap.css",
                            "js/univbrisfv.js",#"js/univbrisfv.js",
                            ] ,
             'css_files': [ "css/dataTables.bootstrap.css",
index c9e92c9..ae48f2b 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from unfold.plugin import Plugin
 
 class UnivbrisTopo(Plugin):
 from unfold.plugin import Plugin
 
 class UnivbrisTopo(Plugin):
@@ -5,20 +7,21 @@ class UnivbrisTopo(Plugin):
     def __init__ (self, query=None, **settings):
         Plugin.__init__ (self, **settings)
         self.query=query
     def __init__ (self, query=None, **settings):
         Plugin.__init__ (self, **settings)
         self.query=query
-       self.query_uuid = query.query_uuid if query else None
-       print "called univbris topo plugin"
+        self.query_uuid = query.query_uuid if query else None
+        print("called univbris topo plugin")
 
     def template_file (self):
 
     def template_file (self):
-       try:
-               return "univbris_topology.html"
-       except:
-               print "error template"
+        try:
+            return "univbris_topology.html"
+        except:
+            print("error template")
 
     def requirements (self):
         reqs = {
 
     def requirements (self):
         reqs = {
-            'js_files' : [ "js/spin-presets.js", "js/spin.min.js", "js/jquery.spin.js",
-                           "js/manifold.js", "js/manifold-query.js", 
-                           "js/unfold-helper.js",
+            'js_files' : [
+                "js/spin-presets.js", "js/spin.min.js", "js/jquery.spin.js",
+                "js/manifold.js", "js/manifold-query.js", 
+                "js/unfold-helper.js",
                 'js/univbristopo.js', 'js/d3.v2.min.js','js/tooltip.topology.js',
             ],
             'css_files': [
                 'js/univbristopo.js', 'js/d3.v2.min.js','js/tooltip.topology.js',
             ],
             'css_files': [
index bc2bf9e..8dbe71e 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from unfold.plugin import Plugin
 
 class UnivbrisVtam (Plugin):
 from unfold.plugin import Plugin
 
 class UnivbrisVtam (Plugin):
@@ -7,24 +9,24 @@ class UnivbrisVtam (Plugin):
                   datatables_options={}, **settings):
         Plugin.__init__ (self, **settings)
         self.query          = query
                   datatables_options={}, **settings):
         Plugin.__init__ (self, **settings)
         self.query          = query
-       self.query_uuid     = query.query_uuid if query else None
+        self.query_uuid     = query.query_uuid if query else None
         # Until we have a proper way to access queries in Python
         self.query_all      = query_all
         self.query_all_uuid = query_all.query_uuid if query_all else None
         # Until we have a proper way to access queries in Python
         self.query_all      = query_all
         self.query_all_uuid = query_all.query_uuid if query_all else None
-       self.sync_query_uuid = sync_query.query_uuid if sync_query else None
+        self.sync_query_uuid = sync_query.query_uuid if sync_query else None
         self.checkboxes     = checkboxes
         # XXX We need to have some hidden columns until we properly handle dynamic queries
         if columns is not None:
             self.columns=columns
             self.hidden_columns = []
         elif self.query:
         self.checkboxes     = checkboxes
         # XXX We need to have some hidden columns until we properly handle dynamic queries
         if columns is not None:
             self.columns=columns
             self.hidden_columns = []
         elif self.query:
-           self.columns = list (['Testbed', 'Virtualization Server', 'VM name', 'Delete'])
-           #replace production
+            self.columns = list (['Testbed', 'Virtualization Server', 'VM name', 'Delete'])
+            #replace production
             #self.columns = self.query.fields
             if query_all:
                 #replace production
             #self.columns = self.query.fields
             if query_all:
                 #replace production
-               self.hidden_columns = []
-               # We need a list because sets are not JSON-serializable
+                self.hidden_columns = []
+                # We need a list because sets are not JSON-serializable
                 #self.hidden_columns = #list(self.query_all.fields - self.query.fields)
             else:
                 self.hidden_columns = []
                 #self.hidden_columns = #list(self.query_all.fields - self.query.fields)
             else:
                 self.hidden_columns = []
@@ -32,7 +34,7 @@ class UnivbrisVtam (Plugin):
             self.columns = []
             self.hidden_columns = []
 
             self.columns = []
             self.hidden_columns = []
 
-       self.columns = list (['Testbed', 'Virtualization Server', 'VM name', 'Delete'])
+        self.columns = list (['Testbed', 'Virtualization Server', 'VM name', 'Delete'])
         self.init_key=init_key
         self.datatables_options=datatables_options
         # if checkboxes were required, we tell datatables about this column's type
         self.init_key=init_key
         self.datatables_options=datatables_options
         # if checkboxes were required, we tell datatables about this column's type
@@ -41,7 +43,7 @@ class UnivbrisVtam (Plugin):
         if self.checkboxes:
             # we use aoColumnDefs rather than aoColumns -- ignore user-provided aoColumns
             if 'aoColumns' in self.datatables_options:
         if self.checkboxes:
             # we use aoColumnDefs rather than aoColumns -- ignore user-provided aoColumns
             if 'aoColumns' in self.datatables_options:
-                print 'WARNING: querytable uses aoColumnDefs, your aoColumns spec. is discarded'
+                print('WARNING: querytable uses aoColumnDefs, your aoColumns spec. is discarded')
                 del self.datatables_options['aoColumns']
             # set aoColumnDefs in datatables_options - might already have stuff in there
             aoColumnDefs = self.datatables_options.setdefault ('aoColumnDefs',[])
                 del self.datatables_options['aoColumns']
             # set aoColumnDefs in datatables_options - might already have stuff in there
             aoColumnDefs = self.datatables_options.setdefault ('aoColumnDefs',[])
index dfda182..df2f307 100644 (file)
@@ -1,9 +1,13 @@
+from __future__ import print_function
+
 from unfold.loginrequired               import LoginRequiredAutoLogoutView
 #
 #
 from manifold.core.query                import Query
 from manifoldapi.manifoldapi            import execute_query
 from unfold.loginrequired               import LoginRequiredAutoLogoutView
 #
 #
 from manifold.core.query                import Query
 from manifoldapi.manifoldapi            import execute_query
-from portal.actions                     import manifold_update_user, manifold_update_account, manifold_add_account, manifold_delete_account, sfa_update_user, sfa_get_user, clear_user_creds
+from portal.actions                     import (
+    manifold_update_user, manifold_update_account, manifold_add_account,
+    manifold_delete_account, sfa_update_user, sfa_get_user, clear_user_creds )
 #
 from unfold.page                        import Page    
 from ui.topmenu                         import topmenu_items_live, the_user
 #
 from unfold.page                        import Page    
 from ui.topmenu                         import topmenu_items_live, the_user
@@ -12,7 +16,7 @@ from django.http                        import HttpResponse, HttpResponseRedirec
 from django.contrib                     import messages
 from django.contrib.auth.decorators     import login_required
 
 from django.contrib                     import messages
 from django.contrib.auth.decorators     import login_required
 
-from myslice.configengine           import ConfigEngine
+from myslice.configengine               import ConfigEngine
 from myslice.theme import ThemeView
 
 from portal.account                     import Account, get_expiration
 from myslice.theme import ThemeView
 
 from portal.account                     import Account, get_expiration
@@ -289,11 +293,11 @@ def account_process(request):
             if user_email == request.user.email:                                          
                 authorize_query = True                                                    
             else:                                                                         
             if user_email == request.user.email:                                          
                 authorize_query = True                                                    
             else:                                                                         
-                print "SECURITY: %s tried to update %s" % (user_email, request.user.email)
+                print("SECURITY: %s tried to update %s" % (user_email, request.user.email))
                 messages.error(request, 'You are not authorized to modify another user.') 
                 return HttpResponseRedirect("/portal/account/")                               
         except Exception,e:
                 messages.error(request, 'You are not authorized to modify another user.') 
                 return HttpResponseRedirect("/portal/account/")                               
         except Exception,e:
-            print "Exception = %s" % e
+            print("Exception = %s" % e)
 
     for account_detail in account_details:
         for platform_detail in platform_details:
 
     for account_detail in account_details:
         for platform_detail in platform_details:
@@ -428,7 +432,7 @@ def account_process(request):
                                 raise Exception,"Keys are not matching"
                         except Exception, e:
                             messages.error(request, 'Error: An error occured during the update of your public key at the Registry, or your public key is not matching the one stored.')
                                 raise Exception,"Keys are not matching"
                         except Exception, e:
                             messages.error(request, 'Error: An error occured during the update of your public key at the Registry, or your public key is not matching the one stored.')
-                            print "Exception in accountview ", e
+                            print("Exception in accountview ", e)
                         return HttpResponseRedirect("/portal/account/")
         else:
             messages.error(request, 'Account error: You need an account in myslice platform to perform this action')
                         return HttpResponseRedirect("/portal/account/")
         else:
             messages.error(request, 'Account error: You need an account in myslice platform to perform this action')
@@ -592,7 +596,7 @@ def account_process(request):
             else:
                 messages.error(request, 'Delete error: Credentials are not stored in the server')
         except Exception,e:
             else:
                 messages.error(request, 'Delete error: Credentials are not stored in the server')
         except Exception,e:
-            print "Exception in accountview.py in clear_user_creds %s" % e
+            print("Exception in accountview.py in clear_user_creds %s" % e)
             messages.error(request, 'Account error: You need an account in myslice platform to perform this action')
         return HttpResponseRedirect("/portal/account/")
 
             messages.error(request, 'Account error: You need an account in myslice platform to perform this action')
         return HttpResponseRedirect("/portal/account/")
 
index 82221ab..e1faf4b 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from django.http                    import HttpResponse
 from manifold.core.query            import Query
 from manifoldapi.manifoldapi        import execute_query,execute_admin_query
 from django.http                    import HttpResponse
 from manifold.core.query            import Query
 from manifoldapi.manifoldapi        import execute_query,execute_admin_query
@@ -82,7 +84,7 @@ def authority_check_pis(request, user_email):
         return pi_status
 
     except Exception,e:
         return pi_status
 
     except Exception,e:
-        print "Exception in actions.py in authority_check_pis %s" % e
+        print("Exception in actions.py in authority_check_pis %s" % e)
         return None
 
 
         return None
 
 
@@ -99,7 +101,7 @@ def authority_add_pis(request, authority_hrn,user_hrn):
         newpis = authority_get_pis (request, authority_hrn)
         return newpis
     except Exception,e: 
         newpis = authority_get_pis (request, authority_hrn)
         return newpis
     except Exception,e: 
-        print "Exception in actions.py in authority_add_pis %s" % e
+        print("Exception in actions.py in authority_add_pis %s" % e)
         return None
 
 
         return None
 
 
@@ -116,13 +118,13 @@ def authority_remove_pis(request, authority_hrn,user_hrn):
         newpis = authority_get_pis (request, authority_hrn)
         return newpis
     except Exception,e: 
         newpis = authority_get_pis (request, authority_hrn)
         return newpis
     except Exception,e: 
-        print "Exception in actions.py in authority_remove_pis %s" % e
+        print("Exception in actions.py in authority_remove_pis %s" % e)
         return None
 
 
 def authority_get_pi_emails(request, authority_hrn):
     pi_users = authority_get_pis(request,authority_hrn)
         return None
 
 
 def authority_get_pi_emails(request, authority_hrn):
     pi_users = authority_get_pis(request,authority_hrn)
-    print "pi_users = %s" % pi_users
+    print("pi_users = %s" % pi_users)
 
     if any(pi['pi_users'] == None or not pi['pi_users']  for pi in pi_users):
         #theme.template_name = 'email_default_recipients.txt' 
 
     if any(pi['pi_users'] == None or not pi['pi_users']  for pi in pi_users):
         #theme.template_name = 'email_default_recipients.txt' 
@@ -175,12 +177,12 @@ def clear_user_creds(request, user_email):
                             return None
 
     except Exception,e:
                             return None
 
     except Exception,e:
-        print "Exception in actions.py in clear_user_creds %s" % e
+        print("Exception in actions.py in clear_user_creds %s" % e)
         return None
 
 def is_pi(wsgi_request, user_hrn, authority_hrn):
     # authorities from user where user_hrn == "ple.upmc.jordan_auge"
         return None
 
 def is_pi(wsgi_request, user_hrn, authority_hrn):
     # authorities from user where user_hrn == "ple.upmc.jordan_auge"
-    print "#### actions.py is_pi authority_hrn = ", authority_hrn
+    print("#### actions.py is_pi authority_hrn = ", authority_hrn)
     try:
         # CACHE PB with fields
         page = Page(wsgi_request)
     try:
         # CACHE PB with fields
         page = Page(wsgi_request)
@@ -197,7 +199,7 @@ def is_pi(wsgi_request, user_hrn, authority_hrn):
             if authority_hrn in user_detail['pi_authorities']:
                 return True
     except Exception,e:
             if authority_hrn in user_detail['pi_authorities']:
                 return True
     except Exception,e:
-        print "Exception in actions.py in is_pi %s" % e
+        print("Exception in actions.py in is_pi %s" % e)
     return False
     
 # SFA get record
     return False
     
 # SFA get record
@@ -224,7 +226,7 @@ def sfa_add_authority(request, authority_params):
     # REGISTRY ONLY TO BE REMOVED WITH MANIFOLD-V2
     query = Query.create('myslice:authority').set(authority_params).select('authority_hrn')
     results = execute_query(request, query)
     # REGISTRY ONLY TO BE REMOVED WITH MANIFOLD-V2
     query = Query.create('myslice:authority').set(authority_params).select('authority_hrn')
     results = execute_query(request, query)
-    print "sfa_add_auth results=",results
+    print("sfa_add_auth results=",results)
     if not results:
         raise Exception, "Could not create %s. Already exists ?" % authority_params['hrn']
     return results
     if not results:
         raise Exception, "Could not create %s. Already exists ?" % authority_params['hrn']
     return results
@@ -430,7 +432,7 @@ def make_request_authority(authority):
     return request
 
 def make_requests(pending_users, pending_slices, pending_authorities, pending_projects, pending_joins):
     return request
 
 def make_requests(pending_users, pending_slices, pending_authorities, pending_projects, pending_joins):
-    print "$$$$$$$$$$$$$$$  make_request"
+    print("$$$$$$$$$$$$$$$  make_request")
     requests = []
     for user in pending_users:
         requests.append(make_request_user(user))
     requests = []
     for user in pending_users:
         requests.append(make_request_user(user))
@@ -445,7 +447,7 @@ def make_requests(pending_users, pending_slices, pending_authorities, pending_pr
     return requests   
 
 def get_request_by_id(ids):
     return requests   
 
 def get_request_by_id(ids):
-    print "$$$$$$$$$$$$$$$$  get_request_by_id"
+    print("$$$$$$$$$$$$$$$$  get_request_by_id")
     sorted_ids = { 'user': [], 'slice': [], 'authority': [], 'project': [], 'join': [] }
     for type__id in ids:
         type, id = type__id.split('__')
     sorted_ids = { 'user': [], 'slice': [], 'authority': [], 'project': [], 'join': [] }
     for type__id in ids:
         type, id = type__id.split('__')
@@ -467,7 +469,7 @@ def get_request_by_id(ids):
     return make_requests(pending_users, pending_slices, pending_authorities, pending_projects, pending_joins)
 
 def get_requests(authority_hrns=None):
     return make_requests(pending_users, pending_slices, pending_authorities, pending_projects, pending_joins)
 
 def get_requests(authority_hrns=None):
-    print "$$$$$$$$$$$$$   get_request_by_authority auth_hrns = ", authority_hrns
+    print("$$$$$$$$$$$$$   get_request_by_authority auth_hrns = ", authority_hrns)
     if not authority_hrns:
         ## get those pending users who have confirmed their emails
         pending_users  = PendingUser.objects.filter(status__iexact = 'True')
     if not authority_hrns:
         ## get those pending users who have confirmed their emails
         pending_users  = PendingUser.objects.filter(status__iexact = 'True')
@@ -574,7 +576,7 @@ def portal_validate_request(wsgi_request, request_ids):
                     #'pi'        : None,
                     #'enabled'    : True
                 }
                     #'pi'        : None,
                     #'enabled'    : True
                 }
-                print "ADD Authority"
+                print("ADD Authority")
                 sfa_add_authority(wsgi_request, sfa_authority_params)
                 request_status['SFA authority'] = {'status': True }
                 PendingAuthority.objects.get(id=request['id']).delete()
                 sfa_add_authority(wsgi_request, sfa_authority_params)
                 request_status['SFA authority'] = {'status': True }
                 PendingAuthority.objects.get(id=request['id']).delete()
@@ -688,7 +690,7 @@ def portal_reject_request(wsgi_request, request_ids):
                     msg.attach_alternative(html_content, "text/html")
                     msg.send()
                 except Exception, e:
                     msg.attach_alternative(html_content, "text/html")
                     msg.send()
                 except Exception, e:
-                    print "Failed to send email, please check the mail templates and the SMTP configuration of your server"   
+                    print("Failed to send email, please check the mail templates and the SMTP configuration of your server")   
 
                 # removing from Django portal_pendinguser
                 PendingUser.objects.get(id=request['id']).delete()
 
                 # removing from Django portal_pendinguser
                 PendingUser.objects.get(id=request['id']).delete()
@@ -729,7 +731,7 @@ def portal_reject_request(wsgi_request, request_ids):
                 msg.attach_alternative(html_content, "text/html")
                 msg.send()
             except Exception, e:
                 msg.attach_alternative(html_content, "text/html")
                 msg.send()
             except Exception, e:
-                print "Failed to send email, please check the mail templates and the SMTP configuration of your server"
+                print("Failed to send email, please check the mail templates and the SMTP configuration of your server")
                       
             PendingSlice.objects.get(id=request['id']).delete()
 
                       
             PendingSlice.objects.get(id=request['id']).delete()
 
@@ -768,7 +770,7 @@ def portal_reject_request(wsgi_request, request_ids):
                 msg.attach_alternative(html_content, "text/html")
                 msg.send()
             except Exception, e:
                 msg.attach_alternative(html_content, "text/html")
                 msg.send()
             except Exception, e:
-                print "Failed to send email, please check the mail templates and the SMTP configuration of your server"
+                print("Failed to send email, please check the mail templates and the SMTP configuration of your server")
 
             PendingAuthority.objects.get(id=request['id']).delete()
 
 
             PendingAuthority.objects.get(id=request['id']).delete()
 
@@ -867,7 +869,7 @@ def create_slice(wsgi_request, request):
             msg.attach_alternative(html_content, "text/html")
             msg.send()
         except Exception, e:
             msg.attach_alternative(html_content, "text/html")
             msg.send()
         except Exception, e:
-            print "Failed to send email, please check the mail templates and the SMTP configuration of your server"
+            print("Failed to send email, please check the mail templates and the SMTP configuration of your server")
        
     return results
 
        
     return results
 
@@ -905,7 +907,7 @@ def create_pending_slice(wsgi_request, request, email):
         msg.attach_alternative(html_content, "text/html")
         msg.send()
     except Exception, e:
         msg.attach_alternative(html_content, "text/html")
         msg.send()
     except Exception, e:
-        print "Failed to send email, please check the mail templates and the SMTP configuration of your server"
+        print("Failed to send email, please check the mail templates and the SMTP configuration of your server")
 
 
 def create_pending_project(wsgi_request, request):
 
 
 def create_pending_project(wsgi_request, request):
@@ -1062,7 +1064,7 @@ def sfa_create_user(wsgi_request, request, namespace = None, as_admin = False):
             msg.attach_alternative(html_content, "text/html")
             msg.send()
         except Exception, e:
             msg.attach_alternative(html_content, "text/html")
             msg.send()
         except Exception, e:
-            print "Failed to send email, please check the mail templates and the SMTP configuration of your server"
+            print("Failed to send email, please check the mail templates and the SMTP configuration of your server")
 
     return results
 
 
     return results
 
@@ -1100,7 +1102,7 @@ def iotlab_create_user (wsgi_request, request, namespace = None, as_admin=False)
    
     iotlab_user_params1 = json.dumps(iotlab_user_params)
     r=requests.post(url=URL_REST, data=iotlab_user_params1, headers=headers, auth=auth)
    
     iotlab_user_params1 = json.dumps(iotlab_user_params)
     r=requests.post(url=URL_REST, data=iotlab_user_params1, headers=headers, auth=auth)
-    print 'Create iotlab user : ', r.status_code, r.text
+    print('Create iotlab user : ', r.status_code, r.text)
     return r.text
 
 def create_user(wsgi_request, request, namespace = None, as_admin = False):
     return r.text
 
 def create_user(wsgi_request, request, namespace = None, as_admin = False):
@@ -1197,7 +1199,7 @@ def create_pending_user(wsgi_request, request, user_detail):
         }
         manifold_add_account(wsgi_request, account_params)
     except Exception, e:
         }
         manifold_add_account(wsgi_request, account_params)
     except Exception, e:
-        print "Failed creating manifold account on platform %s for user: %s" % ('myslice', request['email'])
+        print("Failed creating manifold account on platform %s for user: %s" % ('myslice', request['email']))
 
     try:
         # Send an email: the recipients are the PI of the authority
 
     try:
         # Send an email: the recipients are the PI of the authority
@@ -1222,6 +1224,6 @@ def create_pending_user(wsgi_request, request, user_detail):
         msg.attach_alternative(html_content, "text/html")
         msg.send()
     except Exception, e:
         msg.attach_alternative(html_content, "text/html")
         msg.send()
     except Exception, e:
-        print "Failed to send email, please check the mail templates and the SMTP configuration of your server"
+        print("Failed to send email, please check the mail templates and the SMTP configuration of your server")
         import traceback
         traceback.print_exc()
         import traceback
         traceback.print_exc()
index 0de9b93..8c6af13 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 import json
 from manifold.core.query         import Query
 from manifoldapi.manifoldapi     import execute_query
 import json
 from manifold.core.query         import Query
 from manifoldapi.manifoldapi     import execute_query
@@ -25,7 +27,7 @@ class DashboardView (LoginRequiredAutoLogoutView, ThemeView):
         #messages.info(self.request, 'You have logged in')
         page = Page(self.request)
 
         #messages.info(self.request, 'You have logged in')
         page = Page(self.request)
 
-        print "Dashboard page"
+        print("Dashboard page")
         # Slow...
         #slice_query = Query().get('slice').filter_by('user.user_hrn', 'contains', user_hrn).select('slice_hrn')
         testbed_query  = Query().get('network').select('network_hrn','platform','version')
         # Slow...
         #slice_query = Query().get('slice').filter_by('user.user_hrn', 'contains', user_hrn).select('slice_hrn')
         testbed_query  = Query().get('network').select('network_hrn','platform','version')
@@ -47,8 +49,8 @@ class DashboardView (LoginRequiredAutoLogoutView, ThemeView):
 #            root_authority = sub_authority[0]
 #            slice_query = Query().get(root_authority+':user').filter_by('user_hrn', '==', '$user_hrn').select('user_hrn', 'slice.slice_hrn')
 #        else:
 #            root_authority = sub_authority[0]
 #            slice_query = Query().get(root_authority+':user').filter_by('user_hrn', '==', '$user_hrn').select('user_hrn', 'slice.slice_hrn')
 #        else:
-        print "SLICE QUERY"
-        print "-" * 80
+        print("SLICE QUERY")
+        print("-" * 80)
         slice_query = Query().get('myslice:user').filter_by('user_hrn', '==', '$user_hrn').select('slices.slice_hrn')
         page.enqueue_query(slice_query)
         page.enqueue_query(testbed_query)
         slice_query = Query().get('myslice:user').filter_by('user_hrn', '==', '$user_hrn').select('slices.slice_hrn')
         page.enqueue_query(slice_query)
         page.enqueue_query(testbed_query)
index 4424c2e..fc40104 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from unfold.loginrequired               import FreeAccessView
 #
 from manifold.core.query                import Query
 from unfold.loginrequired               import FreeAccessView
 #
 from manifold.core.query                import Query
@@ -37,7 +39,7 @@ class ActivateEmailView(FreeAccessView, ThemeView):
                 if 'enabled' in result and result['enabled']==True:
                     return True
         except Exception, e:
                 if 'enabled' in result and result['enabled']==True:
                     return True
         except Exception, e:
-            print "Exception in myplc query = ",e
+            print("Exception in myplc query = ",e)
 
         return False
 
 
         return False
 
index e5087d8..0ede402 100644 (file)
@@ -21,6 +21,8 @@
 # this program; see the file COPYING.  If not, write to the Free Software
 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 # this program; see the file COPYING.  If not, write to the Free Software
 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
+from __future__ import print_function
+
 from django import forms
 from portal.models import PendingUser, PendingSlice
 #from crispy_forms.helper import FormHelper
 from django import forms
 from portal.models import PendingUser, PendingSlice
 #from crispy_forms.helper import FormHelper
@@ -206,7 +208,7 @@ class PasswordResetForm(forms.Form):
                 email = loader.render_to_string(email_template_name, c)
                 send_mail(subject, email, from_email, [user.email])
         except Exception, e:
                 email = loader.render_to_string(email_template_name, c)
                 send_mail(subject, email, from_email, [user.email])
         except Exception, e:
-            print "Failed to send email, please check the mail templates and the SMTP configuration of your server"
+            print("Failed to send email, please check the mail templates and the SMTP configuration of your server")
 
 
 class SetPasswordForm(forms.Form):
 
 
 class SetPasswordForm(forms.Form):
index 1fe1d2a..9b98e2b 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 # this somehow is not used anymore - should it not be ?
 from django.core.context_processors     import csrf
 from django.http                        import HttpResponseRedirect
 # this somehow is not used anymore - should it not be ?
 from django.core.context_processors     import csrf
 from django.http                        import HttpResponseRedirect
@@ -61,7 +63,7 @@ class HomeView (FreeAccessView, ThemeView):
         elif auth_result is not None:
             user=auth_result
             if user.is_active:
         elif auth_result is not None:
             user=auth_result
             if user.is_active:
-                print "LOGGING IN"
+                print("LOGGING IN")
                 login(request, user)
                 
                 if request.user.is_authenticated(): 
                 login(request, user)
                 
                 if request.user.is_authenticated(): 
index 8a00435..036a6f0 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from django.core.context_processors import csrf
 from django.http                    import HttpResponseRedirect
 from django.contrib.auth            import authenticate, login, logout
 from django.core.context_processors import csrf
 from django.http                    import HttpResponseRedirect
 from django.contrib.auth            import authenticate, login, logout
@@ -68,9 +70,9 @@ class InstitutionView (LoginRequiredAutoLogoutView, ThemeView):
 
         else: 
             env['person'] = None
 
         else: 
             env['person'] = None
-        print "BEFORE  ####------####  is_pi"
+        print("BEFORE  ####------####  is_pi")
         pi = is_pi(self.request, '$user_hrn', env['user_details']['parent_authority']) 
         pi = is_pi(self.request, '$user_hrn', env['user_details']['parent_authority']) 
-        print "is_pi = ",is_pi
+        print("is_pi = ",is_pi)
 
         env['theme'] = self.theme
         env['section'] = "Institution"
 
         env['theme'] = self.theme
         env['section'] = "Institution"
index 2add3a4..77ce66a 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 import os.path, re
 import json
 from random import randint
 import os.path, re
 import json
 from random import randint
@@ -229,7 +231,7 @@ class JoinView (FreeAccessView, ThemeView):
                     msg.send()
     
                 except Exception, e:
                     msg.send()
     
                 except Exception, e:
-                    print "Failed to send email, please check the mail templates and the SMTP configuration of your server"
+                    print("Failed to send email, please check the mail templates and the SMTP configuration of your server")
                     import traceback
                     traceback.print_exc()
 
                     import traceback
                     traceback.print_exc()
 
index ec39f8f..155d182 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 # this somehow is not used anymore - should it not be ?
 from django.core.context_processors import csrf
 from django.http import HttpResponseRedirect
 # this somehow is not used anymore - should it not be ?
 from django.core.context_processors import csrf
 from django.http import HttpResponseRedirect
@@ -27,7 +29,7 @@ class ManagementAboutView (FreeAccessView, ThemeView):
             user_local_query  = Query().get('local:user').select('config').filter_by('email','==',str(self.request.user))
             user_local_details = execute_query(self.request, user_local_query)
             user_authority = json.loads(user_local_details[0]['config']).get('authority')
             user_local_query  = Query().get('local:user').select('config').filter_by('email','==',str(self.request.user))
             user_local_details = execute_query(self.request, user_local_query)
             user_authority = json.loads(user_local_details[0]['config']).get('authority')
-            print "**************________    management about  = ",user_authority
+            print("**************________    management about  = ",user_authority)
             # XXX Should be done using Metadata
             # select column.name from local:object where table=='authority'
             authority_query = Query().get('authority').select('authority_hrn', 'name', 'address', 'enabled','description', 
             # XXX Should be done using Metadata
             # select column.name from local:object where table=='authority'
             authority_query = Query().get('authority').select('authority_hrn', 'name', 'address', 'enabled','description', 
index 2c80e41..2ebc646 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from django.template                 import RequestContext
 from django.shortcuts                import render_to_response
 
 from django.template                 import RequestContext
 from django.shortcuts                import render_to_response
 
@@ -47,7 +49,7 @@ class ManagementRequestsView (LoginRequiredView, ThemeView):
             sfa_platforms_query = Query().get('local:platform').filter_by('gateway_type', '==', 'sfa').select('platform_id', 'platform', 'auth_type')
             sfa_platforms = execute_query(self.request, sfa_platforms_query)
             for sfa_platform in sfa_platforms:
             sfa_platforms_query = Query().get('local:platform').filter_by('gateway_type', '==', 'sfa').select('platform_id', 'platform', 'auth_type')
             sfa_platforms = execute_query(self.request, sfa_platforms_query)
             for sfa_platform in sfa_platforms:
-                print "SFA PLATFORM > ", sfa_platform['platform']
+                print("SFA PLATFORM > ", sfa_platform['platform'])
                 if not 'auth_type' in sfa_platform:
                     continue
                 auth = sfa_platform['auth_type']
                 if not 'auth_type' in sfa_platform:
                     continue
                 auth = sfa_platform['auth_type']
@@ -55,7 +57,7 @@ class ManagementRequestsView (LoginRequiredView, ThemeView):
                     all_authorities.append(auth)
                 platform_ids.append(sfa_platform['platform_id'])
 
                     all_authorities.append(auth)
                 platform_ids.append(sfa_platform['platform_id'])
 
-            print "W: Hardcoding platform myslice"
+            print("W: Hardcoding platform myslice")
             # There has been a tweak on how new platforms are referencing a
             # so-called 'myslice' platform for storing authentication tokens.
             # XXX This has to be removed in final versions.
             # There has been a tweak on how new platforms are referencing a
             # so-called 'myslice' platform for storing authentication tokens.
             # XXX This has to be removed in final versions.
@@ -102,7 +104,7 @@ class ManagementRequestsView (LoginRequiredView, ThemeView):
                 for pa in pi_authorities_tmp:
                     pi_authorities |= set(pa['pi_authorities'])
             except:
                 for pa in pi_authorities_tmp:
                     pi_authorities |= set(pa['pi_authorities'])
             except:
-                print 'No pi_authorities'
+                print('No pi_authorities')
 
             pi_credential_authorities = pi_authorities & credential_authorities
             pi_no_credential_authorities = pi_authorities - credential_authorities - credential_authorities_expired
 
             pi_credential_authorities = pi_authorities & credential_authorities
             pi_no_credential_authorities = pi_authorities - credential_authorities - credential_authorities_expired
index b0fc3ec..2411e31 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from django.template             import RequestContext
 from django.shortcuts            import render_to_response
 
 from django.template             import RequestContext
 from django.shortcuts            import render_to_response
 
@@ -26,7 +28,7 @@ class PlatformView(FreeAccessView, ThemeView):
         page.add_js_files  ( [ "js/common.functions.js" ] )
 
         for key, value in kwargs.iteritems():
         page.add_js_files  ( [ "js/common.functions.js" ] )
 
         for key, value in kwargs.iteritems():
-            print "%s = %s" % (key, value)       
+            print("%s = %s" % (key, value))       
             if key == "platformname":
                 platformname=value
                 
             if key == "platformname":
                 platformname=value
                 
index 8a48428..9cc1e17 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from django.shortcuts           import render
 from django.contrib.sites.models import Site
 
 from django.shortcuts           import render
 from django.contrib.sites.models import Site
 
@@ -119,7 +121,7 @@ class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView):
                 errors.append('Project name is mandatory')
             
             if not errors:
                 errors.append('Project name is mandatory')
             
             if not errors:
-                print "is_pi on auth_hrn = ", user_authority
+                print("is_pi on auth_hrn = ", user_authority)
                 if is_pi(wsgi_request, user_hrn, user_authority):
                     # PIs can directly create/join project in their own authority...
                     if 'join' in wsgi_request.POST:
                 if is_pi(wsgi_request, user_hrn, user_authority):
                     # PIs can directly create/join project in their own authority...
                     if 'join' in wsgi_request.POST:
index 2ce1efa..cfde2f8 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 import os.path, re
 import json
 from random     import randint
 import os.path, re
 import json
 from random     import randint
@@ -44,14 +46,14 @@ class RegistrationView (FreeAccessView, ThemeView):
         # REGISTRY ONLY TO BE REMOVED WITH MANIFOLD-V2
         authorities_query = Query.get('authority').select('name', 'authority_hrn')
         authorities = execute_admin_query(wsgi_request, authorities_query)
         # REGISTRY ONLY TO BE REMOVED WITH MANIFOLD-V2
         authorities_query = Query.get('authority').select('name', 'authority_hrn')
         authorities = execute_admin_query(wsgi_request, authorities_query)
-        print "RegistrationView authorities = ", authorities
+        print("RegistrationView authorities = ", authorities)
         if authorities is not None:
             # Remove the root authority from the list
             matching = [s for s in authorities if "." in s['authority_hrn']]
             authorities = sorted(matching, key=lambda k: k['authority_hrn'])
             authorities = sorted(matching, key=lambda k: k['name'])
         
         if authorities is not None:
             # Remove the root authority from the list
             matching = [s for s in authorities if "." in s['authority_hrn']]
             authorities = sorted(matching, key=lambda k: k['authority_hrn'])
             authorities = sorted(matching, key=lambda k: k['name'])
         
-        print "############ BREAKPOINT 1 #################"
+        print("############ BREAKPOINT 1 #################")
         # Page rendering
         page = Page(wsgi_request)
 
         # Page rendering
         page = Page(wsgi_request)
 
@@ -61,7 +63,7 @@ class RegistrationView (FreeAccessView, ThemeView):
 
         page.add_css_files ( [ "css/onelab.css", "css/registration.css", "css/jquery.qtip.min.css", "css/jquery.ui.combobox.css" ] )
         page.expose_js_metadata()
 
         page.add_css_files ( [ "css/onelab.css", "css/registration.css", "css/jquery.qtip.min.css", "css/jquery.ui.combobox.css" ] )
         page.expose_js_metadata()
-        print "############ BREAKPOINT 2 #################"
+        print("############ BREAKPOINT 2 #################")
         if method == 'POST':
             reg_form = {}
             # The form has been submitted
         if method == 'POST':
             reg_form = {}
             # The form has been submitted
@@ -70,7 +72,7 @@ class RegistrationView (FreeAccessView, ThemeView):
             current_site = Site.objects.get_current()
             current_site = current_site.domain
            
             current_site = Site.objects.get_current()
             current_site = current_site.domain
            
-            print "############ BREAKPOINT 3 #################"
+            print("############ BREAKPOINT 3 #################")
             post_email = wsgi_request.POST.get('email','').lower()
             salt = randint(1,100000)
             email_hash = md5(str(salt)+post_email).hexdigest()
             post_email = wsgi_request.POST.get('email','').lower()
             salt = randint(1,100000)
             email_hash = md5(str(salt)+post_email).hexdigest()
@@ -87,13 +89,13 @@ class RegistrationView (FreeAccessView, ThemeView):
                 'validation_link': current_site + '/portal/email_activation/'+ email_hash
             }
 
                 'validation_link': current_site + '/portal/email_activation/'+ email_hash
             }
 
-            print "############ BREAKPOINT 4 #################"
+            print("############ BREAKPOINT 4 #################")
             auth = wsgi_request.POST.get('org_name', None)
             if auth is None or auth == "":
                 errors.append('Organization required: please select one or request its addition')
             else:
                
             auth = wsgi_request.POST.get('org_name', None)
             if auth is None or auth == "":
                 errors.append('Organization required: please select one or request its addition')
             else:
                
-                print "############ BREAKPOINT 5 #################"
+                print("############ BREAKPOINT 5 #################")
                 
                 # Construct user_hrn from email (XXX Should use common code)
                 split_email = user_request['email'].split("@")[0] 
                 
                 # Construct user_hrn from email (XXX Should use common code)
                 split_email = user_request['email'].split("@")[0] 
@@ -183,7 +185,7 @@ class RegistrationView (FreeAccessView, ThemeView):
                     return render(wsgi_request, self.template, {'theme': self.theme}) 
 
         else:
                     return render(wsgi_request, self.template, {'theme': self.theme}) 
 
         else:
-            print "############ BREAKPOINT A #################"
+            print("############ BREAKPOINT A #################")
             user_request = {}
             ## this is coming from onelab website onelab.eu
             reg_form = {
             user_request = {}
             ## this is coming from onelab website onelab.eu
             reg_form = {
@@ -193,7 +195,7 @@ class RegistrationView (FreeAccessView, ThemeView):
                 }
             # log user activity
             activity.user.signup(self.request)
                 }
             # log user activity
             activity.user.signup(self.request)
-            print "############ BREAKPOINT B #################"
+            print("############ BREAKPOINT B #################")
 
         template_env = {
           #'topmenu_items': topmenu_items_live('Register', page),
 
         template_env = {
           #'topmenu_items': topmenu_items_live('Register', page),
@@ -204,5 +206,5 @@ class RegistrationView (FreeAccessView, ThemeView):
         template_env.update(user_request)
         template_env.update(reg_form)
         template_env.update(page.prelude_env ())
         template_env.update(user_request)
         template_env.update(reg_form)
         template_env.update(page.prelude_env ())
-        print "############ BREAKPOINT C #################"
+        print("############ BREAKPOINT C #################")
         return render(wsgi_request, self.template,template_env)
         return render(wsgi_request, self.template,template_env)
index d670645..11fd34f 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from manifold.core.query        import Query
 from unfold.page                import Page
 
 from manifold.core.query        import Query
 from unfold.page                import Page
 
@@ -22,7 +24,7 @@ class ResourceView(FreeAccessView, ThemeView):
         page.add_js_files  ( [ "js/common.functions.js" ] )
 
         for key, value in kwargs.iteritems():
         page.add_js_files  ( [ "js/common.functions.js" ] )
 
         for key, value in kwargs.iteritems():
-            print "%s = %s" % (key, value)       
+            print("%s = %s" % (key, value))       
             if key == "urn":
                 resource_urn=value
                 
             if key == "urn":
                 resource_urn=value
                 
index a880d39..2280551 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from django.shortcuts           import render
 from django.contrib.sites.models import Site
 
 from django.shortcuts           import render
 from django.contrib.sites.models import Site
 
@@ -87,7 +89,7 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
         #    pi = "is_pi"
 
         pi = authority_check_pis (wsgi_request, user_email)
         #    pi = "is_pi"
 
         pi = authority_check_pis (wsgi_request, user_email)
-        print "SLICEREQUESTVIEW.PY -----  pi=",pi
+        print("SLICEREQUESTVIEW.PY -----  pi=",pi)
 
         # Page rendering
         page = Page(wsgi_request)
 
         # Page rendering
         page = Page(wsgi_request)
index c394345..85360fd 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from django.template                    import RequestContext
 from django.shortcuts                   import render_to_response
 
 from django.template                    import RequestContext
 from django.shortcuts                   import render_to_response
 
@@ -71,7 +73,7 @@ class SliceResourceView (LoginRequiredView, ThemeView):
 
         slice_md = metadata.details_by_object('slice')
         slice_fields = [column['name'] for column in slice_md['column']]
 
         slice_md = metadata.details_by_object('slice')
         slice_fields = [column['name'] for column in slice_md['column']]
-        print "SLICE RES VIEW fields = %s" % slice_fields
+        print("SLICE RES VIEW fields = %s" % slice_fields)
         # TODO The query to run is embedded in the URL
         # Example: select slice_hrn, resource.urn, lease.resource, lease.start_time, lease.end_time from slice where slice_hrn == "ple.upmc.myslicedemo"
         main_query = Query.get('slice').filter_by('slice_hrn', '=', slicename)
         # TODO The query to run is embedded in the URL
         # Example: select slice_hrn, resource.urn, lease.resource, lease.start_time, lease.end_time from slice where slice_hrn == "ple.upmc.myslicedemo"
         main_query = Query.get('slice').filter_by('slice_hrn', '=', slicename)
index ab2fee2..9eaaea7 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 # this somehow is not used anymore - should it not be ?
 from django.core.context_processors import csrf
 from django.http import HttpResponseRedirect
 # this somehow is not used anymore - should it not be ?
 from django.core.context_processors import csrf
 from django.http import HttpResponseRedirect
@@ -67,7 +69,7 @@ class ExperimentView (FreeAccessView, ThemeView):
 
 
         except Exception,e:
 
 
         except Exception,e:
-            print "Exception in slicetabexperiment.py in OneLab resource search %s" % e
+            print("Exception in slicetabexperiment.py in OneLab resource search %s" % e)
         
         #print "list of ple res hrns"
         #print ple_resource_list
         
         #print "list of ple res hrns"
         #print ple_resource_list
@@ -92,7 +94,7 @@ class ExperimentView (FreeAccessView, ThemeView):
             res = urllib2.urlopen(req)
             all_users = json.load(res) 
         except urllib2.URLError as e:
             res = urllib2.urlopen(req)
             all_users = json.load(res) 
         except urllib2.URLError as e:
-            print "There is a problem in getting iotlab users %s" % e.reason
+            print("There is a problem in getting iotlab users %s" % e.reason)
        
 
         #getting the login from email
        
 
         #getting the login from email
index b87a250..d6eae5a 100644 (file)
@@ -22,6 +22,8 @@
 # this program; see the file COPYING.  If not, write to the Free Software
 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 # this program; see the file COPYING.  If not, write to the Free Software
 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
+from __future__ import print_function
+
 import json
 
 from django.http                import HttpResponseRedirect, HttpResponse
 import json
 
 from django.http                import HttpResponseRedirect, HttpResponse
@@ -90,7 +92,7 @@ class ValidatePendingView(LoginRequiredAutoLogoutView, ThemeView):
             sfa_platforms_query = Query().get('local:platform').filter_by('gateway_type', '==', 'sfa').select('platform_id', 'platform', 'auth_type')
             sfa_platforms = execute_query(self.request, sfa_platforms_query)
             for sfa_platform in sfa_platforms:
             sfa_platforms_query = Query().get('local:platform').filter_by('gateway_type', '==', 'sfa').select('platform_id', 'platform', 'auth_type')
             sfa_platforms = execute_query(self.request, sfa_platforms_query)
             for sfa_platform in sfa_platforms:
-                print "SFA PLATFORM > ", sfa_platform['platform']
+                print("SFA PLATFORM > ", sfa_platform['platform'])
                 if not 'auth_type' in sfa_platform:
                     continue
                 auth = sfa_platform['auth_type']
                 if not 'auth_type' in sfa_platform:
                     continue
                 auth = sfa_platform['auth_type']
@@ -98,7 +100,7 @@ class ValidatePendingView(LoginRequiredAutoLogoutView, ThemeView):
                     all_authorities.append(auth)
                 platform_ids.append(sfa_platform['platform_id'])
 
                     all_authorities.append(auth)
                 platform_ids.append(sfa_platform['platform_id'])
 
-            print "W: Hardcoding platform myslice"
+            print("W: Hardcoding platform myslice")
             # There has been a tweak on how new platforms are referencing a
             # so-called 'myslice' platform for storing authentication tokens.
             # XXX This has to be removed in final versions.
             # There has been a tweak on how new platforms are referencing a
             # so-called 'myslice' platform for storing authentication tokens.
             # XXX This has to be removed in final versions.
@@ -120,30 +122,30 @@ class ValidatePendingView(LoginRequiredAutoLogoutView, ThemeView):
             #print "=" * 80
             for user_account in user_accounts:
 
             #print "=" * 80
             for user_account in user_accounts:
 
-                print "USER ACCOUNT", user_account
+                print("USER ACCOUNT", user_account)
                 if user_account['auth_type'] == 'reference':
                     continue # we hardcoded the myslice platform...
 
                 config = json.loads(user_account['config'])
                 creds = []
                 if user_account['auth_type'] == 'reference':
                     continue # we hardcoded the myslice platform...
 
                 config = json.loads(user_account['config'])
                 creds = []
-                print "CONFIG KEYS", config.keys()
+                print("CONFIG KEYS", config.keys())
                 if 'authority_credentials' in config:
                 if 'authority_credentials' in config:
-                    print "***", config['authority_credentials'].keys()
+                    print("***", config['authority_credentials'].keys())
                     for authority_hrn, credential in config['authority_credentials'].items():
                         #if credential is not expired:
                         credential_authorities.add(authority_hrn)
                         #else
                         #    credential_authorities_expired.add(authority_hrn)
                 if 'delegated_authority_credentials' in config:
                     for authority_hrn, credential in config['authority_credentials'].items():
                         #if credential is not expired:
                         credential_authorities.add(authority_hrn)
                         #else
                         #    credential_authorities_expired.add(authority_hrn)
                 if 'delegated_authority_credentials' in config:
-                    print "***", config['delegated_authority_credentials'].keys()
+                    print("***", config['delegated_authority_credentials'].keys())
                     for authority_hrn, credential in config['delegated_authority_credentials'].items():
                         #if credential is not expired:
                         credential_authorities.add(authority_hrn)
                         #else
                         #    credential_authorities_expired.add(authority_hrn)
 
                     for authority_hrn, credential in config['delegated_authority_credentials'].items():
                         #if credential is not expired:
                         credential_authorities.add(authority_hrn)
                         #else
                         #    credential_authorities_expired.add(authority_hrn)
 
-            print 'credential_authorities =', credential_authorities
-            print 'credential_authorities_expired =', credential_authorities_expired
+            print('credential_authorities =', credential_authorities)
+            print('credential_authorities_expired =', credential_authorities_expired)
 
 #            # Using cache manifold-tables to get the list of authorities faster
 #            all_authorities_query = Query.get('authority').select('name', 'authority_hrn')
 
 #            # Using cache manifold-tables to get the list of authorities faster
 #            all_authorities_query = Query.get('authority').select('name', 'authority_hrn')
@@ -158,7 +160,7 @@ class ValidatePendingView(LoginRequiredAutoLogoutView, ThemeView):
                 for pa in pi_authorities_tmp:
                     pi_authorities |= set(pa['pi_authorities'])
             except:
                 for pa in pi_authorities_tmp:
                     pi_authorities |= set(pa['pi_authorities'])
             except:
-                print 'No pi_authorities'
+                print('No pi_authorities')
 # TODO: exception if no parent_authority
 #             try:
 #                 for pa in pi_authorities_tmp:
 # TODO: exception if no parent_authority
 #             try:
 #                 for pa in pi_authorities_tmp:
@@ -260,8 +262,8 @@ class ValidatePendingView(LoginRequiredAutoLogoutView, ThemeView):
                 dest[auth_hrn].append(request)
         
         context = super(ValidatePendingView, self).get_context_data(**kwargs)
                 dest[auth_hrn].append(request)
         
         context = super(ValidatePendingView, self).get_context_data(**kwargs)
-        print "testing"
-        print ctx_my_authorities
+        print("testing")
+        print(ctx_my_authorities)
         context['my_authorities']   = ctx_my_authorities
         context['sub_authorities']   = ctx_sub_authorities
         context['delegation_authorities'] = ctx_delegation_authorities
         context['my_authorities']   = ctx_my_authorities
         context['sub_authorities']   = ctx_sub_authorities
         context['delegation_authorities'] = ctx_delegation_authorities
index c348483..9a28ad6 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from manifold.core.query            import Query
 from manifoldapi.manifoldapi        import execute_query
 from portal.actions                 import is_pi
 from manifold.core.query            import Query
 from manifoldapi.manifoldapi        import execute_query
 from portal.actions                 import is_pi
@@ -75,7 +77,7 @@ class ObjectRequest(object):
         # What about key formed of multiple fields???
         query = Query.get('local:object').filter_by('table', '==', self.type).select('key')
         results = execute_query(self.request, query)
         # What about key formed of multiple fields???
         query = Query.get('local:object').filter_by('table', '==', self.type).select('key')
         results = execute_query(self.request, query)
-        print "key of object = %s" % results
+        print("key of object = %s" % results)
         if results :
             for r in results[0]['key'] :
                 self.id = r
         if results :
             for r in results[0]['key'] :
                 self.id = r
@@ -136,9 +138,9 @@ class ObjectRequest(object):
         if self.params :
             for p in self.params :
                 for k,v in p.iteritems() :
         if self.params :
             for p in self.params :
                 for k,v in p.iteritems() :
-                    print "param: %s : %s" % (k,v)
+                    print("param: %s : %s" % (k,v))
                     query.set({k : v})
                     query.set({k : v})
-            print "query = ",query
+            print("query = ",query)
         else:
             raise Exception, "Params are required for create"
         return execute_query(self.request, query)
         else:
             raise Exception, "Params are required for create"
         return execute_query(self.request, query)
@@ -150,9 +152,9 @@ class ObjectRequest(object):
         if self.params :
             for p in self.params :
                 for k,v in p.iteritems() :
         if self.params :
             for p in self.params :
                 for k,v in p.iteritems() :
-                    print "param: %s : %s" % (k,v)
+                    print("param: %s : %s" % (k,v))
                     query.set({k : v})
                     query.set({k : v})
-            print "query = ",query
+            print("query = ",query)
         else:
             raise Exception, "Params are required for update"
 
         else:
             raise Exception, "Params are required for update"
 
index afb62b7..25d1a6e 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from django.views.generic.base      import TemplateView
 from django.shortcuts               import render_to_response
 
 from django.views.generic.base      import TemplateView
 from django.shortcuts               import render_to_response
 
@@ -23,8 +25,8 @@ def dispatch(request, object_type, object_name):
     elif request.method == 'GET':
         #return error('only post request is supported')
         req_items = request.GET
     elif request.method == 'GET':
         #return error('only post request is supported')
         req_items = request.GET
-    print req_items
-    for el in req_items.items():
+    print(req_items)
+    for el in list(req_items.items()):
         # Filters not used for create
         if el[0].startswith('filters'):
             o.filters[el[0][8:-1]] = el[1]
         # Filters not used for create
         if el[0].startswith('filters'):
             o.filters[el[0][8:-1]] = el[1]
@@ -44,6 +46,6 @@ def dispatch(request, object_type, object_name):
         else :
             return error('an error has occurred')
  
         else :
             return error('an error has occurred')
  
-    except Exception, e:
+    except Exception as e:
         return error(str(e))
 
         return error(str(e))
 
index 21e9087..e5cc919 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from django.shortcuts               import render_to_response
 
 from unfold.loginrequired           import LoginRequiredView
 from django.shortcuts               import render_to_response
 
 from unfold.loginrequired           import LoginRequiredView
@@ -19,7 +21,7 @@ def dispatch(request, object_type, object_name):
         if el[0].startswith('filters'):
             o.filters[el[0][8:-1]] = el[1]
         elif el[0].startswith('fields'):
         if el[0].startswith('filters'):
             o.filters[el[0][8:-1]] = el[1]
         elif el[0].startswith('fields'):
-            print req_items.getlist('fields[]')
+            print(req_items.getlist('fields[]'))
             o.setFields(req_items.getlist('fields[]'))
         elif el[0].startswith('options'):
             o.options = req_items.getlist('options[]')
             o.setFields(req_items.getlist('fields[]'))
         elif el[0].startswith('options'):
             o.options = req_items.getlist('options[]')
index 04b156b..002c60a 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from sfa.trust.certificate      import Keypair, Certificate
 from sfa.client.sfaserverproxy  import SfaServerProxy
 from sfa.client.return_value    import ReturnValue
 from sfa.trust.certificate      import Keypair, Certificate
 from sfa.client.sfaserverproxy  import SfaServerProxy
 from sfa.client.return_value    import ReturnValue
@@ -58,15 +60,15 @@ def dispatch(request, method):
     from manifoldapi.manifoldapi    import execute_admin_query
     for pf in platforms:
         platform = get_platform_config(pf)
     from manifoldapi.manifoldapi    import execute_admin_query
     for pf in platforms:
         platform = get_platform_config(pf)
-        print platform
+        print(platform)
         if 'sm' in platform and len(platform['sm']) > 0:
         if 'sm' in platform and len(platform['sm']) > 0:
-            print 'sm'
+            print('sm')
             server_url = platform['sm']
         if 'rm' in platform and len(platform['rm']) > 0:
             server_url = platform['sm']
         if 'rm' in platform and len(platform['rm']) > 0:
-            print 'rm'
+            print('rm')
             server_url = platform['rm']
         if 'registry' in platform and len(platform['registry']) > 0:
             server_url = platform['rm']
         if 'registry' in platform and len(platform['registry']) > 0:
-            print 'registry'
+            print('registry')
             server_url = platform['registry']
     
         if not Config.has_option('monitor', 'cert') :
             server_url = platform['registry']
     
         if not Config.has_option('monitor', 'cert') :
index 8deb428..99d668d 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from django.views.generic.base      import TemplateView
 from django.shortcuts               import render_to_response
 
 from django.views.generic.base      import TemplateView
 from django.shortcuts               import render_to_response
 
@@ -23,15 +25,15 @@ def dispatch(request, object_type, object_name):
     elif request.method == 'GET':
         #return error('only post request is supported')
         req_items = request.GET
     elif request.method == 'GET':
         #return error('only post request is supported')
         req_items = request.GET
-    print req_items
+    print(req_items)
     for el in req_items.items():
         
     for el in req_items.items():
         
-        print "#===============>",el
+        print("#===============>",el)
         if el[0].startswith('filters'):
             o.filters[el[0][8:-1]] = el[1]
         elif el[0].startswith('params'):
         if el[0].startswith('filters'):
             o.filters[el[0][8:-1]] = el[1]
         elif el[0].startswith('params'):
-            print "#======> 0 ", el[0]
-            print "#======> 1 ", req_items.getlist(el[0])
+            print("#======> 0 ", el[0])
+            print("#======> 1 ", req_items.getlist(el[0]))
 
             if (el[0][-2:] == '[]') :
                 # when receiving params[key][] = 'value1' ...
 
             if (el[0][-2:] == '[]') :
                 # when receiving params[key][] = 'value1' ...
@@ -41,7 +43,7 @@ def dispatch(request, object_type, object_name):
                 # when receiving params[key] = 'value'
                 o.params.append({el[0][7:-1]:el[1]})
             
                 # when receiving params[key] = 'value'
                 o.params.append({el[0][7:-1]:el[1]})
             
-            print "o.params = ",o.params
+            print("o.params = ",o.params)
             
         elif el[0].startswith('fields'):
             o.fields=req_items.getlist('fields[]')
             
         elif el[0].startswith('fields'):
             o.fields=req_items.getlist('fields[]')
index 0c6a1d2..bee1fe4 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 import os
 from django.conf import settings
 from django.utils.datastructures import SortedDict
 import os
 from django.conf import settings
 from django.utils.datastructures import SortedDict
@@ -79,7 +81,7 @@ class ThirdPartyFinder(BaseFinder):
                         matched_path = os.path.join(path, file) 
                         if not all:
                             return matched_path
                         matched_path = os.path.join(path, file) 
                         if not all:
                             return matched_path
-                        print 'ThirdPartyFinder, adding',matched_path
+                        print('ThirdPartyFinder, adding',matched_path)
                         matches.append(matched_path)
         return matches
 
                         matches.append(matched_path)
         return matches
 
index f3d42fc..7787551 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from unfold.plugin import Plugin
 
 class Composite (Plugin):
 from unfold.plugin import Plugin
 
 class Composite (Plugin):
@@ -19,8 +21,8 @@ if a valid active_domid is not provided
     def check_active_domid(self):
         matches= [ son for son in self.sons if son.domid==self.active_domid ]
         if len(matches)!=1: 
     def check_active_domid(self):
         matches= [ son for son in self.sons if son.domid==self.active_domid ]
         if len(matches)!=1: 
-            print "WARNING: %s has %d valid son(s) for being active - expecting 1, resetting"%\
-                (self,len(matches))
+            print("WARNING: %s has %d valid son(s) for being active - expecting 1, resetting"%\
+                (self,len(matches)))
             self.active_domid=None
         
     def insert (self, plugin):
             self.active_domid=None
         
     def insert (self, plugin):
index d4f9e98..2aca0d0 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from django.contrib.auth.decorators     import login_required
 from django.utils.decorators            import method_decorator
 from django.http                        import HttpResponseRedirect
 from django.contrib.auth.decorators     import login_required
 from django.utils.decorators            import method_decorator
 from django.http                        import HttpResponseRedirect
@@ -45,7 +47,7 @@ def logout_on_manifold_exception (fun_that_returns_httpresponse):
             return HttpResponseRedirect ('/')
         except Exception, e:
             # xxx we need to sugarcoat this error message in some error template...
             return HttpResponseRedirect ('/')
         except Exception, e:
             # xxx we need to sugarcoat this error message in some error template...
-            print "Unexpected exception",e
+            print("Unexpected exception",e)
             import traceback
             traceback.print_exc()
             return HttpResponseRedirect ('/')
             import traceback
             traceback.print_exc()
             return HttpResponseRedirect ('/')
index 821c662..254b1a9 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 # the supervisor for Plugins
 # keeps a handle on all present plugins for managing their queries in a consistent way
 # it is expected to exist one such object for a given page
 # the supervisor for Plugins
 # keeps a handle on all present plugins for managing their queries in a consistent way
 # it is expected to exist one such object for a given page
@@ -106,7 +108,7 @@ class Page:
 
         # if cached, use it
         if 'metadata' in manifold and isinstance(manifold['metadata'],MetaData):
 
         # if cached, use it
         if 'metadata' in manifold and isinstance(manifold['metadata'],MetaData):
-            if debug: print "Page.get_metadata: return cached value"
+            if debug: print("Page.get_metadata: return cached value")
             return manifold['metadata']
 
         metadata_auth = {'AuthMethod':'anonymous'}
             return manifold['metadata']
 
         metadata_auth = {'AuthMethod':'anonymous'}
@@ -115,7 +117,7 @@ class Page:
         metadata.fetch(self.request)
         # store it for next time
         manifold['metadata']=metadata
         metadata.fetch(self.request)
         # store it for next time
         manifold['metadata']=metadata
-        if debug: print "Page.get_metadata: return new value"
+        if debug: print("Page.get_metadata: return new value")
         return metadata
             
     def expose_js_metadata (self):
         return metadata
             
     def expose_js_metadata (self):
index 229f196..c00021a 100644 (file)
@@ -2,6 +2,8 @@
 # so it should be specialized in real plugin classes
 # like e.g. plugins.simplelist.SimpleList
 
 # so it should be specialized in real plugin classes
 # like e.g. plugins.simplelist.SimpleList
 
+from __future__ import print_function
+
 import json
 
 from django.template.loader import render_to_string
 import json
 
 from django.template.loader import render_to_string
@@ -103,12 +105,12 @@ class Plugin:
         # what comes from subclasses
         for (k,v) in settings.iteritems():
             setattr(self,k,v)
         # what comes from subclasses
         for (k,v) in settings.iteritems():
             setattr(self,k,v)
-            if self.need_debug(): print "%s init - subclass setting %s"%(self.classname,k)
+            if self.need_debug(): print("%s init - subclass setting %s"%(self.classname,k))
         # minimal debugging
         if self.need_debug():
         # minimal debugging
         if self.need_debug():
-            print "%s init dbg .... BEG"%self.classname
-            for (k,v) in self.__dict__.items(): print "dbg %s:%s"%(k,v)
-            print "%s init dbg .... END"%self.classname
+            print("%s init dbg .... BEG"%self.classname)
+            for (k,v) in self.__dict__.items(): print("dbg %s:%s"%(k,v))
+            print("%s init dbg .... END"%self.classname)
         # do this only once the structure is fine
         if self.page: # I assume we can have a None page (Jordan)
             self.page.record_plugin(self)
         # do this only once the structure is fine
         if self.page: # I assume we can have a None page (Jordan)
             self.page.record_plugin(self)
@@ -151,7 +153,7 @@ class Plugin:
     def settings_json (self):
         exposed_settings=self.json_settings_list()
         if 'query' in exposed_settings:
     def settings_json (self):
         exposed_settings=self.json_settings_list()
         if 'query' in exposed_settings:
-            print "WARNING, cannot expose 'query' directly in json_settings_list, query_uuid is enough"
+            print("WARNING, cannot expose 'query' directly in json_settings_list, query_uuid is enough")
         result = "{"
         result += ",".join([ self.setting_json(setting) for setting in self.json_settings_list() ])
         result += "}"
         result = "{"
         result += ",".join([ self.setting_json(setting) for setting in self.json_settings_list() ])
         result += "}"
@@ -185,9 +187,9 @@ class Plugin:
             env.update({'persistent_toggle':False,'display_hide_button':True,
                         'display_show_button':False,'display_body':True})
         if self.need_debug(): 
             env.update({'persistent_toggle':False,'display_hide_button':True,
                         'display_show_button':False,'display_body':True})
         if self.need_debug(): 
-            print "rendering plugin.html with env keys %s"%env.keys()
+            print("rendering plugin.html with env keys %s"%env.keys())
             for (k,v) in env.items(): 
             for (k,v) in env.items(): 
-                if "display" in k or "persistent" in k: print k,'->',v
+                if "display" in k or "persistent" in k: print(k,'->',v)
         result = render_to_string ('plugin.html',env)
 
         # export this only for relevant plugins
         result = render_to_string ('plugin.html',env)
 
         # export this only for relevant plugins
@@ -219,12 +221,12 @@ class Plugin:
             raise Exception, "%s.template_env returns wrong type"%self.classname
         result=render_to_string (template, env)
         if self.need_debug():
             raise Exception, "%s.template_env returns wrong type"%self.classname
         result=render_to_string (template, env)
         if self.need_debug():
-            print "%s.render_content: BEG --------------------"%self.classname
-            print "template=%s"%template
-            print "env.keys=%s"%env.keys()
+            print("%s.render_content: BEG --------------------"%self.classname)
+            print("template=%s"%template)
+            print("env.keys=%s"%env.keys())
             #print "env=%s"%env
             #print result
             #print "env=%s"%env
             #print result
-            print "%s.render_content: END --------------------"%self.classname
+            print("%s.render_content: END --------------------"%self.classname)
         return result
 
     # or from the result of self.requirements()
         return result
 
     # or from the result of self.requirements()
@@ -233,7 +235,7 @@ class Plugin:
             d=self.requirements()
             for (k,v) in d.iteritems():
                 if self.need_debug():
             d=self.requirements()
             for (k,v) in d.iteritems():
                 if self.need_debug():
-                    print "%s: handling requirement %s"%(self.classname,v)
+                    print("%s: handling requirement %s"%(self.classname,v))
                 # e.g. js_files -> add_js_files
                 method_name='add_'+k
                 method=Page.__dict__[method_name]
                 # e.g. js_files -> add_js_files
                 method_name='add_'+k
                 method=Page.__dict__[method_name]
index 03e6def..c26c20b 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 from types import StringTypes, ListType
 
 from django.template.loader import render_to_string
 from types import StringTypes, ListType
 
 from django.template.loader import render_to_string
@@ -53,7 +55,7 @@ class Prelude:
         result += ",".join( [ "%s->%s"%(k,len(getattr(self,k))) for k in Prelude.keys ] )
         return result
     def inspect (self,msg):
         result += ",".join( [ "%s->%s"%(k,len(getattr(self,k))) for k in Prelude.keys ] )
         return result
     def inspect (self,msg):
-        print self.inspect_string(msg)
+        print(self.inspect_string(msg))
 
     # first attempt was to use a simple dict like this
     #    env={}
 
     # first attempt was to use a simple dict like this
     #    env={}
@@ -86,8 +88,8 @@ class Prelude:
         env['all_js_chunks']= self.js_init_chunks + self.js_chunks
         env['css_chunks']=self.css_chunks
         if debug:
         env['all_js_chunks']= self.js_init_chunks + self.js_chunks
         env['css_chunks']=self.css_chunks
         if debug:
-            print "prelude has %d js_files, %d css files, (%d+%d) js chunks and %d css_chunks"%\
-                (len(self.js_files),len(self.css_files),len(self.js_init_chunks),len(self.js_chunks),len(self.css_chunks),)
+            print("prelude has %d js_files, %d css files, (%d+%d) js chunks and %d css_chunks"%\
+                (len(self.js_files),len(self.css_files),len(self.js_init_chunks),len(self.js_chunks),len(self.css_chunks),))
         # render this with prelude.html and put the result in header_prelude
         header_prelude = render_to_string ('prelude.html',env)
         return { 'header_prelude' : header_prelude }
         # render this with prelude.html and put the result in header_prelude
         header_prelude = render_to_string ('prelude.html',env)
         return { 'header_prelude' : header_prelude }
index 4ef3cd1..b8b1c91 100644 (file)
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
 """
 This file demonstrates writing tests using the unittest module. These will pass
 when you run "manage.py test".
 """
 This file demonstrates writing tests using the unittest module. These will pass
 when you run "manage.py test".
@@ -14,8 +16,8 @@ class PluginTest(TestCase):
         """
         Tests that 1 + 1 always equals 2.
         """
         """
         Tests that 1 + 1 always equals 2.
         """
-        print 'test_basic is broken'
+        print('test_basic is broken')
         return True
         sl = SimpleList (visible=True)
         return True
         sl = SimpleList (visible=True)
-        print 'rendering', sl.render()
+        print('rendering', sl.render())
         self.assertEqual(1 + 1, 2)
         self.assertEqual(1 + 1, 2)