-# having html tags right here is not a real use case
-hard_wired_list=[]
-hard_wired_list.append("this hard-wired list")
-hard_wired_list.append("is defined")
-hard_wired_list.append("in plugins.simplelist.py")
-hard_wired_list.append("which in turn relies on")
-hard_wired_list.append("template widget-template.html")
-hard_wired_list.append("while it should of course")
-hard_wired_list.append("instead issue a query")
-hard_wired_list.append("and fill the DOM in js from there")
-hard_wired_list.append("it would however maybe make sense")
-hard_wired_list.append("to offer the option to 'datatablify'")
-hard_wired_list.append("the list from the python code")
-hard_wired_list.append("just like a standard plugin can be set as visible or not")
-hard_wired_list.append("")
-hard_wired_list.append("OTOH and IMHO, there should be two separate and explicit subclasses of SimpleList for slices or testbeds")
+# a decorator for view classes to catch manifold exceptions
+# by design views should not directly exercise a manifold query
+# given that these are asynchroneous, you would expect a view to just
+# return a mundane skeleton
+# however of course this is not always true, and if only for metadata
+# that for some reason we deal with some other way, it is often a good idea
+# for a view to monitor these exceptions - and to take this opportunity to
+# logout people if it's a matter of expired session for example
+def logout_on_manifold_exception (view_as_a_function):
+ def wrapped (request, *args, **kwds):
+ try:
+ return view_as_a_function(request,*args, **kwds)
+ except ManifoldException, manifold_result:
+ # xxx we need a means to display this message to user...
+ from django.contrib.auth import logout
+ logout(request)
+ return HttpResponseRedirect ('/')
+ except Exception, e:
+ # xxx we need to sugarcoat this error message in some error template...
+ print "Unexpected exception",e
+ import traceback
+ traceback.print_exc()
+ return HttpResponseRedirect ('/')
+ return wrapped