# HG changeset patch # User Sylvain Thénault <sylvain.thenault@logilab.fr> # Date 1278326365 -7200 # Mon Jul 05 12:39:25 2010 +0200 # Node ID e7e3d26cd0a387996ba0b31a937d3f1271c39ec2 # Parent a0be668af07af906f4b3d11ca7b7eb2a66379f26 3.9 update: use is_instance instead of implements diff --git a/entities.py b/entities.py --- a/entities.py +++ b/entities.py @@ -9,7 +9,7 @@ from logilab.common.textutils import normalize_text from cubicweb.view import EntityView -from cubicweb.selectors import implements +from cubicweb.selectors import is_instance from cubicweb.entities import AnyEntity, fetch_config from cubicweb.entities.adapters import ITreeAdapter @@ -34,7 +34,7 @@ class CommentITreeAdapter(ITreeAdapter): - __select__ = implements('Comment') + __select__ = is_instance('Comment') tree_relation = 'comments' @@ -43,7 +43,7 @@ class CommentFullTextView(EntityView): __regid__ = 'fulltext' - __select__ = implements('Comment') + __select__ = is_instance('Comment') def cell_call(self, row, col, indentlevel=0, withauthor=True): e = self.cw_rset.get_entity(row,col) diff --git a/hooks.py b/hooks.py --- a/hooks.py +++ b/hooks.py @@ -7,14 +7,14 @@ __docformat__ = "restructuredtext en" from cubicweb import RegistryException -from cubicweb.selectors import implements +from cubicweb.selectors import is_instance from cubicweb.sobjects import notification class CommentAddedView(notification.NotificationView): """get notified from new comments""" __regid__ = 'notif_after_add_relation_comments' - __select__ = implements('Comment',) + __select__ = is_instance('Comment',) msgid_timestamp = False def subject(self): diff --git a/views.py b/views.py --- a/views.py +++ b/views.py @@ -16,7 +16,7 @@ from cubicweb.web import dumps -from cubicweb.selectors import (implements, has_permission, authenticated_user, +from cubicweb.selectors import (is_instance, has_permission, authenticated_user, score_entity, relation_possible, one_line_rset, match_kwargs, match_form_params, partial_relation_possible, traced_selection) @@ -45,7 +45,7 @@ # comment views ############################################################### class CommentPrimaryView(primary.PrimaryView): - __select__ = implements('Comment') + __select__ = is_instance('Comment') def cell_call(self, row, col): self._cw.add_css('cubes.comment.css') @@ -80,7 +80,7 @@ class CommentRootView(EntityView): __regid__ = 'commentroot' - __select__ = implements('Comment') + __select__ = is_instance('Comment') def cell_call(self, row, col, **kwargs): entity = self.cw_rset.get_entity(row, col) @@ -93,7 +93,7 @@ class CommentSummary(EntityView): __regid__ = 'commentsummary' - __select__ = implements('Comment') + __select__ = is_instance('Comment') def cell_call(self, row, col, **kwargs): entity = self.cw_rset.get_entity(row, col) @@ -103,7 +103,7 @@ class CommentOneLineView(baseviews.OneLineView): - __select__ = implements('Comment') + __select__ = is_instance('Comment') def cell_call(self, row, col, **kwargs): entity = self.cw_rset.get_entity(row, col) @@ -115,7 +115,7 @@ class CommentTreeItemView(baseviews.ListItemView): __regid__ = 'treeitem' - __select__ = implements('Comment') + __select__ = is_instance('Comment') def cell_call(self, row, col, **kwargs): self._cw.add_js('cubicweb.ajax.js') @@ -170,7 +170,7 @@ class CommentThreadView(treeview.BaseTreeView): """a recursive tree view""" - __select__ = implements('Comment') + __select__ = is_instance('Comment') title = _('thread view') def open_item(self, entity): @@ -178,7 +178,7 @@ class RssItemCommentView(xmlrss.RSSItemView): - __select__ = implements('Comment') + __select__ = is_instance('Comment') def cell_call(self, row, col): entity = self.cw_rset.complete_entity(row, col) @@ -202,7 +202,7 @@ class InlineEditCommentFormView(form.FormViewMixIn, EntityView): __regid__ = 'editcommentform' - __select__ = implements('Comment') + __select__ = is_instance('Comment') jsfunc = "processComment(%s, %s, false)" @@ -322,7 +322,7 @@ class UserLatestCommentsSection(component.EntityVComponent): """a section to display latest comments by a user""" - __select__ = component.EntityVComponent.__select__ & implements('CWUser') + __select__ = component.EntityVComponent.__select__ & is_instance('CWUser') __regid__ = 'latestcomments' def cell_call(self, row, col, view=None): @@ -349,7 +349,7 @@ from cubicweb.web.views.editcontroller import IEditControlAdapter class CommentIEditControlAdapter(IEditControlAdapter): - __select__ = implements('Comment') + __select__ = is_instance('Comment') def after_deletion_path(self): """return (path, parameters) which should be used as redirect @@ -361,7 +361,7 @@ class ReplyCommentAction(LinkToEntityAction): __regid__ = 'reply_comment' - __select__ = LinkToEntityAction.__select__ & implements('Comment') + __select__ = LinkToEntityAction.__select__ & is_instance('Comment') rtype = 'comments' role = 'object' @@ -386,7 +386,7 @@ __regid__ = 'reply_comment' __select__ = ((LinkToEntityAction.__select__ | (match_kwargs('entity') & partial_relation_possible(action='add', strict=True))) - & ~implements('Comment')) + & ~is_instance('Comment')) rtype = 'comments' role = 'object' @@ -399,7 +399,7 @@ class EditCommentAction(Action): __regid__ = 'edit_comment' - __select__ = one_line_rset() & implements('Comment') & has_permission('update') + __select__ = one_line_rset() & is_instance('Comment') & has_permission('update') title = _('edit comment') category = 'hidden' @@ -410,7 +410,7 @@ class DeleteCommentAction(Action): __regid__ = 'delete_comment' - __select__ = implements('Comment') & authenticated_user() & \ + __select__ = is_instance('Comment') & authenticated_user() & \ score_entity(lambda x: not x.reverse_comments and x.cw_has_perm('delete')) title = _('delete comment')