debug=False
debug=True
+def mytruncate (obj, l):
+ # we will add '..'
+ l1=l-2
+ repr="%s"%obj
+ return (repr[:l1]+'..') if len(repr)>l1 else repr
+
class ManifoldAPI:
def __init__(self, auth=None, cainfo=None):
elif isinstance (result,list): print "result is a %d-elts list"%len(result)
elif isinstance (result,dict):
print "result is a dict with %d keys : %s"%(len(result),result.keys())
- for (k,v) in result.iteritems(): print '...',k,':',v
- print "result is a dict with %d keys : %s"%(len(result),result.keys()),
+ for (k,v) in result.iteritems():
+ if v is None: continue
+ print '+++',k,':',mytruncate (v,60)
else: print "[dont know how to display result] %s"%result
# xxx temporary code for scaffolding a ManifolResult on top of an API that does not expose error info
def __getattr__(self, methodName):
def func(*args, **kwds):
try:
- if debug: print "====> ManifoldAPI.%s"%methodName,"auth",self.auth,"args",args,"kwds",kwds
+ if debug:
+ print "====> ManifoldAPI.%s"%methodName,"auth",self.auth,"args",args,"kwds",kwds
result=getattr(self.server, methodName)(self.auth, *args, **kwds)
if debug:
print '<==== backend call %s(*%s,**%s) returned'%(methodName,args,kwds),
print '.ctd. Authmethod=',self.auth['AuthMethod'], self.url,'->',
self._print_result(result)
+ print '===== ManifoldAPI call done'
return ResultValue(**result)
# 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 django.conf import settings
-from django.contrib.sites.models import Site, RequestSite
-from django.contrib import messages
-from django.views.generic import View
+import os.path, re
+import json
+
+#from django.views.generic import View
from django.views.generic.base import TemplateView
from django.shortcuts import render
from django.template.loader import render_to_string
from plugins.hazelnut import Hazelnut
from plugins.pres_view import PresView
from portal.event import Event
-import json
from portal import signals
from portal.forms import SliceRequestForm, ContactForm
from myslice.viewutils import topmenu_items, the_user
from django.http import HttpResponseRedirect, HttpResponse
-from M2Crypto import Rand, RSA, BIO
-import os, re
-
#class for my_account
class AccountView(TemplateView):
template_name = "my_account.html"