--- a/web/request.py Thu Feb 12 16:47:31 2009 +0100
+++ b/web/request.py Fri Feb 13 09:30:18 2009 +0100
@@ -201,7 +201,7 @@
def update_search_state(self):
"""update the current search state"""
searchstate = self.form.get('__mode')
- if not searchstate:
+ if not searchstate and self.cnx is not None:
searchstate = self.get_session_data('search_state', 'normal')
self.set_search_state(searchstate)
@@ -212,7 +212,8 @@
else:
self.search_state = ('linksearch', searchstate.split(':'))
assert len(self.search_state[-1]) == 4
- self.set_session_data('search_state', searchstate)
+ if self.cnx is not None:
+ self.set_session_data('search_state', searchstate)
def update_breadcrumbs(self):
"""stores the last visisted page in session data"""
--- a/web/views/basetemplates.py Thu Feb 12 16:47:31 2009 +0100
+++ b/web/views/basetemplates.py Fri Feb 13 09:30:18 2009 +0100
@@ -75,7 +75,6 @@
- guess and call an appropriate view through the view manager
"""
id = 'main'
- nav_html = UStringIO()
def _select_view_and_rset(self):
req = self.req
@@ -165,6 +164,7 @@
self.req, self.rset)
if etypefilter and etypefilter.propval('visible'):
etypefilter.dispatch(w=self.w)
+ self.nav_html = UStringIO()
self.pagination(self.req, self.rset, self.nav_html.write,
not (view and view.need_navigation))
self.w(_(self.nav_html.getvalue()))
--- a/web/views/boxes.py Thu Feb 12 16:47:31 2009 +0100
+++ b/web/views/boxes.py Fri Feb 13 09:30:18 2009 +0100
@@ -10,14 +10,14 @@
* startup views box
:organization: Logilab
-:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__docformat__ = "restructuredtext en"
from logilab.mtconverter import html_escape
-from cubicweb.common.selectors import (any_rset, appobject_selectable)
+from cubicweb.common.selectors import any_rset, appobject_selectable
from cubicweb.web.htmlwidgets import BoxWidget, BoxMenu, BoxHtml, RawBoxItem
from cubicweb.web.box import BoxTemplate, ExtResourcesBoxTemplate
@@ -175,17 +175,16 @@
def call(self, **kwargs):
box = BoxWidget(self.req._(self.title), self.id)
- actions = [v for v in self.vreg.possible_views(self.req, self.rset)
- if v.category != 'startupview']
- for category, actions in self.sort_actions(actions):
+ views = [v for v in self.vreg.possible_views(self.req, self.rset)
+ if v.category != 'startupview']
+ for category, views in self.sort_actions(views):
menu = BoxMenu(category)
- for action in actions:
- menu.append(self.box_action(action))
+ for view in views:
+ menu.append(self.box_action(view))
box.append(menu)
if not box.is_empty():
box.render(self.w)
-
class RSSIconBox(ExtResourcesBoxTemplate):
"""just display the RSS icon on uniform result set"""
@@ -203,23 +202,6 @@
self.w(u'<a href="%s"><img src="%s" alt="rss"/></a>\n' % (html_escape(url), rss))
-## warning("schemabox ne marche plus pour le moment")
-## class SchemaBox(BoxTemplate):
-## """display a box containing link to list of entities by type"""
-## id = 'schema_box'
-## visible = False # disabled by default
-## title = _('entity list')
-## order = 60
-
-## def call(self, **kwargs):
-## box = BoxWidget(self.req._(title), self.id)
-## for etype in self.config.etypes(self.req.user, 'read'):
-## view = self.vreg.select_view('list', self.req, self.etype_rset(etype))
-## box.append(self.mk_action(display_name(self.req, etype, 'plural'),
-## view.url(), etype=etype))
-## if not box.is_empty():
-## box.render(self.w)
-
class StartupViewsBox(BoxTemplate):
"""display a box containing links to all startup views"""
id = 'startup_views_box'