1 # just one instance of validator
2 from django.views.generic.base import TemplateView
3 from django.template import RequestContext
4 from django.shortcuts import render_to_response
6 from manifold.core.query import Query, AnalyzedQuery
8 from unfold.page import Page
10 from ui.topmenu import topmenu_items_live, the_user
12 class TopmenuValidationView (TemplateView):
14 # mention a user name in the URL as .../trash/simpletopmenuvalidation/ple.inria.thierry_parmentelat
15 def get (self, request, username='ple.inria.thierry_parmentelat'):
17 if username=='logged': username='$user_hrn'
21 # variables that will get passed to the view-unfold1.html template
24 # write something of our own instead
25 template_env ['unfold_main'] = '<h1>Some title </h1>'
27 # more general variables expected in the template
28 template_env [ 'title' ] = 'simple topmenuvalidation %(username)s'%locals()
29 # the menu items on the top
30 template_env [ 'topmenu_items' ] = topmenu_items_live('Slice', page)
31 # so we can see who is logged
32 template_env [ 'username' ] = the_user (request)
34 # the prelude object in page contains a summary of the requirements() for all plugins
35 # define {js,css}_{files,chunks}
36 prelude_env = page.prelude_env()
38 # print prelude_env.keys()
39 # for k in [ 'js_files' ] :
40 # print 'prelude_env',prelude_env,k,prelude_env[k]
42 template_env.update(prelude_env)
43 result=render_to_response ('view-unfold1.html',template_env,
44 context_instance=RequestContext(request))