use is_in_state to avoid spurious possible views error (needs cw 3.7.3) stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 01 Apr 2010 07:38:14 +0200
branchstable
changeset 182 b0b42cfa25e3
parent 181 4b93c8ae5ea2
child 183 f720e4f589b0
use is_in_state to avoid spurious possible views error (needs cw 3.7.3)
__pkginfo__.py
debian/control
hooks.py
--- a/__pkginfo__.py	Thu Apr 01 07:36:53 2010 +0200
+++ b/__pkginfo__.py	Thu Apr 01 07:38:14 2010 +0200
@@ -67,7 +67,7 @@
     ]
 
 __depends_cubes__ = {}
-__depends__ = {'cubicweb': '>= 3.6.0'}
+__depends__ = {'cubicweb': '>= 3.7.3'}
 __use__ = tuple(__depends_cubes__)
 
 # package ###
--- a/debian/control	Thu Apr 01 07:36:53 2010 +0200
+++ b/debian/control	Thu Apr 01 07:38:14 2010 +0200
@@ -11,7 +11,7 @@
 Architecture: all
 Conflicts: erudi-blog, erudi-blog-server, erudi-blog-client, erudi-blog-comp
 Replaces: erudi-blog, erudi-blog-server, erudi-blog-client, erudi-blog-comp
-Depends: cubicweb-common (>= 3.6.0)
+Depends: cubicweb-common (>= 3.7.3)
 Description: blog component for the CubicWeb framework
  This CubicWeb component provides blogging functionnalities.
  .
--- a/hooks.py	Thu Apr 01 07:36:53 2010 +0200
+++ b/hooks.py	Thu Apr 01 07:38:14 2010 +0200
@@ -1,11 +1,9 @@
-from cubicweb.selectors import implements, score_entity
+from cubicweb.selectors import implements, is_in_state
 from cubicweb.sobjects.notification import NotificationView, StatusChangeMixIn
 
 class BlogEntryPublishedView(StatusChangeMixIn, NotificationView):
     """get notified from published blogs"""
-    __select__ = (implements('BlogEntry',)
-                  & score_entity(lambda x: x.latest_trinfo().new_state.name == 'published')
-                  )
+    __select__ = implements('BlogEntry',) & is_in_state('published')
     content_attr = 'content'
 
     def subject(self):