# HG changeset patch # User Adrien Di Mascio # Date 1234910843 -3600 # Node ID a95b284150d1f07f3cb2d91476f82c36b93e119d # Parent 30fe8f5afbd8905e5b26e65501479a6c6144d206 first pass to use __select__ instead of __selectors__ diff -r 30fe8f5afbd8 -r a95b284150d1 common/mixins.py --- a/common/mixins.py Tue Feb 17 23:46:48 2009 +0100 +++ b/common/mixins.py Tue Feb 17 23:47:23 2009 +0100 @@ -315,7 +315,7 @@ """a recursive tree view""" id = 'tree' item_vid = 'treeitem' - __selectors__ = implements(ITree) + __select__ = implements(ITree) def call(self, done=None, **kwargs): if done is None: diff -r 30fe8f5afbd8 -r a95b284150d1 web/test/unittest_viewselector.py --- a/web/test/unittest_viewselector.py Tue Feb 17 23:46:48 2009 +0100 +++ b/web/test/unittest_viewselector.py Tue Feb 17 23:47:23 2009 +0100 @@ -253,7 +253,7 @@ del req.form['etype'] # custom creation form class EUserCreationForm(baseforms.CreationForm): - __selectors__ = implements('EUSer') + __select__ = implements('EUSer') self.vreg.register_vobject_class(EUserCreationForm) req.form['etype'] = 'EUser' self.assertIsInstance(self.vreg.select_view('creation', req, rset), @@ -411,7 +411,7 @@ class SomeAction(Action): id = 'yo' category = 'foo' - __selectors__ = (match_user_groups('owners'),) + __select__ = match_user_groups('owners'), self.vreg.register_vobject_class(SomeAction) self.failUnless(SomeAction in self.vreg['actions']['yo'], self.vreg['actions']) try: @@ -438,7 +438,7 @@ class EETypeRQLAction(EntityAction): id = 'testaction' - __selectors__ = implements('EEType') & rql_condition('X name "EEType"') + __select__ = implements('EEType') & rql_condition('X name "EEType"') title = 'bla' class RQLActionTC(ViewSelectorTC): diff -r 30fe8f5afbd8 -r a95b284150d1 web/views/actions.py --- a/web/views/actions.py Tue Feb 17 23:46:48 2009 +0100 +++ b/web/views/actions.py Tue Feb 17 23:47:23 2009 +0100 @@ -6,6 +6,7 @@ """ __docformat__ = "restructuredtext en" +from cubicweb.vregistry import objectify_selector from cubicweb.selectors import ( yes, one_line_rset, two_lines_rset, one_etype_rset, relation_possible, non_final_entity, @@ -19,9 +20,11 @@ _ = unicode +@objectify_selector def match_searched_etype(cls, req, rset, row=None, col=None, **kwargs): return req.match_search_state(rset) +@objectify_selector def view_is_not_default_view(cls, req, rset, row, col, **kwargs): # interesting if it propose another view than the current one vid = req.form.get('vid') @@ -29,6 +32,7 @@ return 1 return 0 +@objectify_selector def addable_etype_empty_rset(cls, req, rset, **kwargs): if rset is not None and not rset.rowcount: rqlst = rset.syntax_tree() @@ -180,7 +184,7 @@ id = 'addentity' __select__ = (match_search_state('normal') & (addable_etype_empty_rset() - | (two_lines_rset() & one_etype_rset & & has_add_permission())) + | (two_lines_rset() & one_etype_rset & has_add_permission())) ) category = 'moreactions' diff -r 30fe8f5afbd8 -r a95b284150d1 web/views/calendar.py --- a/web/views/calendar.py Tue Feb 17 23:46:48 2009 +0100 +++ b/web/views/calendar.py Tue Feb 17 23:47:23 2009 +0100 @@ -83,7 +83,7 @@ Does apply to ICalendarable compatible entities """ __registerer__ = priority_registerer - __selectors__ = implements(ICalendarable) + __select__ = implements(ICalendarable) need_navigation = False content_type = 'text/calendar' title = _('iCalendar') @@ -113,7 +113,7 @@ Does apply to ICalendarable compatible entities """ __registerer__ = priority_registerer - __selectors__ = implements(ICalendarable) + __select__ = implements(ICalendarable) need_navigation = False title = _('hCalendar') #templatable = False @@ -144,7 +144,7 @@ class OneMonthCal(EntityView): """At some point, this view will probably replace ampm calendars""" __registerer__ = priority_registerer - __selectors__ = implements(ICalendarable) + __select__ = implements(ICalendarable) need_navigation = False id = 'onemonthcal' title = _('one month') @@ -328,7 +328,7 @@ class OneWeekCal(EntityView): """At some point, this view will probably replace ampm calendars""" __registerer__ = priority_registerer - __selectors__ = implements(ICalendarable) + __select__ = implements(ICalendarable) need_navigation = False id = 'oneweekcal' title = _('one week') diff -r 30fe8f5afbd8 -r a95b284150d1 web/views/card.py --- a/web/views/card.py Tue Feb 17 23:46:48 2009 +0100 +++ b/web/views/card.py Tue Feb 17 23:47:23 2009 +0100 @@ -13,7 +13,7 @@ _ = unicode class CardPrimaryView(baseviews.PrimaryView): - __selectors__ = implements('Card') + __select__ = implements('Card') skip_attrs = baseviews.PrimaryView.skip_attrs + ('title', 'synopsis', 'wikiid') show_attr_label = False diff -r 30fe8f5afbd8 -r a95b284150d1 web/views/dynimages.py --- a/web/views/dynimages.py Tue Feb 17 23:46:48 2009 +0100 +++ b/web/views/dynimages.py Tue Feb 17 23:47:23 2009 +0100 @@ -109,7 +109,7 @@ class EETypeSchemaImageView(TmpFileViewMixin, EntityView): id = 'eschemagraph' content_type = 'image/png' - __selectors__ = implements('EEType') + __select__ = implements('EEType') skip_rels = ('owned_by', 'created_by', 'identity', 'is', 'is_instance_of') def _generate(self, tmpfile): @@ -121,7 +121,7 @@ prophdlr=RestrictedSchemaDotPropsHandler(self.req)) class ERTypeSchemaImageView(EETypeSchemaImageView): - __selectors__ = implements('ERType') + __select__ = implements('ERType') def _generate(self, tmpfile): """display schema information for an entity""" @@ -187,7 +187,7 @@ class EETypeWorkflowImageView(TmpFileViewMixin, EntityView): id = 'ewfgraph' content_type = 'image/png' - __selectors__ = implements('EEType') + __select__ = implements('EEType') def _generate(self, tmpfile): """display schema information for an entity""" diff -r 30fe8f5afbd8 -r a95b284150d1 web/views/emailaddress.py --- a/web/views/emailaddress.py Tue Feb 17 23:46:48 2009 +0100 +++ b/web/views/emailaddress.py Tue Feb 17 23:47:23 2009 +0100 @@ -13,7 +13,7 @@ from cubicweb.web.views import baseviews class EmailAddressPrimaryView(baseviews.PrimaryView): - __selectors__ = implements('EmailAddress') + __select__ = implements('EmailAddress') def cell_call(self, row, col, skipeids=None): self.skipeids = skipeids @@ -60,7 +60,7 @@ class EmailAddressShortPrimaryView(EmailAddressPrimaryView): - __selectors__ = implements('EmailAddress') + __select__ = implements('EmailAddress') id = 'shortprimary' title = None # hidden view def render_entity_attributes(self, entity, siderelations): @@ -70,7 +70,7 @@ class EmailAddressOneLineView(baseviews.OneLineView): - __selectors__ = implements('EmailAddress') + __select__ = implements('EmailAddress') def cell_call(self, row, col, **kwargs): entity = self.entity(row, col) @@ -90,7 +90,7 @@ 'mailto:'""" id = 'mailto' - __selectors__ = implements('EmailAddress') + __select__ = implements('EmailAddress') def cell_call(self, row, col, **kwargs): entity = self.entity(row, col) @@ -114,7 +114,7 @@ class EmailAddressTextView(baseviews.TextView): - __selectors__ = implements('EmailAddress') + __select__ = implements('EmailAddress') def cell_call(self, row, col, **kwargs): self.w(self.entity(row, col).display_address()) diff -r 30fe8f5afbd8 -r a95b284150d1 web/views/eproperties.py --- a/web/views/eproperties.py Tue Feb 17 23:46:48 2009 +0100 +++ b/web/views/eproperties.py Tue Feb 17 23:47:23 2009 +0100 @@ -13,7 +13,7 @@ from cubicweb.selectors import (one_line_rset, none_rset, implements, match_user_groups, chainfirst, chainall) -from cubicweb.common.utils import UStringIO +