--- a/common/selectors.py Thu Jan 15 10:50:45 2009 +0100
+++ b/common/selectors.py Thu Jan 15 17:37:43 2009 +0100
@@ -50,7 +50,6 @@
from cubicweb.cwconfig import CubicWebConfiguration
from cubicweb.schema import split_expression
-
# helpers for debugging selectors
SELECTOR_LOGGER = logging.getLogger('cubicweb.selectors')
TRACED_OIDS = ()
@@ -64,6 +63,7 @@
if TRACED_OIDS == 'all' or cls.id in TRACED_OIDS:
SELECTOR_LOGGER.warning('selector %s returned %s for %s', selector.__name__, ret, cls)
return ret
+ traced.__name__ = selector.__name__
return traced
class traced_selection(object):
@@ -110,12 +110,12 @@
norset_selector = deprecated_function(none_rset)
@lltrace
-def rset(cls, req, rset, *args, **kwargs):
+def any_rset(cls, req, rset, *args, **kwargs):
"""accept result set, whatever the number of result"""
if rset is not None:
return 1
return 0
-rset_selector = deprecated_function(rset)
+rset_selector = deprecated_function(any_rset)
@lltrace
def nonempty_rset(cls, req, rset, *args, **kwargs):
@@ -222,7 +222,7 @@
@lltrace
def authenticated_user(cls, req, *args, **kwargs):
"""accept if user is authenticated"""
- return not anonymous_selector(cls, req, *args, **kwargs)
+ return not anonymous_user(cls, req, *args, **kwargs)
not_anonymous_selector = deprecated_function(authenticated_user)
@lltrace
@@ -529,28 +529,36 @@
# compound selectors ##########################################################
non_final_entity = chainall(nonempty_rset, _non_final_entity)
+non_final_entity.__name__ = 'non_final_entity'
nfentity_selector = deprecated_function(non_final_entity)
implement_interface = chainall(non_final_entity, _implement_interface)
+implement_interface.__name__ = 'implement_interface'
interface_selector = deprecated_function(implement_interface)
accept = chainall(non_final_entity, accept_rset)
+accept.__name__ = 'accept'
accept_selector = deprecated_function(accept)
-accept_one = chainall(one_line_rset, accept_selector)
+accept_one = chainall(one_line_rset, accept)
+accept_one.__name__ = 'accept_one'
accept_one_selector = deprecated_function(accept_one)
rql_condition = chainall(non_final_entity, one_line_rset, _rql_condition)
+rql_condition.__name__ = 'rql_condition'
rqlcondition_selector = deprecated_function(rql_condition)
searchstate_accept = chainall(nonempty_rset, match_search_state, accept)
+searchstate_accept.__name__ = 'searchstate_accept'
searchstate_accept_selector = deprecated_function(searchstate_accept)
searchstate_accept_one = chainall(one_line_rset, match_search_state,
accept, _rql_condition)
+searchstate_accept_one.__name__ = 'searchstate_accept_one'
searchstate_accept_one_selector = deprecated_function(searchstate_accept_one)
searchstate_accept_one_but_etype = chainall(searchstate_accept_one, but_etype)
+searchstate_accept_one_but_etype.__name__ = 'searchstate_accept_one_but_etype'
searchstate_accept_one_but_etype_selector = deprecated_function(
searchstate_accept_one_but_etype)
--- a/cwconfig.py Thu Jan 15 10:50:45 2009 +0100
+++ b/cwconfig.py Thu Jan 15 17:37:43 2009 +0100
@@ -148,6 +148,8 @@
if os.environ.get('APYCOT_ROOT'):
mode = 'test'
CUBES_DIR = '%(APYCOT_ROOT)s/local/share/cubicweb/cubes/' % os.environ
+ # create __init__ file
+ file(join(CUBES_DIR, '__init__.py'), 'w').close()
elif exists(join(CW_SOFTWARE_ROOT, '.hg')):
mode = 'dev'
CUBES_DIR = join(CW_SOFTWARE_ROOT, '../cubes')
--- a/devtools/fill.py Thu Jan 15 10:50:45 2009 +0100
+++ b/devtools/fill.py Thu Jan 15 17:37:43 2009 +0100
@@ -136,6 +136,9 @@
def generate_integer(self, attrname, index):
"""generates a consistent value for 'attrname' if it's an integer"""
+ choosed = self.generate_choice(attrname, index)
+ if choosed is not None:
+ return choosed
minvalue, maxvalue = get_bounds(self.e_schema, attrname)
if maxvalue is not None and maxvalue <= 0 and minvalue is None:
minvalue = maxvalue - index # i.e. randint(-index, 0)
--- a/devtools/testlib.py Thu Jan 15 10:50:45 2009 +0100
+++ b/devtools/testlib.py Thu Jan 15 17:37:43 2009 +0100
@@ -259,10 +259,13 @@
msg+= '\nfor output:\n%s' % output
raise AssertionError, msg, tcbk
-
+
+ def to_test_etypes(self):
+ return unprotected_entities(self.schema, strict=True)
+
def iter_automatic_rsets(self):
"""generates basic resultsets for each entity type"""
- etypes = unprotected_entities(self.schema, strict=True)
+ etypes = self.to_test_etypes()
for etype in etypes:
yield self.execute('Any X WHERE X is %s' % etype)
--- a/goa/appobjects/components.py Thu Jan 15 10:50:45 2009 +0100
+++ b/goa/appobjects/components.py Thu Jan 15 17:37:43 2009 +0100
@@ -15,7 +15,7 @@
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_selector)
+ accept)
from cubicweb.web import Redirect
from cubicweb.web.views import vid_from_rset
from cubicweb.goa.db import rset_from_objs
@@ -31,7 +31,7 @@
"""
id = 'search-associate'
- __selectors__ = (one_line_rset, match_search_state, accept_selector)
+ __selectors__ = (one_line_rset, match_search_state, accept)
accepts = ('Any',)
search_states = ('linksearch',)
--- a/server/msplanner.py Thu Jan 15 10:50:45 2009 +0100
+++ b/server/msplanner.py Thu Jan 15 17:37:43 2009 +0100
@@ -288,17 +288,21 @@
flag = 0
for v in crossvars:
if isinstance(v, Constant):
- self._sourcesvars[ssource][v] = set(self._solindices)
+ allsols = set(self._solindices)
+ try:
+ self._sourcesvars[ssource][v] = allsols
+ except KeyError:
+ self._sourcesvars[ssource] = {v: allsols}
if len(vsources[v]) == 1:
if iter(vsources[v]).next()[0].uri == 'system':
flag = 1
for ov in crossvars:
- if ov is not v and ov._q_invariant:
+ if ov is not v and (isinstance(ov, Constant) or ov._q_invariant):
ssset = frozenset((ssource,))
self._remove_sources(ov, vsources[ov] - ssset)
else:
for ov in crossvars:
- if ov is not v and ov._q_invariant:
+ if ov is not v and (isinstance(ov, Constant) or ov._q_invariant):
needsplit = False
break
else:
@@ -661,7 +665,7 @@
if not var.scope is self.rqlst:
if isinstance(var, Variable):
return var, sourcevars.pop(var)
- secondchoice = var, sourcevars.pop(var)
+ secondchoice = var
else:
# priority to variable outer scope
for var in sourcevars:
--- a/web/box.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/box.py Thu Jan 15 17:37:43 2009 +0100
@@ -14,8 +14,8 @@
accepts_registerer, extresources_registerer,
etype_rtype_priority_registerer)
from cubicweb.common.selectors import (
- etype_rtype_selector, one_line_rset, accept_selector, accept_rtype_selector,
- primaryview_selector, contextprop_selector, has_related_entities,
+ etype_rtype_selector, one_line_rset, accept, accept_rtype_selector,
+ primary_view, match_context_prop, has_related_entities,
_rqlcondition_selector)
from cubicweb.common.view import Template
from cubicweb.common.appobject import ReloadableMixIn
@@ -42,7 +42,7 @@
box.render(self.w)
"""
__registry__ = 'boxes'
- __selectors__ = Template.__selectors__ + (contextprop_selector,)
+ __selectors__ = Template.__selectors__ + (match_context_prop,)
categories_in_order = ()
property_defs = {
@@ -150,9 +150,9 @@
class EntityBoxTemplate(BoxTemplate):
"""base class for boxes related to a single entity"""
__registerer__ = accepts_registerer
- __selectors__ = (one_line_rset, primaryview_selector,
- contextprop_selector, etype_rtype_selector,
- accept_rtype_selector, accept_selector,
+ __selectors__ = (one_line_rset, primary_view,
+ match_context_prop, etype_rtype_selector,
+ accept_rtype_selector, accept,
_rqlcondition_selector)
accepts = ('Any',)
context = 'incontext'
--- a/web/controller.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/controller.py Thu Jan 15 17:37:43 2009 +0100
@@ -11,7 +11,7 @@
from cubicweb import typed_eid
from cubicweb.common.registerers import priority_registerer
-from cubicweb.common.selectors import in_group_selector
+from cubicweb.common.selectors import match_user_group
from cubicweb.common.appobject import AppObject
from cubicweb.web import LOGGER, Redirect, RequestError
@@ -68,7 +68,7 @@
"""
__registry__ = 'controllers'
__registerer__ = priority_registerer
- __selectors__ = (in_group_selector,)
+ __selectors__ = (match_user_group,)
require_groups = ()
def __init__(self, *args, **kwargs):
--- a/web/data/cubicweb.formfilter.js Thu Jan 15 10:50:45 2009 +0100
+++ b/web/data/cubicweb.formfilter.js Thu Jan 15 17:37:43 2009 +0100
@@ -109,10 +109,9 @@
root = root || document;
jQuery(root).find('form').each(function () {
var form = jQuery(this);
- var facetargs = form.attr('cubicweb:facetargs');
- if (facetargs) {
+ var facetargs = evalJSON(form.attr('cubicweb:facetargs'));
+ if (facetargs !== undefined && facetargs.length) {
form.submit(function() {
- var facetargs = evalJSON(form.attr('cubicweb:facetargs'));
buildRQL.apply(null, facetargs); //(divid, vid, paginate, extraargs);
return false;
});
@@ -122,7 +121,6 @@
this.setAttribute('cubicweb:idx', i);
});
facet.find('div.facetCheckBox').click(function () {
- var facetargs = evalJSON(form.attr('cubicweb:facetargs'));
var $this = jQuery(this);
if ($this.hasClass('facetValueSelected')) {
$this.removeClass('facetValueSelected');
--- a/web/form.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/form.py Thu Jan 15 17:37:43 2009 +0100
@@ -11,7 +11,7 @@
from logilab.mtconverter import html_escape
from cubicweb import typed_eid
-from cubicweb.common.selectors import req_form_params_selector
+from cubicweb.common.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
@@ -239,7 +239,7 @@
should list necessary parameters in the form to be accepted.
"""
__registerer__ = accepts_registerer
- __select__ = classmethod(req_form_params_selector)
+ __select__ = classmethod(match_form_params)
form_params = ()
--- a/web/test/unittest_viewselector.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/test/unittest_viewselector.py Thu Jan 15 17:37:43 2009 +0100
@@ -10,7 +10,7 @@
from cubicweb import CW_SOFTWARE_ROOT as BASE, Binary
-from cubicweb.common.selectors import in_group_selector
+from cubicweb.common.selectors import match_user_group
from cubicweb.web._exceptions import NoSelectableObject
from cubicweb.web.action import Action
@@ -387,12 +387,12 @@
- def test_owners_in_group_selector(self):
- """tests usage of 'owners' group with in_group_selector"""
+ def test_owners_match_user_group(self):
+ """tests usage of 'owners' group with match_user_group"""
class SomeAction(Action):
id = 'yo'
category = 'foo'
- __selectors__ = (in_group_selector,)
+ __selectors__ = (match_user_group,)
require_groups = ('owners', )
self.vreg.register_vobject_class(SomeAction)
self.failUnless(SomeAction in self.vreg['actions']['yo'], self.vreg['actions'])
--- a/web/views/actions.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/actions.py Thu Jan 15 17:37:43 2009 +0100
@@ -55,7 +55,7 @@
class ViewAction(Action):
category = 'mainactions'
- __selectors__ = (in_group_selector, searchstate_accept)
+ __selectors__ = (match_user_group, searchstate_accept)
require_groups = ('users', 'managers')
order = 0
@@ -110,7 +110,7 @@
class MultipleEditAction(EntityAction):
category = 'mainactions'
- __selectors__ = (two_lines_rset, oneetyperset_selector,
+ __selectors__ = (two_lines_rset, one_etype_rset,
searchstate_accept)
schema_action = 'update'
order = 10
@@ -198,7 +198,7 @@
return 0
__selectors__ = (match_search_state,
chainfirst(etype_rset_selector,
- chainall(two_lines_rset, oneetyperset_selector,
+ chainall(two_lines_rset, one_etype_rset,
has_add_perm_selector)))
@property
@@ -219,7 +219,7 @@
class UserPreferencesAction(Action):
category = 'useractions'
- __selectors__ = not_anonymous_selector,
+ __selectors__ = authenticated_user,
order = 10
id = 'myprefs'
@@ -231,7 +231,7 @@
class UserInfoAction(Action):
category = 'useractions'
- __selectors__ = not_anonymous_selector,
+ __selectors__ = authenticated_user,
order = 20
id = 'myinfos'
@@ -243,7 +243,7 @@
class LogoutAction(Action):
category = 'useractions'
- __selectors__ = not_anonymous_selector,
+ __selectors__ = authenticated_user,
order = 30
id = 'logout'
@@ -258,7 +258,7 @@
class ManagersAction(Action):
category = 'siteactions'
__abstract__ = True
- __selectors__ = in_group_selector,
+ __selectors__ = match_user_group,
require_groups = ('managers',)
def url(self):
@@ -301,7 +301,7 @@
return self.rset.get_entity(self.row or 0, self.col or 0).actual_url()
class UserPreferencesEntityAction(EntityAction):
- __selectors__ = EntityAction.__selectors__ + (one_line_rset, in_group_selector,)
+ __selectors__ = EntityAction.__selectors__ + (one_line_rset, match_user_group,)
require_groups = ('owners', 'managers')
category = 'mainactions'
accepts = ('EUser',)
--- a/web/views/ajaxedit.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/ajaxedit.py Thu Jan 15 17:37:43 2009 +0100
@@ -6,8 +6,8 @@
"""
__docformat__ = "restructuredtext en"
-from cubicweb.common.selectors import (chainfirst, req_form_params_selector,
- kwargs_selector)
+from cubicweb.common.selectors import (chainfirst, match_form_params,
+ match_kwargs)
from cubicweb.web.box import EditRelationBoxTemplate
class AddRelationView(EditRelationBoxTemplate):
@@ -18,7 +18,7 @@
class attributes.
"""
__registry__ = 'views'
- __selectors__ = (chainfirst(req_form_params_selector, kwargs_selector),)
+ __selectors__ = (chainfirst(match_form_params, match_kwargs),)
property_defs = {} # don't want to inherit this from Box
id = 'xaddrelation'
expected_kwargs = form_params = ('rtype', 'target')
--- a/web/views/basecomponents.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/basecomponents.py Thu Jan 15 17:37:43 2009 +0100
@@ -14,10 +14,10 @@
from cubicweb import Unauthorized
from cubicweb.common.uilib import html_escape, toggle_action
-from cubicweb.common.selectors import yes, nfentity_selector, one_line_rset
+from cubicweb.common.selectors import yes, non_final_entity, one_line_rset
from cubicweb.schema import display_name
-from cubicweb.common.selectors import (chainfirst, multitype_selector,
- req_form_params_selector)
+from cubicweb.common.selectors import (chainfirst, two_etypes_rset,
+ match_form_params)
from cubicweb.web.htmlwidgets import MenuWidget, PopupBoxMenu, BoxSeparator, BoxLink
from cubicweb.web.component import (VComponent, SingletonVComponent, EntityVComponent,
@@ -191,7 +191,7 @@
to be able to filter accordingly.
"""
id = 'etypenavigation'
- __select__ = classmethod(chainfirst(multitype_selector, req_form_params_selector))
+ __select__ = classmethod(chainfirst(two_etypes_rset, match_form_params))
form_params = ('__restrtype', '__restrtypes', '__restrrql')
visible = False # disabled by default
@@ -238,14 +238,14 @@
class RSSFeedURL(VComponent):
id = 'rss_feed_url'
- __selectors__ = (nfentity_selector,)
+ __selectors__ = (non_final_entity,)
def feed_url(self):
return self.build_url(rql=self.limited_rql(), vid='rss')
class RSSEntityFeedURL(VComponent):
id = 'rss_feed_url'
- __selectors__ = (nfentity_selector, one_line_rset)
+ __selectors__ = (non_final_entity, one_line_rset)
def feed_url(self):
return self.entity(0, 0).rss_feed_url()
--- a/web/views/baseforms.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/baseforms.py Thu Jan 15 17:37:43 2009 +0100
@@ -17,9 +17,9 @@
from cubicweb.interfaces import IWorkflowable
from cubicweb.common.utils import make_uid
from cubicweb.common.uilib import cut
-from cubicweb.common.selectors import (etype_form_selector, kwargs_selector,
- one_line_rset, interface_selector,
- req_form_params_selector, accept_selector)
+from cubicweb.common.selectors import (accept_etype, match_kwargs,
+ one_line_rset, implement_interface,
+ match_form_params, accept)
from cubicweb.common.view import EntityView
from cubicweb.web import INTERNAL_FIELD_VALUE, stdmsgs, eid_param
from cubicweb.web.controller import NAV_FORM_PARAMETERS
@@ -87,7 +87,7 @@
id = 'statuschange'
title = _('status change')
- __selectors__ = (interface_selector, req_form_params_selector)
+ __selectors__ = (implement_interface, match_form_params)
accepts_interfaces = (IWorkflowable,)
form_params = ('treid',)
@@ -150,7 +150,7 @@
class ClickAndEditForm(EntityForm):
id = 'reledit'
- __selectors__ = (kwargs_selector, )
+ __selectors__ = (match_kwargs, )
expected_kwargs = ('rtype',)
#FIXME editableField class could be toggleable from userprefs
@@ -216,7 +216,7 @@
dynamic default values such as the 'tomorrow' date or the user's login
being connected
"""
- __selectors__ = (one_line_rset, accept_selector)
+ __selectors__ = (one_line_rset, accept)
id = 'edition'
title = _('edition')
@@ -517,7 +517,7 @@
class CreationForm(EditionForm):
- __selectors__ = (etype_form_selector, )
+ __selectors__ = (accept_etype, )
id = 'creation'
title = _('creation')
@@ -630,7 +630,7 @@
class InlineEntityCreationForm(InlineFormMixIn, CreationForm):
id = 'inline-creation'
- __selectors__ = (kwargs_selector, etype_form_selector)
+ __selectors__ = (match_kwargs, accept_etype)
expected_kwargs = ('ptype', 'peid', 'rtype')
EDITION_BODY = u'''\
@@ -669,7 +669,7 @@
class InlineEntityEditionForm(InlineFormMixIn, EditionForm):
id = 'inline-edition'
- __selectors__ = (accept_selector, kwargs_selector)
+ __selectors__ = (accept, match_kwargs)
expected_kwargs = ('ptype', 'peid', 'rtype')
EDITION_BODY = u'''\
@@ -872,7 +872,7 @@
class UnrelatedDivs(EntityView):
id = 'unrelateddivs'
- __selectors__ = (req_form_params_selector,)
+ __selectors__ = (match_form_params,)
form_params = ('relation',)
@property
--- a/web/views/basetemplates.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/basetemplates.py Thu Jan 15 17:37:43 2009 +0100
@@ -194,7 +194,7 @@
w(u'<div id="pageContent">\n')
vtitle = self.req.form.get('vtitle')
if vtitle:
- w(u'<h1 class="vtitle">%s</h1>\n' % vtitle)
+ w(u'<h1 class="vtitle">%s</h1>\n' % html_escape(vtitle))
def template_footer(self, view=None):
self.w(u'</div>\n') # close id=contentmain
@@ -288,7 +288,7 @@
w(u'<div id="pageContent">\n')
vtitle = self.req.form.get('vtitle')
if vtitle:
- w(u'<h1 class="vtitle">%s</h1>' % (vtitle))
+ w(u'<h1 class="vtitle">%s</h1>' % html_escape(vtitle))
def topleft_header(self):
self.w(u'<table id="header"><tr>\n')
--- a/web/views/baseviews.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/baseviews.py Thu Jan 15 17:37:43 2009 +0100
@@ -21,9 +21,9 @@
from logilab.mtconverter import html_escape, TransformError
from cubicweb import Unauthorized, NoSelectableObject, typed_eid
-from cubicweb.common.selectors import (yes, nonempty_rset, accept_selector,
+from cubicweb.common.selectors import (yes, nonempty_rset, accept,
one_line_rset, match_search_state,
- req_form_params_selector, accept_rset_selector)
+ match_form_params, accept_rset)
from cubicweb.common.uilib import (cut, printable_value, UnicodeCSVWriter,
ajax_replace_url, rql_for_eid)
from cubicweb.common.view import EntityView, AnyRsetView, EmptyRsetView
@@ -785,7 +785,7 @@
"""
id = 'search-associate'
title = _('search for association')
- __selectors__ = (one_line_rset, match_search_state, accept_selector)
+ __selectors__ = (one_line_rset, match_search_state, accept)
accepts = ('Any',)
search_states = ('linksearch',)
@@ -842,7 +842,7 @@
"""
id = 'editrelation'
- __selectors__ = (req_form_params_selector,)
+ __selectors__ = (match_form_params,)
form_params = ('rtype',)
# TODO: inlineview, multiple edit, (widget view ?)
--- a/web/views/boxes.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/boxes.py Thu Jan 15 17:37:43 2009 +0100
@@ -17,7 +17,7 @@
from logilab.mtconverter import html_escape
-from cubicweb.common.selectors import (rset_selector, 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
@@ -29,7 +29,7 @@
box with all actions impacting the entity displayed: edit, copy, delete
change state, add related entities
"""
- __selectors__ = (rset_selector,) + BoxTemplate.__selectors__
+ __selectors__ = (any_rset,) + BoxTemplate.__selectors__
id = 'edit_box'
title = _('actions')
order = 2
--- a/web/views/calendar.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/calendar.py Thu Jan 15 17:37:43 2009 +0100
@@ -15,7 +15,7 @@
from cubicweb.interfaces import ICalendarable
from cubicweb.common.utils import date_range
from cubicweb.common.uilib import ajax_replace_url
-from cubicweb.common.selectors import interface_selector
+from cubicweb.common.selectors import implement_interface
from cubicweb.common.registerers import priority_registerer
from cubicweb.common.view import EntityView
@@ -83,7 +83,7 @@
Does apply to ICalendarable compatible entities
"""
__registerer__ = priority_registerer
- __selectors__ = (interface_selector,)
+ __selectors__ = (implement_interface,)
accepts_interfaces = (ICalendarable,)
need_navigation = False
content_type = 'text/calendar'
@@ -114,7 +114,7 @@
Does apply to ICalendarable compatible entities
"""
__registerer__ = priority_registerer
- __selectors__ = (interface_selector,)
+ __selectors__ = (implement_interface,)
accepts_interfaces = (ICalendarable,)
need_navigation = False
title = _('hCalendar')
@@ -146,7 +146,7 @@
class OneMonthCal(EntityView):
"""At some point, this view will probably replace ampm calendars"""
__registerer__ = priority_registerer
- __selectors__ = (interface_selector, )
+ __selectors__ = (implement_interface, )
accepts_interfaces = (ICalendarable,)
need_navigation = False
id = 'onemonthcal'
@@ -331,7 +331,7 @@
class OneWeekCal(EntityView):
"""At some point, this view will probably replace ampm calendars"""
__registerer__ = priority_registerer
- __selectors__ = (interface_selector, )
+ __selectors__ = (implement_interface, )
accepts_interfaces = (ICalendarable,)
need_navigation = False
id = 'oneweekcal'
--- a/web/views/embedding.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/embedding.py Thu Jan 15 17:37:43 2009 +0100
@@ -18,7 +18,7 @@
from cubicweb.interfaces import IEmbedable
from cubicweb.common.uilib import soup2xhtml
from cubicweb.common.selectors import (one_line_rset, score_entity_selector,
- match_search_state, interface_selector)
+ match_search_state, implement_interface)
from cubicweb.common.view import NOINDEX, NOFOLLOW
from cubicweb.web.controller import Controller
from cubicweb.web.action import Action
@@ -82,7 +82,7 @@
id = 'embed'
controller = 'embed'
__selectors__ = (one_line_rset, match_search_state,
- interface_selector, score_entity_selector)
+ implement_interface, score_entity_selector)
accepts_interfaces = (IEmbedable,)
title = _('embed')
--- a/web/views/facets.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/facets.py Thu Jan 15 17:37:43 2009 +0100
@@ -10,9 +10,9 @@
from logilab.mtconverter import html_escape
-from cubicweb.common.selectors import (chainfirst, chainall, nfentity_selector,
- two_lines_rset, contextprop_selector,
- yes, one_has_relation_selector)
+from cubicweb.common.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)
@@ -28,8 +28,8 @@
"""filter results of a query"""
id = 'filter_box'
__selectors__ = (chainfirst(contextview_selector,
- chainall(nfentity_selector, two_lines_rset)),
- contextprop_selector)
+ chainall(non_final_entity, two_lines_rset)),
+ match_context_prop)
context = 'left'
title = _('boxes_filter_box')
visible = True # functionality provided by the search box by default
@@ -153,7 +153,7 @@
class HasTextFacet(AbstractFacet):
- __selectors__ = (one_has_relation_selector, contextprop_selector)
+ __selectors__ = (one_has_relation, match_context_prop)
id = 'has_text-facet'
rtype = 'has_text'
role = 'subject'
--- a/web/views/ibreadcrumbs.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/ibreadcrumbs.py Thu Jan 15 17:37:43 2009 +0100
@@ -9,8 +9,8 @@
from logilab.mtconverter import html_escape
from cubicweb.interfaces import IBreadCrumbs
-from cubicweb.common.selectors import (contextprop_selector, one_line_rset,
- interface_selector)
+from cubicweb.common.selectors import (match_context_prop, one_line_rset,
+ implement_interface)
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,7 +29,7 @@
# register msg not generated since no entity implements IPrevNext in cubicweb itself
title = _('contentnavigation_breadcrumbs')
help = _('contentnavigation_breadcrumbs_description')
- __selectors__ = (one_line_rset, contextprop_selector, interface_selector)
+ __selectors__ = (one_line_rset, match_context_prop, implement_interface)
accepts_interfaces = (IBreadCrumbs,)
context = 'navtop'
order = 5
@@ -73,7 +73,7 @@
class BreadCrumbComponent(BreadCrumbEntityVComponent):
__registry__ = 'components'
- __selectors__ = (one_line_rset, interface_selector)
+ __selectors__ = (one_line_rset, implement_interface)
visible = True
--- a/web/views/idownloadable.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/idownloadable.py Thu Jan 15 17:37:43 2009 +0100
@@ -11,7 +11,7 @@
from cubicweb.interfaces import IDownloadable
from cubicweb.common.mttransforms import ENGINE
from cubicweb.common.selectors import (one_line_rset, score_entity_selector,
- interface_selector, contextprop_selector)
+ implement_interface, match_context_prop)
from cubicweb.web.box import EntityBoxTemplate
from cubicweb.web.views import baseviews
@@ -35,7 +35,7 @@
class DownloadBox(EntityBoxTemplate):
id = 'download_box'
- __selectors__ = (one_line_rset, interface_selector, contextprop_selector)
+ __selectors__ = (one_line_rset, implement_interface, match_context_prop)
accepts_interfaces = (IDownloadable,)
order = 10
def cell_call(self, row, col, title=None, label=None, **kwargs):
@@ -48,7 +48,7 @@
of entities providing the necessary interface
"""
id = 'download'
- __selectors__ = (one_line_rset, interface_selector)
+ __selectors__ = (one_line_rset, implement_interface)
accepts_interfaces = (IDownloadable,)
templatable = False
@@ -77,7 +77,7 @@
"""view displaying a link to download the file"""
id = 'downloadlink'
title = None # should not be listed in possible views
- __selectors__ = (interface_selector,)
+ __selectors__ = (implement_interface,)
accepts_interfaces = (IDownloadable,)
@@ -89,7 +89,7 @@
class IDownloadablePrimaryView(baseviews.PrimaryView):
- __selectors__ = (interface_selector,)
+ __selectors__ = (implement_interface,)
#skip_attrs = ('eid', 'data',) # XXX
accepts_interfaces = (IDownloadable,)
@@ -122,7 +122,7 @@
class IDownloadableLineView(baseviews.OneLineView):
- __selectors__ = (interface_selector,)
+ __selectors__ = (implement_interface,)
# don't kick default oneline view
accepts_interfaces = (IDownloadable,)
@@ -138,7 +138,7 @@
class ImageView(baseviews.EntityView):
- __selectors__ = (interface_selector, score_entity_selector)
+ __selectors__ = (implement_interface, score_entity_selector)
id = 'image'
title = _('image')
accepts_interfaces = (IDownloadable,)
--- a/web/views/igeocodable.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/igeocodable.py Thu Jan 15 17:37:43 2009 +0100
@@ -4,7 +4,7 @@
from cubicweb.interfaces import IGeocodable
from cubicweb.common.view import EntityView
-from cubicweb.common.selectors import interface_selector
+from cubicweb.common.selectors import implement_interface
class GeocodingJsonView(EntityView):
id = 'geocoding-json'
@@ -12,7 +12,7 @@
templatable = False
content_type = 'application/json'
- __selectors__ = (interface_selector,)
+ __selectors__ = (implement_interface,)
accepts_interfaces = (IGeocodable,)
def call(self):
@@ -44,7 +44,7 @@
class GoogleMapBubbleView(EntityView):
id = 'gmap-bubble'
- __selectors__ = (interface_selector,)
+ __selectors__ = (implement_interface,)
accepts_interfaces = (IGeocodable,)
def cell_call(self, row, col):
@@ -56,7 +56,7 @@
class GoogleMapsView(EntityView):
id = 'gmap-view'
- __selectors__ = (interface_selector,)
+ __selectors__ = (implement_interface,)
accepts_interfaces = (IGeocodable,)
need_navigation = False
--- a/web/views/iprogress.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/iprogress.py Thu Jan 15 17:37:43 2009 +0100
@@ -12,7 +12,7 @@
from cubicweb.interfaces import IProgress, IMileStone
from cubicweb.schema import display_name
from cubicweb.common.view import EntityView
-from cubicweb.common.selectors import interface_selector, accept_selector
+from cubicweb.common.selectors import implement_interface, accept
from cubicweb.web.htmlwidgets import ProgressBarWidget
@@ -35,7 +35,7 @@
id = 'progress_table_view'
title = _('task progression')
- __selectors__ = (accept_selector, interface_selector)
+ __selectors__ = (accept, implement_interface)
accepts_interfaces = (IMileStone,)
@@ -182,7 +182,7 @@
"""displays a progress bar"""
id = 'progressbar'
title = _('progress bar')
- __selectors__ = (accept_selector, interface_selector)
+ __selectors__ = (accept, implement_interface)
accepts_interfaces = (IProgress,)
--- a/web/views/management.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/management.py Thu Jan 15 17:37:43 2009 +0100
@@ -16,7 +16,7 @@
from cubicweb.common.uilib import (html_traceback, rest_traceback, html_escape,
toggle_link)
from cubicweb.common.selectors import (yes, one_line_rset,
- accept_rset_selector, none_rset,
+ accept_rset, none_rset,
chainfirst, chainall)
from cubicweb.web import INTERNAL_FIELD_VALUE, eid_param, stdmsgs
from cubicweb.web.widgets import StaticComboBoxWidget
@@ -440,7 +440,7 @@
title = _('preferences')
require_groups = ('users', 'managers') # we don't want guests to be able to come here
__selectors__ = chainfirst(none_rset,
- chainall(one_line_rset, accept_rset_selector)),
+ chainall(one_line_rset, accept_rset)),
accepts = ('EUser',)
@classmethod
--- a/web/views/massmailing.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/massmailing.py Thu Jan 15 17:37:43 2009 +0100
@@ -11,14 +11,14 @@
from cubicweb.interfaces import IEmailable
from cubicweb.common.view import EntityView
-from cubicweb.common.selectors import interface_selector, in_group_selector
+from cubicweb.common.selectors import implement_interface, match_user_group
from cubicweb.web.action import EntityAction
from cubicweb.web import stdmsgs
class SendEmailAction(EntityAction):
category = 'mainactions'
- __selectors__ = (interface_selector, in_group_selector)
+ __selectors__ = (implement_interface, match_user_group)
accepts_interfaces = (IEmailable,) # XXX should check email is set as well
require_groups = ('managers', 'users')
@@ -35,7 +35,7 @@
class MassMailingForm(EntityView):
id = 'massmailing'
- __selectors__ = (interface_selector, in_group_selector)
+ __selectors__ = (implement_interface, match_user_group)
accepts_interfaces = (IEmailable,)
require_groups = ('managers', 'users')
--- a/web/views/navigation.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/navigation.py Thu Jan 15 17:37:43 2009 +0100
@@ -12,8 +12,8 @@
from cubicweb.interfaces import IPrevNext
from cubicweb.common.selectors import (paginated_rset, sortedrset_selector,
- primaryview_selector, contextprop_selector,
- one_line_rset, interface_selector)
+ primary_view, match_context_prop,
+ one_line_rset, implement_interface)
from cubicweb.common.uilib import cut
from cubicweb.web.component import EntityVComponent, NavigationComponent
@@ -176,8 +176,8 @@
# itself
title = _('contentnavigation_prevnext')
help = _('contentnavigation_prevnext_description')
- __selectors__ = (one_line_rset, primaryview_selector,
- contextprop_selector, interface_selector)
+ __selectors__ = (one_line_rset, primary_view,
+ match_context_prop, implement_interface)
accepts_interfaces = (IPrevNext,)
context = 'navbottom'
order = 10
--- a/web/views/old_calendar.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/old_calendar.py Thu Jan 15 17:37:43 2009 +0100
@@ -11,7 +11,7 @@
from cubicweb.interfaces import ICalendarViews
from cubicweb.common.utils import date_range
-from cubicweb.common.selectors import interface_selector
+from cubicweb.common.selectors import implement_interface
from cubicweb.common.registerers import priority_registerer
from cubicweb.common.view import EntityView
@@ -33,7 +33,7 @@
class _CalendarView(EntityView):
"""base calendar view containing helpful methods to build calendar views"""
__registerer__ = priority_registerer
- __selectors__ = (interface_selector,)
+ __selectors__ = (implement_interface,)
accepts_interfaces = (ICalendarViews,)
need_navigation = False
--- a/web/views/tableview.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/tableview.py Thu Jan 15 17:37:43 2009 +0100
@@ -14,8 +14,8 @@
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, req_form_params_selector,
- accept_rset_selector)
+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
@@ -249,7 +249,7 @@
class CellView(EntityView):
- __selectors__ = (nonempty_rset, accept_rset_selector)
+ __selectors__ = (nonempty_rset, accept_rset)
id = 'cell'
accepts = ('Any',)
@@ -285,7 +285,7 @@
displayed with default restrictions set
"""
id = 'initialtable'
- __selectors__ = nonempty_rset, req_form_params_selector
+ __selectors__ = nonempty_rset, match_form_params
form_params = ('actualrql',)
# should not be displayed in possible view since it expects some specific
# parameters
--- a/web/views/timeline.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/timeline.py Thu Jan 15 17:37:43 2009 +0100
@@ -14,7 +14,7 @@
from cubicweb.interfaces import ICalendarable
from cubicweb.common.view import EntityView, StartupView
-from cubicweb.common.selectors import interface_selector
+from cubicweb.common.selectors import implement_interface
#
@@ -28,7 +28,7 @@
templatable = False
content_type = 'application/json'
- __selectors__ = (interface_selector,)
+ __selectors__ = (implement_interface,)
accepts_interfaces = (ICalendarable,)
date_fmt = '%Y/%m/%d'
@@ -103,7 +103,7 @@
class TimelineView(TimelineViewMixIn, EntityView):
"""builds a cubicweb timeline widget node"""
id = 'timeline'
- __selectors__ = (interface_selector,)
+ __selectors__ = (implement_interface,)
accepts_interfaces = (ICalendarable,)
need_navigation = False
def call(self, tlunit=None):
--- a/web/views/timetable.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/timetable.py Thu Jan 15 17:37:43 2009 +0100
@@ -9,7 +9,7 @@
from cubicweb.interfaces import ITimetableViews
from cubicweb.common.utils import date_range
-from cubicweb.common.selectors import interface_selector
+from cubicweb.common.selectors import implement_interface
from cubicweb.common.view import AnyRsetView
@@ -25,7 +25,7 @@
class TimeTableView(AnyRsetView):
id = 'timetable'
title = _('timetable')
- __selectors__ = (interface_selector,)
+ __selectors__ = (implement_interface,)
accepts_interfaces = (ITimetableViews,)
need_navigation = False
--- a/web/views/treeview.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/treeview.py Thu Jan 15 17:37:43 2009 +0100
@@ -1,7 +1,7 @@
from logilab.mtconverter import html_escape
from cubicweb.interfaces import ITree
-from cubicweb.common.selectors import interface_selector, yes
+from cubicweb.common.selectors import implement_interface, yes
from cubicweb.common.view import EntityView
from cubicweb.web.views.baseviews import OneLineView
@@ -87,7 +87,7 @@
id = 'treeitemview'
# XXX append yes to make sure we get an higher score than
# the default treeitem view
- __selectors__ = (interface_selector, yes)
+ __selectors__ = (implement_interface, yes)
accepts_interfaces = (ITree,)
def cell_call(self, row, col, vid='oneline', parentvid='treeview'):
--- a/web/views/wdoc.py Thu Jan 15 10:50:45 2009 +0100
+++ b/web/views/wdoc.py Thu Jan 15 17:37:43 2009 +0100
@@ -15,7 +15,7 @@
from logilab.common.changelog import ChangeLog
from logilab.mtconverter import CHARSET_DECL_RGX
-from cubicweb.common.selectors import req_form_params_selector
+from cubicweb.common.selectors import match_form_params
from cubicweb.common.view import StartupView
from cubicweb.common.uilib import rest_publish
from cubicweb.web import NotFound
@@ -85,7 +85,7 @@
# help views ##################################################################
class InlineHelpView(StartupView):
- __selectors__ = (req_form_params_selector,)
+ __selectors__ = (match_form_params,)
form_params = ('fid',)
id = 'wdoc'
title = _('site documentation')
@@ -163,7 +163,7 @@
class InlineHelpImageView(StartupView):
- __selectors__ = (req_form_params_selector,)
+ __selectors__ = (match_form_params,)
form_params = ('fid',)
id = 'wdocimages'
binary = True