--- a/common/appobject.py Tue Feb 17 21:42:23 2009 +0100
+++ b/common/appobject.py Tue Feb 17 21:42:33 2009 +0100
@@ -18,10 +18,10 @@
from cubicweb import Unauthorized
from cubicweb.vregistry import VObject
+from cubicweb.selectors import yes
from cubicweb.common.utils import UStringIO
from cubicweb.common.uilib import html_escape, ustrftime
from cubicweb.common.registerers import yes_registerer, priority_registerer
-from cubicweb.common.selectors import yes
--- a/common/entity.py Tue Feb 17 21:42:23 2009 +0100
+++ b/common/entity.py Tue Feb 17 21:42:33 2009 +0100
@@ -16,9 +16,9 @@
from cubicweb import Unauthorized
from cubicweb.vregistry import autoselectors
from cubicweb.rset import ResultSet
+from cubicweb.selectors import yes
from cubicweb.common.appobject import AppRsetObject
from cubicweb.common.registerers import id_registerer
-from cubicweb.common.selectors import yes
from cubicweb.common.uilib import printable_value, html_escape, soup2xhtml
from cubicweb.common.mixins import MI_REL_TRIGGERS
from cubicweb.common.mttransforms import ENGINE
--- a/common/mixins.py Tue Feb 17 21:42:23 2009 +0100
+++ b/common/mixins.py Tue Feb 17 21:42:33 2009 +0100
@@ -9,7 +9,7 @@
from logilab.common.decorators import cached
-from cubicweb.common.selectors import implement_interface
+from cubicweb.selectors import implements
from cubicweb.interfaces import IWorkflowable, IEmailable, ITree
@@ -315,8 +315,7 @@
"""a recursive tree view"""
id = 'tree'
item_vid = 'treeitem'
- __selectors__ = (implement_interface,)
- accepts_interfaces = (ITree,)
+ __selectors__ = implements(ITree)
def call(self, done=None, **kwargs):
if done is None:
--- a/goa/appobjects/components.py Tue Feb 17 21:42:23 2009 +0100
+++ b/goa/appobjects/components.py Tue Feb 17 21:42:33 2009 +0100
@@ -12,10 +12,9 @@
from logilab.common.decorators import cached
from cubicweb import typed_eid
+from cubicweb.selectors import one_line_rset, match_search_state, accept
from cubicweb.schema import display_name
from cubicweb.common.view import StartupView, EntityView
-from cubicweb.common.selectors import (one_line_rset, match_search_state,
- accept)
from cubicweb.web import Redirect
from cubicweb.web.views import vid_from_rset
from cubicweb.goa.db import rset_from_objs
@@ -31,9 +30,7 @@
"""
id = 'search-associate'
- __selectors__ = (one_line_rset, match_search_state, accept)
- accepts = ('Any',)
- search_states = ('linksearch',)
+ __selectors__ = (one_line_rset, match_search_state('linksearch'), accept)
def cell_call(self, row, col):
entity = self.entity(0, 0)
--- a/goa/appobjects/dbmgmt.py Tue Feb 17 21:42:23 2009 +0100
+++ b/goa/appobjects/dbmgmt.py Tue Feb 17 21:42:33 2009 +0100
@@ -13,7 +13,7 @@
from logilab.common.decorators import cached
from logilab.mtconverter import html_escape
-from cubicweb.common.selectors import none_rset, match_user_groups
+from cubicweb.selectors import none_rset, match_user_groups
from cubicweb.common.view import StartupView
from cubicweb.web import Redirect
from cubicweb.goa.dbinit import fix_entities, init_persistent_schema, insert_versions
--- a/goa/goactl.py Tue Feb 17 21:42:23 2009 +0100
+++ b/goa/goactl.py Tue Feb 17 21:42:33 2009 +0100
@@ -11,7 +11,7 @@
from cubicweb import BadCommandUsage
from cubicweb import CW_SOFTWARE_ROOT
from cubicweb.toolsutils import (Command, register_commands, copy_skeleton,
- create_dir, create_symlink, create_copy)
+ create_dir, create_symlink, create_copy)
from cubicweb.cwconfig import CubicWebConfiguration
from logilab import common as lgc
@@ -54,6 +54,7 @@
'rset.py',
'schema.py',
'schemaviewer.py',
+ 'selectors.py',
'vregistry.py',
'common/appobject.py',
@@ -65,7 +66,6 @@
'common/mttransforms.py',
'common/registerers.py',
'common/rest.py',
- 'common/selectors.py',
'common/view.py',
'common/uilib.py',
'common/utils.py',
--- a/selectors.py Tue Feb 17 21:42:23 2009 +0100
+++ b/selectors.py Tue Feb 17 21:42:33 2009 +0100
@@ -20,18 +20,17 @@
above by::
# in Python2.5
- from cubicweb.common.selectors import traced_selection
+ from cubicweb.selectors import traced_selection
with traced_selection():
self.view('calendar', myrset)
# in Python2.4
- from cubicweb.common import selectors
+ from cubicweb import selectors
selectors.TRACED_OIDS = ('calendar',)
self.view('calendar', myrset)
selectors.TRACED_OIDS = ()
-
:organization: Logilab
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
@@ -484,16 +483,12 @@
self.expected_ifaces = expected_ifaces
def score_class(self, eclass, req):
- print '***********************************'
score = 0
for iface in self.expected_ifaces:
- print 'TESTING', iface, 'on', eclass
if isinstance(iface, basestring):
# entity type
iface = eclass.vreg.etype_class(iface)
- print 'found iface ===', iface
if implements_iface(eclass, iface):
- print 'and implementing !!!'
score += 1
if getattr(iface, '__registry__', None) == 'etypes':
score += 1
@@ -509,7 +504,6 @@
score += index
# print 'etype majoration', index
break
- print '***********************************', score
return score
--- a/server/hooksmanager.py Tue Feb 17 21:42:23 2009 +0100
+++ b/server/hooksmanager.py Tue Feb 17 21:42:33 2009 +0100
@@ -181,9 +181,9 @@
# self.register_hook(tidy_html_fields('before_update_entity'), 'before_update_entity', '')
from cubicweb.vregistry import autoselectors
+from cubicweb.selectors import yes
from cubicweb.common.appobject import AppObject
from cubicweb.common.registerers import yes_registerer
-from cubicweb.common.selectors import yes
class autoid(autoselectors):
"""metaclass to create an unique 'id' attribute on the class using it"""
--- a/sobjects/notification.py Tue Feb 17 21:42:23 2009 +0100
+++ b/sobjects/notification.py Tue Feb 17 21:42:33 2009 +0100
@@ -18,9 +18,9 @@
from logilab.common.textutils import normalize_text
from cubicweb import RegistryException
+from cubicweb.selectors import implements
from cubicweb.common.view import EntityView, Component
from cubicweb.common.registerers import accepts_registerer
-from cubicweb.common.selectors import implements
from cubicweb.common.mail import format_mail
from cubicweb.server.pool import PreCommitOperation
--- a/test/unittest_rset.py Tue Feb 17 21:42:23 2009 +0100
+++ b/test/unittest_rset.py Tue Feb 17 21:42:33 2009 +0100
@@ -5,7 +5,7 @@
from logilab.common.testlib import TestCase, unittest_main
from cubicweb.devtools.apptest import EnvBasedTC
-from cubicweb.common.selectors import traced_selection
+from cubicweb.selectors import traced_selection
from urlparse import urlsplit
from rql import parse
--- a/web/controller.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/controller.py Tue Feb 17 21:42:33 2009 +0100
@@ -11,7 +11,7 @@
from cubicweb import typed_eid
from cubicweb.common.registerers import priority_registerer
-from cubicweb.common.selectors import yes, require_group_compat
+from cubicweb.selectors import yes, require_group_compat
from cubicweb.common.appobject import AppObject
from cubicweb.web import LOGGER, Redirect, RequestError
--- a/web/facet.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/facet.py Tue Feb 17 21:42:33 2009 +0100
@@ -19,7 +19,7 @@
from rql import parse, nodes
from cubicweb import Unauthorized, typed_eid
-from cubicweb.common.selectors import match_context_prop, one_has_relation
+from cubicweb.selectors import match_context_prop, one_has_relation
from cubicweb.common.registerers import priority_registerer
from cubicweb.common.appobject import AppRsetObject
from cubicweb.common.utils import AcceptMixIn
--- a/web/form.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/form.py Tue Feb 17 21:42:33 2009 +0100
@@ -11,7 +11,7 @@
from logilab.mtconverter import html_escape
from cubicweb import typed_eid
-from cubicweb.common.selectors import match_form_params
+from cubicweb.selectors import match_form_params
from cubicweb.common.registerers import accepts_registerer
from cubicweb.common.view import NOINDEX, NOFOLLOW, View, EntityView, AnyRsetView
from cubicweb.web import stdmsgs
--- a/web/views/actions.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/actions.py Tue Feb 17 21:42:33 2009 +0100
@@ -6,7 +6,7 @@
"""
__docformat__ = "restructuredtext en"
-from cubicweb.common.selectors import (
+from cubicweb.selectors import (
yes, one_line_rset, two_lines_rset, one_etype_rset, relation_possible,
non_final_entity,
authenticated_user, match_user_groups, match_search_state,
--- a/web/views/ajaxedit.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/ajaxedit.py Tue Feb 17 21:42:33 2009 +0100
@@ -1,13 +1,12 @@
"""Set of views allowing edition of entities/relations using ajax
:organization: Logilab
-:copyright: 2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__docformat__ = "restructuredtext en"
-from cubicweb.common.selectors import (chainfirst, match_form_params,
- match_kwargs)
+from cubicweb.selectors import chainfirst, match_form_params, match_kwargs
from cubicweb.web.box import EditRelationBoxTemplate
class AddRelationView(EditRelationBoxTemplate):
--- a/web/views/basecomponents.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/basecomponents.py Tue Feb 17 21:42:33 2009 +0100
@@ -13,11 +13,11 @@
from rql import parse
from cubicweb import Unauthorized
+from cubicweb.selectors import (yes, non_final_entity, one_line_rset,
+ chainfirst, two_etypes_rset,
+ match_form_params, relation_possible)
from cubicweb.common.uilib import html_escape, toggle_action
-from cubicweb.common.selectors import yes, non_final_entity, one_line_rset
from cubicweb.schema import display_name
-from cubicweb.common.selectors import (chainfirst, two_etypes_rset,
- match_form_params, relation_possible)
from cubicweb.web.htmlwidgets import MenuWidget, PopupBoxMenu, BoxSeparator, BoxLink
from cubicweb.web.component import (Component, EntityVComponent,
--- a/web/views/basecontrollers.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/basecontrollers.py Tue Feb 17 21:42:33 2009 +0100
@@ -18,8 +18,7 @@
from logilab.common.decorators import cached
from cubicweb import NoSelectableObject, ValidationError, typed_eid
-from cubicweb.selectors import match_user_groups
-from cubicweb.common.selectors import yes
+from cubicweb.selectors import yes, match_user_groups
from cubicweb.common.mail import format_mail
from cubicweb.common.view import STRICT_DOCTYPE, CW_XHTML_EXTENSIONS
from cubicweb.web import ExplicitLogin, Redirect, RemoteCallFailed
--- a/web/views/baseforms.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/baseforms.py Tue Feb 17 21:42:33 2009 +0100
@@ -15,11 +15,11 @@
from logilab.common.decorators import cached
from cubicweb.interfaces import IWorkflowable
+from cubicweb.selectors import (specified_etype_implements,
+ match_kwargs, match_form_params,
+ one_line_rset, implements)
from cubicweb.common.utils import make_uid
from cubicweb.common.uilib import cut
-from cubicweb.common.selectors import (specified_etype_implements,
- match_kwargs, match_form_params,
- one_line_rset, implements)
from cubicweb.common.view import EntityView
from cubicweb.web import INTERNAL_FIELD_VALUE, stdmsgs, eid_param
from cubicweb.web.controller import NAV_FORM_PARAMETERS
--- a/web/views/bookmark.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/bookmark.py Tue Feb 17 21:42:33 2009 +0100
@@ -9,7 +9,7 @@
from logilab.mtconverter import html_escape
from cubicweb import Unauthorized
-from cubicweb.common.selectors import implements
+from cubicweb.selectors import implements
from cubicweb.web.htmlwidgets import BoxWidget, BoxMenu, RawBoxItem
from cubicweb.web.action import Action
from cubicweb.web.box import UserRQLBoxTemplate
--- a/web/views/calendar.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/calendar.py Tue Feb 17 21:42:33 2009 +0100
@@ -1,7 +1,7 @@
"""html calendar views
: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
"""
@@ -13,9 +13,9 @@
from logilab.mtconverter import html_escape
from cubicweb.interfaces import ICalendarable
+from cubicweb.selectors import implements
from cubicweb.common.utils import date_range
from cubicweb.common.uilib import ajax_replace_url
-from cubicweb.common.selectors import implement_interface
from cubicweb.common.registerers import priority_registerer
from cubicweb.common.view import EntityView
@@ -83,8 +83,7 @@
Does apply to ICalendarable compatible entities
"""
__registerer__ = priority_registerer
- __selectors__ = (implement_interface,)
- accepts_interfaces = (ICalendarable,)
+ __selectors__ = implements(ICalendarable)
need_navigation = False
content_type = 'text/calendar'
title = _('iCalendar')
@@ -114,8 +113,7 @@
Does apply to ICalendarable compatible entities
"""
__registerer__ = priority_registerer
- __selectors__ = (implement_interface,)
- accepts_interfaces = (ICalendarable,)
+ __selectors__ = implements(ICalendarable)
need_navigation = False
title = _('hCalendar')
#templatable = False
@@ -146,8 +144,7 @@
class OneMonthCal(EntityView):
"""At some point, this view will probably replace ampm calendars"""
__registerer__ = priority_registerer
- __selectors__ = (implement_interface, )
- accepts_interfaces = (ICalendarable,)
+ __selectors__ = implements(ICalendarable)
need_navigation = False
id = 'onemonthcal'
title = _('one month')
@@ -331,8 +328,7 @@
class OneWeekCal(EntityView):
"""At some point, this view will probably replace ampm calendars"""
__registerer__ = priority_registerer
- __selectors__ = (implement_interface, )
- accepts_interfaces = (ICalendarable,)
+ __selectors__ = implements(ICalendarable)
need_navigation = False
id = 'oneweekcal'
title = _('one week')
--- a/web/views/embedding.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/embedding.py Tue Feb 17 21:42:33 2009 +0100
@@ -15,10 +15,10 @@
from logilab.mtconverter import guess_encoding
from cubicweb import urlquote # XXX should use view.url_quote method
+from cubicweb.selectors import (one_line_rset, score_entity,
+ match_search_state, implements)
from cubicweb.interfaces import IEmbedable
from cubicweb.common.uilib import soup2xhtml
-from cubicweb.common.selectors import (one_line_rset, score_entity,
- match_search_state, implements)
from cubicweb.common.view import NOINDEX, NOFOLLOW
from cubicweb.web.controller import Controller
from cubicweb.web.action import Action
--- a/web/views/eproperties.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/eproperties.py Tue Feb 17 21:42:33 2009 +0100
@@ -7,9 +7,250 @@
"""
__docformat__ = "restructuredtext en"
-from cubicweb.selectors import implements
+from logilab.mtconverter import html_escape
+
+from logilab.common.decorators import cached
+
+from cubicweb.selectors import (one_line_rset, none_rset, implements,
+ match_user_groups, chainfirst, chainall)
+from cubicweb.common.utils import UStringIO
+from cubicweb.common.view import StartupView
+from cubicweb.web import INTERNAL_FIELD_VALUE, eid_param, stdmsgs
from cubicweb.web.views import baseviews
+from cubicweb.web.form import FormMixIn
+
+_ = unicode
+
+# some string we want to be internationalizable for nicer display of eproperty
+# groups
+_('navigation')
+_('ui')
+_('actions')
+_('boxes')
+_('components')
+_('contentnavigation')
class EPropertyPrimaryView(baseviews.PrimaryView):
__selectors__ = implements('EProperty')
skip_none = False
+
+
+def make_togglable_link(nodeid, label, cookiename):
+ """builds a HTML link that switches the visibility & remembers it"""
+ action = u"javascript: toggle_and_remember_visibility('%s', '%s')" % \
+ (nodeid, cookiename)
+ return u'<a href="%s">%s</a>' % (action, label)
+
+def css_class(someclass):
+ return someclass and 'class="%s"' % someclass or ''
+
+class SystemEPropertiesForm(FormMixIn, StartupView):
+ id = 'systemepropertiesform'
+ __selectors__ = (none_rset, match_user_groups('managers'))
+
+ title = _('site configuration')
+ controller = 'edit'
+ category = 'startupview'
+
+ def linkable(self):
+ return True
+
+ def url(self):
+ """return the url associated with this view. We can omit rql here"""
+ return self.build_url('view', vid=self.id)
+
+ def _cookie_name(self, somestr):
+ return str('%s_property_%s' % (self.config.appid, somestr))
+
+ def _group_status(self, group, default=u'hidden'):
+ cookies = self.req.get_cookie()
+ cookiename = self._cookie_name(group)
+ cookie = cookies.get(cookiename)
+ if cookie is None:
+ cookies[cookiename] = default
+ self.req.set_cookie(cookies, cookiename, maxage=None)
+ status = default
+ else:
+ status = cookie.value
+ return status
+
+ def call(self, **kwargs):
+ """The default view representing the application's index"""
+ self.req.add_js(('cubicweb.edition.js', 'cubicweb.preferences.js'))
+ self.req.add_css('cubicweb.preferences.css')
+ vreg = self.vreg
+ values = self.defined_keys
+ groupedopts = {}
+ mainopts = {}
+ # "self.id=='systemepropertiesform'" to skip site wide properties on
+ # user's preference but not site's configuration
+ for key in vreg.user_property_keys(self.id=='systemepropertiesform'):
+ parts = key.split('.')
+ if parts[0] in vreg:
+ # appobject configuration
+ reg, oid, propid = parts
+ groupedopts.setdefault(reg, {}).setdefault(oid, []).append(key)
+ else:
+ mainopts.setdefault(parts[0], []).append(key)
+ # precompute form to consume error message
+ for group, keys in mainopts.items():
+ mainopts[group] = self.form(keys, False)
+ for group, objects in groupedopts.items():
+ for oid, keys in objects.items():
+ groupedopts[group][oid] = self.form(keys, True)
+
+ w = self.w
+ req = self.req
+ _ = req._
+ w(u'<h1>%s</h1>\n' % _(self.title))
+ w(self.error_message())
+ for label, group, form in sorted((_(g), g, f)
+ for g, f in mainopts.iteritems()):
+ status = css_class(self._group_status(group)) #'hidden' (collapsed), or '' (open) ?
+ w(u'<h2 class="propertiesform">%s</h2>\n' %
+ (make_togglable_link('fieldset_' + group, label,
+ self._cookie_name(group))))
+ w(u'<div id="fieldset_%s" %s>' % (group, status))
+ w(u'<fieldset class="subentity">')
+ w(form)
+ w(u'</fieldset></div>')
+ for label, group, objects in sorted((_(g), g, o)
+ for g, o in groupedopts.iteritems()):
+ status = css_class(self._group_status(group))
+ w(u'<h2 class="propertiesform">%s</h2>\n' %
+ (make_togglable_link('fieldset_' + group, label,
+ self._cookie_name(group))))
+ w(u'<div id="fieldset_%s" %s>' % (group, status))
+ for label, oid, form in sorted((self.req.__('%s_%s' % (group, o)), o, f)
+ for o, f in objects.iteritems()):
+ w(u'<fieldset class="subentity">')
+ w(u'<legend class="componentTitle">%s</legend>\n' % label)
+ docmsgid = '%s_%s_description' % (group, oid)
+ doc = _(docmsgid)
+ if doc != docmsgid:
+ w(u'<p class="description">%s</p>' % html_escape(doc))
+ w(form)
+ w(u'</fieldset>')
+ w(u'</div>')
+
+ @property
+ @cached
+ def eprops_rset(self):
+ return self.req.execute('Any P,K,V WHERE P is EProperty, P pkey K, P value V, NOT P for_user U')
+
+ @property
+ def defined_keys(self):
+ values = {}
+ for i, entity in enumerate(self.eprops_rset.entities()):
+ values[entity.pkey] = i
+ return values
+
+ def entity_for_key(self, key):
+ values = self.defined_keys
+ if key in values:
+ entity = self.eprops_rset.get_entity(values[key], 0)
+ else:
+ entity = self.vreg.etype_class('EProperty')(self.req, None, None)
+ entity.eid = self.req.varmaker.next()
+ entity['value'] = self.vreg.property_value(key)
+ return entity
+
+ def form(self, keys, splitlabel=False):
+ stream = UStringIO()
+ w = stream.write
+ w(u'<form action="%s" method="post">\n' % self.build_url())
+ w(u'<fieldset>\n')
+ w(u'<input type="hidden" name="__errorurl" value="%s"/>\n'
+ % html_escape(self.req.url()))
+ w(u'<input type="hidden" name="__form_id" value="%s"/>\n' % self.id)
+ path = self.req.relative_path()
+ if '?' in path:
+ path, params = path.split('?', 1)
+ w(u'<input type="hidden" name="__redirectparams" value="%s"/>\n'
+ % html_escape(params))
+ w(u'<input type="hidden" name="__redirectpath" value="%s"/>\n' % path)
+ #w(u'<input type="hidden" name="__redirectrql" value=""/>\n')
+ w(u'<input type="hidden" name="__message" value="%s"/>\n'
+ % self.req._('changes applied'))
+ w(u'<table><tr><td>\n')
+
+ w(u'<table>\n')
+ for key in keys:
+ w(u'<tr>\n')
+ self.form_row(w, key, splitlabel)
+ w(u'</tr>\n')
+ w(u'</table>\n')
+ w(u'</td></tr><tr><td>\n')
+ w(self.button_ok())
+ w(self.button_cancel())
+ w(u'</td></tr></table>\n')
+ w(u'</fieldset>\n')
+ w(u'</form>\n')
+ return stream.getvalue()
+
+ def form_row(self, w, key, splitlabel):
+ entity = self.entity_for_key(key)
+ eid = entity.eid
+ if splitlabel:
+ w(u'<td class="label">%s</td>' % self.req._(key.split('.')[-1]))
+ else:
+ w(u'<td class="label">%s</td>' % self.req._(key))
+ wdg = self.vreg.property_value_widget(key, req=self.req)
+ error = wdg.render_error(entity)
+ w(u'<td class="%s">' % (error and 'error' or ''))
+ w(error)
+ self.form_row_hiddens(w, entity, key)
+ w(wdg.edit_render(entity))
+ w(u'</td>\n')
+ w(u'<td>%s</td>' % wdg.render_help(entity))
+ return entity
+
+ def form_row_hiddens(self, w, entity, key):
+ eid = entity.eid
+ w(u'<input type="hidden" name="eid" value="%s"/>' % eid)
+ w(u'<input type="hidden" name="%s" value="EProperty"/>' % eid_param('__type', eid))
+ w(u'<input type="hidden" name="%s" value="%s"/>' % (eid_param('pkey', eid), key))
+ w(u'<input type="hidden" name="%s" value="%s"/>' % (eid_param('edits-pkey', eid), ''))
+
+
+
+def is_user_prefs(cls, req, rset, row, col):
+ return req.user.eid == rset[row or 0 ][col or 0]
+
+
+class EPropertiesForm(SystemEPropertiesForm):
+ id = 'epropertiesform'
+ __selectors__ = (
+ implements('EUser'),
+ # we don't want guests to be able to come here
+ match_user_groups('users', 'managers'),
+ chainfirst(none_rset),
+ chainall(one_line_rset, is_user_prefs),
+ chainall(one_line_rset, match_user_groups('managers'))
+ )
+
+ title = _('preferences')
+
+ @property
+ def user(self):
+ if self.rset is None:
+ return self.req.user
+ return self.rset.get_entity(self.row or 0, self.col or 0)
+
+ @property
+ @cached
+ def eprops_rset(self):
+ return self.req.execute('Any P,K,V WHERE P is EProperty, P pkey K, P value V,'
+ 'P for_user U, U eid %(x)s', {'x': self.user.eid})
+
+ def form_row_hiddens(self, w, entity, key):
+ super(EPropertiesForm, self).form_row_hiddens(w, entity, key)
+ # if user is in the managers group and the property is being created,
+ # we have to set for_user explicitly
+ if not entity.has_eid() and self.user.matching_groups('managers'):
+ eid = entity.eid
+ w(u'<input type="hidden" name="%s" value="%s"/>'
+ % (eid_param('edits-for_user', eid), INTERNAL_FIELD_VALUE))
+ w(u'<input type="hidden" name="%s" value="%s"/>'
+ % (eid_param('for_user', eid), self.user.eid))
+
--- a/web/views/euser.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/euser.py Tue Feb 17 21:42:33 2009 +0100
@@ -10,7 +10,7 @@
from logilab.mtconverter import html_escape
from cubicweb.schema import display_name
-from cubicweb.common.selectors import one_line_rset, implements, match_user_groups
+from cubicweb.selectors import one_line_rset, implements, match_user_groups
from cubicweb.web import INTERNAL_FIELD_VALUE
from cubicweb.web.form import EntityForm
from cubicweb.web.action import Action
--- a/web/views/facets.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/facets.py Tue Feb 17 21:42:33 2009 +0100
@@ -10,9 +10,9 @@
from logilab.mtconverter import html_escape
-from cubicweb.common.selectors import (chainfirst, chainall, non_final_entity,
- two_lines_rset, match_context_prop,
- yes, one_has_relation)
+from cubicweb.selectors import (chainfirst, chainall, non_final_entity,
+ two_lines_rset, match_context_prop,
+ yes, one_has_relation)
from cubicweb.web.box import BoxTemplate
from cubicweb.web.facet import (AbstractFacet, VocabularyFacet, FacetStringWidget,
RelationFacet, prepare_facets_rqlst, filter_hiddens)
--- a/web/views/ibreadcrumbs.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/ibreadcrumbs.py Tue Feb 17 21:42:33 2009 +0100
@@ -1,7 +1,7 @@
"""navigation components definition for CubicWeb web client
: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"
@@ -9,8 +9,7 @@
from logilab.mtconverter import html_escape
from cubicweb.interfaces import IBreadCrumbs
-from cubicweb.common.selectors import (match_context_prop, one_line_rset,
- implement_interface)
+from cubicweb.selectors import match_context_prop, one_line_rset, implements
from cubicweb.common.view import EntityView
from cubicweb.common.uilib import cut
# don't use AnyEntity since this may cause bug with isinstance() due to reloading
@@ -29,8 +28,7 @@
# register msg not generated since no entity implements IPrevNext in cubicweb itself
title = _('contentnavigation_breadcrumbs')
help = _('contentnavigation_breadcrumbs_description')
- __selectors__ = (one_line_rset, match_context_prop, implement_interface)
- accepts_interfaces = (IBreadCrumbs,)
+ __selectors__ = (one_line_rset, match_context_prop, implements(IBreadCrumbs))
context = 'navtop'
order = 5
visible = False
--- a/web/views/idownloadable.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/idownloadable.py Tue Feb 17 21:42:33 2009 +0100
@@ -8,10 +8,10 @@
from logilab.mtconverter import BINARY_ENCODINGS, TransformError, html_escape
+from cubicweb.selectors import (one_line_rset, score_entity,
+ implements, match_context_prop)
from cubicweb.interfaces import IDownloadable
from cubicweb.common.mttransforms import ENGINE
-from cubicweb.common.selectors import (one_line_rset, score_entity,
- implements, match_context_prop)
from cubicweb.web.box import EntityBoxTemplate
from cubicweb.web.views import baseviews
--- a/web/views/igeocodable.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/igeocodable.py Tue Feb 17 21:42:33 2009 +0100
@@ -1,10 +1,16 @@
-# -*- coding: utf-8 -*-
+"""Specific views for entities implementing IGeocodable
+
+:organization: Logilab
+:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
+"""
+__docformat__ = "restructuredtext en"
import simplejson
from cubicweb.interfaces import IGeocodable
from cubicweb.common.view import EntityView
-from cubicweb.common.selectors import implement_interface
+from cubicweb.selectors import implements
class GeocodingJsonView(EntityView):
id = 'geocoding-json'
@@ -12,8 +18,7 @@
templatable = False
content_type = 'application/json'
- __selectors__ = (implement_interface,)
- accepts_interfaces = (IGeocodable,)
+ __selectors__ = implements(IGeocodable)
def call(self):
zoomlevel = self.req.form.pop('zoomlevel', 8)
@@ -46,8 +51,7 @@
class GoogleMapBubbleView(EntityView):
id = 'gmap-bubble'
- __selectors__ = (implement_interface,)
- accepts_interfaces = (IGeocodable,)
+ __selectors__ = implements(IGeocodable)
def cell_call(self, row, col):
entity = self.entity(row, col)
@@ -58,8 +62,7 @@
class GoogleMapsView(EntityView):
id = 'gmap-view'
- __selectors__ = (implement_interface,)
- accepts_interfaces = (IGeocodable,)
+ __selectors__ = implements(IGeocodable)
need_navigation = False
def call(self, gmap_key, width=400, height=400, uselabel=True, urlparams=None):
--- a/web/views/iprogress.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/iprogress.py Tue Feb 17 21:42:33 2009 +0100
@@ -1,7 +1,7 @@
"""Specific views for entities implementing IProgress
: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
"""
@@ -9,10 +9,10 @@
from logilab.mtconverter import html_escape
+from cubicweb.selectors import implements, accept
from cubicweb.interfaces import IProgress, IMileStone
from cubicweb.schema import display_name
from cubicweb.common.view import EntityView
-from cubicweb.common.selectors import implement_interface, accept
from cubicweb.web.htmlwidgets import ProgressBarWidget
@@ -35,9 +35,7 @@
id = 'progress_table_view'
title = _('task progression')
- __selectors__ = (accept, implement_interface)
-
- accepts_interfaces = (IMileStone,)
+ __selectors__ = implements(IMileStone)
# default columns of the table
columns = (_('project'), _('milestone'), _('state'), _('eta_date'),
@@ -182,9 +180,7 @@
"""displays a progress bar"""
id = 'progressbar'
title = _('progress bar')
- __selectors__ = (accept, implement_interface)
-
- accepts_interfaces = (IProgress,)
+ __selectors__ = implements(IProgress)
def cell_call(self, row, col):
self.req.add_css('cubicweb.iprogress.css')
--- a/web/views/management.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/management.py Tue Feb 17 21:42:33 2009 +0100
@@ -9,16 +9,11 @@
from logilab.mtconverter import html_escape
-from logilab.common.decorators import cached
-
-from cubicweb.selectors import (yes, one_line_rset, none_rset,
- match_user_groups, chainfirst, chainall)
-from cubicweb.common.utils import UStringIO
+from cubicweb.selectors import yes, none_rset, match_user_groups
from cubicweb.common.view import AnyRsetView, StartupView, EntityView
from cubicweb.common.uilib import html_traceback, rest_traceback
from cubicweb.web import INTERNAL_FIELD_VALUE, eid_param, stdmsgs
from cubicweb.web.widgets import StaticComboBoxWidget
-from cubicweb.web.form import FormMixIn
_ = unicode
@@ -150,8 +145,8 @@
newperm.eid = self.req.varmaker.next()
w(u'<p>%s</p>' % _('add a new permission'))
begin_form(w, newperm, 'security', entity.rest_path())
- w(u'<input type="hidden" name="%s" value="__cubicweb_internal_field__"/>'
- % eid_param('edito-require_permission', newperm.eid))
+ w(u'<input type="hidden" name="%s" value="%s"/>'
+ % (eid_param('edito-require_permission', newperm.eid), INTERNAL_FIELD_VALUE))
w(u'<input type="hidden" name="%s" value="%s"/>'
% (eid_param('require_permission', newperm.eid), entity.eid))
w(u'<table border="0">\n')
@@ -179,7 +174,7 @@
class ErrorView(AnyRsetView):
"""default view when no result has been found"""
- __selectors__ = (yes,)
+ __selectors__ = yes
id = 'error'
def page_title(self):
@@ -273,238 +268,6 @@
binfo += '\n'
return binfo
-# some string we want to be internationalizable for nicer display of eproperty
-# groups
-_('navigation')
-_('ui')
-_('actions')
-_('boxes')
-_('components')
-_('contentnavigation')
-
-
-def make_togglable_link(nodeid, label, cookiename):
- """builds a HTML link that switches the visibility & remembers it"""
- action = u"javascript: toggle_and_remember_visibility('%s', '%s')" % \
- (nodeid, cookiename)
- return u'<a href="%s">%s</a>' % (action, label)
-
-def css_class(someclass):
- return someclass and 'class="%s"' % someclass or ''
-
-class SystemEPropertiesForm(FormMixIn, StartupView):
- id = 'systemepropertiesform'
- __selectors__ = (none_rset, match_user_groups('managers'),)
-
- title = _('site configuration')
- controller = 'edit'
- category = 'startupview'
-
- def linkable(self):
- return True
-
- def url(self):
- """return the url associated with this view. We can omit rql here"""
- return self.build_url('view', vid=self.id)
-
- def _cookie_name(self, somestr):
- return str('%s_property_%s' % (self.config.appid, somestr))
-
- def _group_status(self, group, default=u'hidden'):
- cookies = self.req.get_cookie()
- cookiename = self._cookie_name(group)
- cookie = cookies.get(cookiename)
- if cookie is None:
- cookies[cookiename] = default
- self.req.set_cookie(cookies, cookiename, maxage=None)
- status = default
- else:
- status = cookie.value
- return status
-
- def call(self, **kwargs):
- """The default view representing the application's index"""
- self.req.add_js(('cubicweb.edition.js', 'cubicweb.preferences.js'))
- self.req.add_css('cubicweb.preferences.css')
- vreg = self.vreg
- values = self.defined_keys
- groupedopts = {}
- mainopts = {}
- # "self.id=='systemepropertiesform'" to skip site wide properties on
- # user's preference but not site's configuration
- for key in vreg.user_property_keys(self.id=='systemepropertiesform'):
- parts = key.split('.')
- if parts[0] in vreg:
- # appobject configuration
- reg, oid, propid = parts
- groupedopts.setdefault(reg, {}).setdefault(oid, []).append(key)
- else:
- mainopts.setdefault(parts[0], []).append(key)
- # precompute form to consume error message
- for group, keys in mainopts.items():
- mainopts[group] = self.form(keys, False)
- for group, objects in groupedopts.items():
- for oid, keys in objects.items():
- groupedopts[group][oid] = self.form(keys, True)
-
- w = self.w
- req = self.req
- _ = req._
- w(u'<h1>%s</h1>\n' % _(self.title))
- w(self.error_message())
- for label, group, form in sorted((_(g), g, f)
- for g, f in mainopts.iteritems()):
- status = css_class(self._group_status(group)) #'hidden' (collapsed), or '' (open) ?
- w(u'<h2 class="propertiesform">%s</h2>\n' %
- (make_togglable_link('fieldset_' + group, label,
- self._cookie_name(group))))
- w(u'<div id="fieldset_%s" %s>' % (group, status))
- w(u'<fieldset class="subentity">')
- w(form)
- w(u'</fieldset></div>')
- for label, group, objects in sorted((_(g), g, o)
- for g, o in groupedopts.iteritems()):
- status = css_class(self._group_status(group))
- w(u'<h2 class="propertiesform">%s</h2>\n' %
- (make_togglable_link('fieldset_' + group, label,
- self._cookie_name(group))))
- w(u'<div id="fieldset_%s" %s>' % (group, status))
- for label, oid, form in sorted((self.req.__('%s_%s' % (group, o)), o, f)
- for o, f in objects.iteritems()):
- w(u'<fieldset class="subentity">')
- w(u'<legend class="componentTitle">%s</legend>\n' % label)
- docmsgid = '%s_%s_description' % (group, oid)
- doc = _(docmsgid)
- if doc != docmsgid:
- w(u'<p class="description">%s</p>' % html_escape(doc))
- w(form)
- w(u'</fieldset>')
- w(u'</div>')
-
- @property
- @cached
- def eprops_rset(self):
- return self.req.execute('Any P,K,V WHERE P is EProperty, P pkey K, P value V, NOT P for_user U')
-
- @property
- def defined_keys(self):
- values = {}
- for i, entity in enumerate(self.eprops_rset.entities()):
- values[entity.pkey] = i
- return values
-
- def entity_for_key(self, key):
- values = self.defined_keys
- if key in values:
- entity = self.eprops_rset.get_entity(values[key], 0)
- else:
- entity = self.vreg.etype_class('EProperty')(self.req, None, None)
- entity.eid = self.req.varmaker.next()
- entity['value'] = self.vreg.property_value(key)
- return entity
-
- def form(self, keys, splitlabel=False):
- stream = UStringIO()
- w = stream.write
- w(u'<form action="%s" method="post">\n' % self.build_url())
- w(u'<fieldset>\n')
- w(u'<input type="hidden" name="__errorurl" value="%s"/>\n'
- % html_escape(self.req.url()))
- w(u'<input type="hidden" name="__form_id" value="%s"/>\n' % self.id)
- path = self.req.relative_path()
- if '?' in path:
- path, params = path.split('?', 1)
- w(u'<input type="hidden" name="__redirectparams" value="%s"/>\n'
- % html_escape(params))
- w(u'<input type="hidden" name="__redirectpath" value="%s"/>\n' % path)
- #w(u'<input type="hidden" name="__redirectrql" value=""/>\n')
- w(u'<input type="hidden" name="__message" value="%s"/>\n'
- % self.req._('changes applied'))
- w(u'<table><tr><td>\n')
-
- w(u'<table>\n')
- for key in keys:
- w(u'<tr>\n')
- self.form_row(w, key, splitlabel)
- w(u'</tr>\n')
- w(u'</table>\n')
- w(u'</td></tr><tr><td>\n')
- w(self.button_ok())
- w(self.button_cancel())
- w(u'</td></tr></table>\n')
- w(u'</fieldset>\n')
- w(u'</form>\n')
- return stream.getvalue()
-
- def form_row(self, w, key, splitlabel):
- entity = self.entity_for_key(key)
- eid = entity.eid
- if splitlabel:
- w(u'<td class="label">%s</td>' % self.req._(key.split('.')[-1]))
- else:
- w(u'<td class="label">%s</td>' % self.req._(key))
- wdg = self.vreg.property_value_widget(key, req=self.req)
- error = wdg.render_error(entity)
- w(u'<td class="%s">' % (error and 'error' or ''))
- w(error)
- self.form_row_hiddens(w, entity, key)
- w(wdg.edit_render(entity))
- w(u'</td>\n')
- w(u'<td>%s</td>' % wdg.render_help(entity))
- return entity
-
- def form_row_hiddens(self, w, entity, key):
- eid = entity.eid
- w(u'<input type="hidden" name="eid" value="%s"/>' % eid)
- w(u'<input type="hidden" name="%s" value="EProperty"/>' % eid_param('__type', eid))
- w(u'<input type="hidden" name="%s" value="%s"/>' % (eid_param('pkey', eid), key))
- w(u'<input type="hidden" name="%s" value="%s"/>' % (eid_param('edits-pkey', eid), ''))
-
-
-
-def is_user_prefs(cls, req, rset, row, col):
- return req.user.eid == rset[row or 0 ][col or 0]
-
-class EPropertiesForm(SystemEPropertiesForm):
- id = 'epropertiesform'
- __selectors__ = (
- # we don't want guests to be able to come here
- match_user_groups('users', 'managers'),
- chainfirst(none_rset),
- chainall(one_line_rset, is_user_prefs),
- chainall(one_line_rset, match_user_groups('managers'))
- )
-
- __selectors__ = (implements('EUser',))
-
- title = _('preferences')
-
- @property
- def user(self):
- if self.rset is None:
- return self.req.user
- return self.rset.get_entity(self.row or 0, self.col or 0)
-
- @property
- @cached
- def eprops_rset(self):
- return self.req.execute('Any P,K,V WHERE P is EProperty, P pkey K, P value V,'
- 'P for_user U, U eid %(x)s', {'x': self.user.eid})
-
- def form_row_hiddens(self, w, entity, key):
- super(EPropertiesForm, self).form_row_hiddens(w, entity, key)
- # if user is in the managers group and the property is being created,
- # we have to set for_user explicitly
- if not entity.has_eid() and self.user.matching_groups('managers'):
- eid = entity.eid
- w(u'<input type="hidden" name="%s" value="%s"/>'
- % (eid_param('edits-for_user', eid), INTERNAL_FIELD_VALUE))
- w(u'<input type="hidden" name="%s" value="%s"/>'
- % (eid_param('for_user', eid), self.user.eid))
-
-
-
-
class ProcessInformationView(StartupView):
id = 'info'
__selectors__ = (none_rset, match_user_groups('managers'),)
--- a/web/views/navigation.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/navigation.py Tue Feb 17 21:42:33 2009 +0100
@@ -1,7 +1,7 @@
"""navigation components definition for CubicWeb web client
: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"
@@ -11,9 +11,9 @@
from logilab.mtconverter import html_escape
from cubicweb.interfaces import IPrevNext
-from cubicweb.common.selectors import (paginated_rset, sorted_rset,
- primary_view, match_context_prop,
- one_line_rset, implement_interface)
+from cubicweb.selectors import (paginated_rset, sorted_rset,
+ primary_view, match_context_prop,
+ one_line_rset, implements)
from cubicweb.common.uilib import cut
from cubicweb.web.component import EntityVComponent, NavigationComponent
@@ -181,8 +181,7 @@
title = _('contentnavigation_prevnext')
help = _('contentnavigation_prevnext_description')
__selectors__ = (one_line_rset, primary_view,
- match_context_prop, implement_interface)
- accepts_interfaces = (IPrevNext,)
+ match_context_prop, implements(IPrevNext))
context = 'navbottom'
order = 10
def call(self, view=None):
--- a/web/views/old_calendar.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/old_calendar.py Tue Feb 17 21:42:33 2009 +0100
@@ -1,7 +1,7 @@
"""html calendar views
: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
"""
@@ -11,7 +11,7 @@
from cubicweb.interfaces import ICalendarViews
from cubicweb.common.utils import date_range
-from cubicweb.common.selectors import implement_interface
+from cubicweb.selectors import implements
from cubicweb.common.registerers import priority_registerer
from cubicweb.common.view import EntityView
@@ -33,8 +33,7 @@
class _CalendarView(EntityView):
"""base calendar view containing helpful methods to build calendar views"""
__registerer__ = priority_registerer
- __selectors__ = (implement_interface,)
- accepts_interfaces = (ICalendarViews,)
+ __selectors__ = implements(ICalendarViews)
need_navigation = False
# Navigation building methods / views ####################################
--- a/web/views/tableview.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/tableview.py Tue Feb 17 21:42:33 2009 +0100
@@ -13,11 +13,10 @@
from logilab.mtconverter import html_escape
+from cubicweb.selectors import nonempty_rset, match_form_params, accept_rset
from cubicweb.common.utils import make_uid
from cubicweb.common.uilib import toggle_action, limitsize, jsonize, htmlescape
from cubicweb.common.view import EntityView, AnyRsetView
-from cubicweb.common.selectors import (nonempty_rset, match_form_params,
- accept_rset)
from cubicweb.web.htmlwidgets import (TableWidget, TableColumn, MenuWidget,
PopupBoxMenu, BoxLink)
from cubicweb.web.facet import prepare_facets_rqlst, filter_hiddens
--- a/web/views/tabs.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/tabs.py Tue Feb 17 21:42:33 2009 +0100
@@ -1,7 +1,7 @@
"""base classes to handle tabbed views
:organization: Logilab
-:copyright: 2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2008-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
@@ -11,8 +11,8 @@
from logilab.mtconverter import html_escape
from cubicweb import NoSelectableObject, role
+from cubicweb.selectors import has_related_entities
from cubicweb.common.view import EntityView
-from cubicweb.common.selectors import has_related_entities
from cubicweb.common.utils import HTMLHead
from cubicweb.common.uilib import rql_for_eid
--- a/web/views/timeline.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/timeline.py Tue Feb 17 21:42:33 2009 +0100
@@ -3,7 +3,7 @@
cf. http://code.google.com/p/simile-widgets/
:organization: Logilab
-:copyright: 2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2008-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__docformat__ = "restructuredtext en"
@@ -13,8 +13,8 @@
from logilab.mtconverter import html_escape
from cubicweb.interfaces import ICalendarable
+from cubicweb.selectors import implements
from cubicweb.common.view import EntityView, StartupView
-from cubicweb.common.selectors import implement_interface
#
@@ -28,8 +28,7 @@
templatable = False
content_type = 'application/json'
- __selectors__ = (implement_interface,)
- accepts_interfaces = (ICalendarable,)
+ __selectors__ = implements(ICalendarable)
date_fmt = '%Y/%m/%d'
def call(self):
@@ -103,8 +102,7 @@
class TimelineView(TimelineViewMixIn, EntityView):
"""builds a cubicweb timeline widget node"""
id = 'timeline'
- __selectors__ = (implement_interface,)
- accepts_interfaces = (ICalendarable,)
+ __selectors__ = implements(ICalendarable)
need_navigation = False
def call(self, tlunit=None):
self.req.html_headers.define_var('Timeline_urlPrefix', self.req.datadir_url)
--- a/web/views/timetable.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/timetable.py Tue Feb 17 21:42:33 2009 +0100
@@ -1,15 +1,15 @@
"""html calendar views
: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
"""
from logilab.mtconverter import html_escape
from cubicweb.interfaces import ITimetableViews
+from cubicweb.selectors import implements
from cubicweb.common.utils import date_range
-from cubicweb.common.selectors import implement_interface
from cubicweb.common.view import AnyRsetView
@@ -25,8 +25,7 @@
class TimeTableView(AnyRsetView):
id = 'timetable'
title = _('timetable')
- __selectors__ = (implement_interface,)
- accepts_interfaces = (ITimetableViews,)
+ __selectors__ = implements(ITimetableViews)
need_navigation = False
def call(self, title=None):
--- a/web/views/treeview.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/treeview.py Tue Feb 17 21:42:33 2009 +0100
@@ -1,11 +1,9 @@
from logilab.mtconverter import html_escape
from cubicweb.interfaces import ITree
-from cubicweb.common.selectors import implement_interface, yes
+from cubicweb.selectors import implements
from cubicweb.common.view import EntityView
-from cubicweb.web.views.baseviews import OneLineView
-
class TreeView(EntityView):
id = 'treeview'
itemvid = 'treeitemview'
--- a/web/views/wdoc.py Tue Feb 17 21:42:23 2009 +0100
+++ b/web/views/wdoc.py Tue Feb 17 21:42:33 2009 +0100
@@ -15,7 +15,7 @@
from logilab.common.changelog import ChangeLog
from logilab.mtconverter import CHARSET_DECL_RGX
-from cubicweb.common.selectors import match_form_params
+from cubicweb.selectors import match_form_params
from cubicweb.common.view import StartupView
from cubicweb.common.uilib import rest_publish
from cubicweb.web import NotFound
@@ -85,8 +85,7 @@
# help views ##################################################################
class InlineHelpView(StartupView):
- __selectors__ = (match_form_params,)
- form_params = ('fid',)
+ __selectors__ = match_form_params('fid')
id = 'wdoc'
title = _('site documentation')
@@ -163,9 +162,8 @@
class InlineHelpImageView(StartupView):
- __selectors__ = (match_form_params,)
- form_params = ('fid',)
id = 'wdocimages'
+ __selectors__ = match_form_params('fid')
binary = True
templatable = False
content_type = 'image/png'