git://git.onelab.eu
/
myslice.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
79b9c74
)
remove the need for expose_queries, that gets done by prelude_env()
author
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Mon, 16 Dec 2013 16:48:23 +0000
(17:48 +0100)
committer
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Mon, 16 Dec 2013 16:48:23 +0000
(17:48 +0100)
13 files changed:
portal/dashboardview.py
patch
|
blob
|
history
portal/platformsview.py
patch
|
blob
|
history
portal/platformview.py
patch
|
blob
|
history
portal/portalpage.py
patch
|
blob
|
history
portal/resourceview.py
patch
|
blob
|
history
portal/sliceview.py
patch
|
blob
|
history
sample/dashboardview.py
patch
|
blob
|
history
sample/pluginview.py
patch
|
blob
|
history
sample/querygridview.py
patch
|
blob
|
history
sample/querytableview.py
patch
|
blob
|
history
sample/tabview.py
patch
|
blob
|
history
sample/topmenuvalidationview.py
patch
|
blob
|
history
unfold/page.py
patch
|
blob
|
history
diff --git
a/portal/dashboardview.py
b/portal/dashboardview.py
index
95abbaf
..
2f04a40
100644
(file)
--- a/
portal/dashboardview.py
+++ b/
portal/dashboardview.py
@@
-75,7
+75,6
@@
class DashboardView (LoginRequiredAutoLogoutView):
context['username'] = the_user(self.request)
page.expose_js_metadata()
context['username'] = the_user(self.request)
page.expose_js_metadata()
- page.expose_queries()
# the page header and other stuff
context.update(page.prelude_env())
# the page header and other stuff
context.update(page.prelude_env())
diff --git
a/portal/platformsview.py
b/portal/platformsview.py
index
6744643
..
fee7397
100644
(file)
--- a/
portal/platformsview.py
+++ b/
portal/platformsview.py
@@
-18,7
+18,6
@@
class PlatformsView(FreeAccessView):
page.enqueue_query(platform_query)
page.expose_js_metadata()
page.enqueue_query(platform_query)
page.expose_js_metadata()
- page.expose_queries()
platformlist = QueryTable(
page = page,
title = 'List',
platformlist = QueryTable(
page = page,
title = 'List',
diff --git
a/portal/platformview.py
b/portal/platformview.py
index
f3ea7f7
..
f852daa
100644
(file)
--- a/
portal/platformview.py
+++ b/
portal/platformview.py
@@
-24,7
+24,6
@@
class PlatformView(FreeAccessView):
page.enqueue_query(network_query)
page.expose_js_metadata()
page.enqueue_query(network_query)
page.expose_js_metadata()
- page.expose_queries()
networklist = QueryTable(
page = page,
title = 'List',
networklist = QueryTable(
page = page,
title = 'List',
diff --git
a/portal/portalpage.py
b/portal/portalpage.py
index
f592444
..
2023e4f
100644
(file)
--- a/
portal/portalpage.py
+++ b/
portal/portalpage.py
@@
-29,6
+29,8
@@
class PortalPage(Page):
# Jordan: it seems we need this to init plugins js
# Issue a "manifold is not defined" error
#self.expose_queries ()
# Jordan: it seems we need this to init plugins js
# Issue a "manifold is not defined" error
#self.expose_queries ()
+ # Thierry: this is deprecated anyway, and will happen as part of prelude_env
+ # "manifold not defined" would be due to a missing dependency to manifold.js or something...
template_env.update(self.prelude_env())
result=render_to_response ('view-unfold1.html',template_env,
template_env.update(self.prelude_env())
result=render_to_response ('view-unfold1.html',template_env,
diff --git
a/portal/resourceview.py
b/portal/resourceview.py
index
155eff3
..
c4d6e28
100644
(file)
--- a/
portal/resourceview.py
+++ b/
portal/resourceview.py
@@
-31,7
+31,6
@@
class ResourceView(FreeAccessView):
page.enqueue_query(resource_query)
page.expose_js_metadata()
page.enqueue_query(resource_query)
page.expose_js_metadata()
- page.expose_queries()
resourcelist = QueryTable(
page = page,
resourcelist = QueryTable(
page = page,
diff --git
a/portal/sliceview.py
b/portal/sliceview.py
index
b9ac8b1
..
db25e64
100644
(file)
--- a/
portal/sliceview.py
+++ b/
portal/sliceview.py
@@
-433,7
+433,6
@@
class SliceView (LoginRequiredAutoLogoutView):
# don't forget to run the requests
page.expose_js_metadata()
# don't forget to run the requests
page.expose_js_metadata()
- page.expose_queries ()
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
template_env.update(page.prelude_env())
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
template_env.update(page.prelude_env())
diff --git
a/sample/dashboardview.py
b/sample/dashboardview.py
index
f4bde8f
..
947c79d
100644
(file)
--- a/
sample/dashboardview.py
+++ b/
sample/dashboardview.py
@@
-92,12
+92,6
@@
def dashboard_view (request):
# add our own css in the mix
#page.add_css_files ( 'css/dashboard.css')
# add our own css in the mix
#page.add_css_files ( 'css/dashboard.css')
- # don't forget to run the requests
- page.expose_queries ()
-
- # xxx create another plugin with the same query and a different layout (with_datatables)
- # show that it worls as expected, one single api call to backend and 2 refreshed views
-
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
diff --git
a/sample/pluginview.py
b/sample/pluginview.py
index
f200312
..
85441bf
100644
(file)
--- a/
sample/pluginview.py
+++ b/
sample/pluginview.py
@@
-92,9
+92,6
@@
$(function(){$("#bouton").click(issue_debug);});
template_env [ 'topmenu_items' ] = topmenu_items('plugin', request)
template_env [ 'username' ] = the_user (request)
template_env [ 'topmenu_items' ] = topmenu_items('plugin', request)
template_env [ 'username' ] = the_user (request)
- # run queries when we have any
- page.expose_queries ()
-
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
diff --git
a/sample/querygridview.py
b/sample/querygridview.py
index
ef8d993
..
1b2a16b
100644
(file)
--- a/
sample/querygridview.py
+++ b/
sample/querygridview.py
@@
-73,9
+73,6
@@
class QueryGridView (TemplateView):
# so we can sho who is logged
template_env [ 'username' ] = the_user (request)
# so we can sho who is logged
template_env [ 'username' ] = the_user (request)
- # don't forget to run the requests
- page.expose_queries ()
-
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
diff --git
a/sample/querytableview.py
b/sample/querytableview.py
index
2e08abc
..
4b667aa
100644
(file)
--- a/
sample/querytableview.py
+++ b/
sample/querytableview.py
@@
-72,9
+72,6
@@
class QueryTableView (TemplateView):
# so we can sho who is logged
template_env [ 'username' ] = the_user (request)
# so we can sho who is logged
template_env [ 'username' ] = the_user (request)
- # don't forget to run the requests
- page.expose_queries ()
-
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
diff --git
a/sample/tabview.py
b/sample/tabview.py
index
167788e
..
95c4828
100644
(file)
--- a/
sample/tabview.py
+++ b/
sample/tabview.py
@@
-14,14
+14,14
@@
def tab_view (request):
print "request", request.__class__
print request
prelude=Prelude( js_files='js/bootstrap.js', css_files='css/bootstrap.css')
print "request", request.__class__
print request
prelude=Prelude( js_files='js/bootstrap.js', css_files='css/bootstrap.css')
- prelude_env = prelude.prelude_env()
tab_env = {'title':'Page for playing with Tabs',
'topmenu_items': topmenu_items('tab',request),
'username':the_user (request),
'lorem': lorem,
}
tab_env = {'title':'Page for playing with Tabs',
'topmenu_items': topmenu_items('tab',request),
'username':the_user (request),
'lorem': lorem,
}
- tab_env.update (prelude_env)
+
+ tab_env.update (prelude.prelude_env())
return render_to_response ('view-tab.html', tab_env,
context_instance=RequestContext(request))
return render_to_response ('view-tab.html', tab_env,
context_instance=RequestContext(request))
diff --git
a/sample/topmenuvalidationview.py
b/sample/topmenuvalidationview.py
index
27b420e
..
506423c
100644
(file)
--- a/
sample/topmenuvalidationview.py
+++ b/
sample/topmenuvalidationview.py
@@
-31,9
+31,6
@@
class TopmenuValidationView (TemplateView):
# so we can see who is logged
template_env [ 'username' ] = the_user (request)
# so we can see who is logged
template_env [ 'username' ] = the_user (request)
- # don't forget to run the requests
- page.expose_queries ()
-
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
# the prelude object in page contains a summary of the requirements() for all plugins
# define {js,css}_{files,chunks}
prelude_env = page.prelude_env()
diff --git
a/unfold/page.py
b/unfold/page.py
index
87a3bfb
..
834be7e
100644
(file)
--- a/
unfold/page.py
+++ b/
unfold/page.py
@@
-49,7
+49,7
@@
class Page:
# self._queue = []
# this method adds a query to the page
# self._queue = []
# this method adds a query to the page
- # the query will be exposed to js when calling
expose_queries
+ # the query will be exposed to js when calling
__expose_queries, which is done by prelude_env()
# additionally if run_it is set to True, this query will be asynchroneously triggered on page load
# in this case (exec=True) the js async callback (see manifold.asynchroneous_success)
# offers the option to deliver the result to a specific DOM elt (in this case, set domid)
# additionally if run_it is set to True, this query will be asynchroneously triggered on page load
# in this case (exec=True) the js async callback (see manifold.asynchroneous_success)
# offers the option to deliver the result to a specific DOM elt (in this case, set domid)
@@
-73,11
+73,11
@@
class Page:
self.add_js_files('js/record_generator.js');
js_chunk = '$(document).ready(function() { new RecordGenerator(%s,%s,%s).run(); });'%(query.to_json(),json.dumps(generators),number);
self.add_js_chunks(js_chunk)
self.add_js_files('js/record_generator.js');
js_chunk = '$(document).ready(function() { new RecordGenerator(%s,%s,%s).run(); });'%(query.to_json(),json.dumps(generators),number);
self.add_js_chunks(js_chunk)
-
+
# return the javascript code for exposing queries
# all queries are inserted in the global manifold object
# in addition, the ones enqueued with 'run_it=True' are triggered
# return the javascript code for exposing queries
# all queries are inserted in the global manifold object
# in addition, the ones enqueued with 'run_it=True' are triggered
- def expose_queries (self):
+ def
__
expose_queries (self):
# compute variables to expose to the template
env = {}
# expose the json definition of all queries
# compute variables to expose to the template
env = {}
# expose the json definition of all queries
@@
-139,5
+139,9
@@
class Page:
def add_js_chunks (self):pass
@to_prelude
def add_css_chunks (self):pass
def add_js_chunks (self):pass
@to_prelude
def add_css_chunks (self):pass
- @to_prelude
- def prelude_env (self):pass
+
+ # prelude_env also does expose_queries
+ def prelude_env (self):
+ self.__expose_queries()
+ from_prelude=self.prelude.prelude_env()
+ return from_prelude