use is_instance in a number of places (esp. documentation) rather than the deprecated implements stable
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
Thu, 26 Aug 2010 10:13:48 +0200
branchstable
changeset 6152 6824f8b61098
parent 6150 98642a11aea3
child 6155 16fad8d00787
child 6169 55378e1bab1b
use is_instance in a number of places (esp. documentation) rather than the deprecated implements
cwvreg.py
doc/book/en/devrepo/entityclasses/adapters.rst
doc/book/en/devrepo/entityclasses/application-logic.rst
doc/book/en/devrepo/repo/hooks.rst
doc/book/en/devweb/edition/examples.rst
doc/book/en/devweb/views/primary.rst
doc/book/en/devweb/views/views.rst
doc/book/en/tutorials/advanced/index.rst
doc/book/en/tutorials/base/create-cube.rst
server/sources/__init__.py
web/facet.py
--- a/cwvreg.py	Wed Aug 25 19:01:58 2010 +0200
+++ b/cwvreg.py	Thu Aug 26 10:13:48 2010 +0200
@@ -161,14 +161,14 @@
 'primary'`) view (`__registry__ = 'views'`) for a result set
 containing a `Card` entity, two objects will probably be selectable:
 
-* the default primary view (`__select__ = implements('Any')`), meaning
+* the default primary view (`__select__ = is_instance('Any')`), meaning
   that the object is selectable for any kind of entity type
 
-* the specific `Card` primary view (`__select__ = implements('Card')`,
+* the specific `Card` primary view (`__select__ = is_instance('Card')`,
   meaning that the object is selectable for Card entities
 
 Other primary views specific to other entity types won't be selectable in this
-case. Among selectable objects, the `implements('Card')` selector will return a higher
+case. Among selectable objects, the `is_instance('Card')` selector will return a higher
 score since it's more specific, so the correct view will be selected as expected.
 
 .. _SelectionAPI:
--- a/doc/book/en/devrepo/entityclasses/adapters.rst	Wed Aug 25 19:01:58 2010 +0200
+++ b/doc/book/en/devrepo/entityclasses/adapters.rst	Thu Aug 26 10:13:48 2010 +0200
@@ -13,7 +13,7 @@
 
 In |cubicweb| adapters provide logical functionalities
 to entity types. They are introduced in version `3.9`. Before that one
-had to implements Interfaces in entity classes to achieve a similar goal. However,
+had to implement Interfaces in entity classes to achieve a similar goal. However,
 hte problem with this approch is that is clutters the entity class's namespace, exposing
 name collision risks with schema attributes/relations or even methods names
 (different interfaces may define the same method with not necessarily the same
--- a/doc/book/en/devrepo/entityclasses/application-logic.rst	Wed Aug 25 19:01:58 2010 +0200
+++ b/doc/book/en/devrepo/entityclasses/application-logic.rst	Thu Aug 26 10:13:48 2010 +0200
@@ -62,7 +62,7 @@
     from cubicweb.entities.adapters import ITreeAdapter
 
     class ProjectAdapter(ITreeAdapter):
-        __select__ = implements('Project')
+        __select__ = is_instance('Project')
         tree_relation = 'subproject_of'
 
     class Project(AnyEntity):
--- a/doc/book/en/devrepo/repo/hooks.rst	Wed Aug 25 19:01:58 2010 +0200
+++ b/doc/book/en/devrepo/repo/hooks.rst	Thu Aug 26 10:13:48 2010 +0200
@@ -157,13 +157,13 @@
 .. sourcecode:: python
 
    from cubicweb import ValidationError
-   from cubicweb.selectors import implements
+   from cubicweb.selectors import is_instance
    from cubicweb.server.hook import Hook
 
    class PersonAgeRange(Hook):
         __regid__ = 'person_age_range'
         events = ('before_add_entity', 'before_update_entity')
-        __select__ = Hook.__select__ & implements('Person')
+        __select__ = Hook.__select__ & is_instance('Person')
 
         def __call__(self):
             if 0 >= self.entity.age <= 120:
@@ -173,7 +173,7 @@
 
 Hooks being AppObjects like views, they have a __regid__ and a
 __select__ class attribute. The base __select__ is augmented with an
-`implements` selector matching the desired entity type. The `events`
+`is_instance` selector matching the desired entity type. The `events`
 tuple is used by the Hook.__select__ base selector to dispatch the
 hook on the right events. In an entity hook, it is possible to
 dispatch on any entity event (e.g. 'before_add_entity',
--- a/doc/book/en/devweb/edition/examples.rst	Wed Aug 25 19:01:58 2010 +0200
+++ b/doc/book/en/devweb/edition/examples.rst	Thu Aug 26 10:13:48 2010 +0200
@@ -18,7 +18,7 @@
  from cubicweb.web import formfields as ff, formwidgets as fwdgs
  class SendToReviewerStatusChangeView(ChangeStateFormView):
      __select__ = (ChangeStateFormView.__select__ &
-                   implements('Talk') &
+                   is_instance('Talk') &
                    rql_condition('X in_state S, S name "submitted"'))
 
      def get_form(self, entity, transition, **kwargs):
@@ -126,7 +126,7 @@
 
     class MassMailingFormView(form.FormViewMixIn, EntityView):
 	__regid__ = 'massmailing'
-	__select__ = implements(IEmailable) & authenticated_user()
+	__select__ = is_instance(IEmailable) & authenticated_user()
 
 	def call(self):
 	    form = self._cw.vreg['forms'].select('massmailing', self._cw,
--- a/doc/book/en/devweb/views/primary.rst	Wed Aug 25 19:01:58 2010 +0200
+++ b/doc/book/en/devweb/views/primary.rst	Thu Aug 26 10:13:48 2010 +0200
@@ -215,11 +215,11 @@
 
 .. sourcecode:: python
 
-   from cubicweb.selectors import implements
+   from cubicweb.selectors import is_instance
    from cubicweb.web.views.primary import Primaryview
 
    class BlogEntryPrimaryView(PrimaryView):
-     __select__ = PrimaryView.__select__ & implements('BlogEntry')
+     __select__ = PrimaryView.__select__ & is_instance('BlogEntry')
 
        def render_entity_attributes(self, entity):
            self.w(u'<p>published on %s</p>' %
@@ -245,12 +245,12 @@
 .. sourcecode:: python
 
  from logilab.mtconverter import xml_escape
- from cubicweb.selectors import implements, one_line_rset
+ from cubicweb.selectors import is_instance, one_line_rset
  from cubicweb.web.views.primary import Primaryview
 
  class BlogPrimaryView(PrimaryView):
      __regid__ = 'primary'
-     __select__ = PrimaryView.__select__ & implements('Blog')
+     __select__ = PrimaryView.__select__ & is_instance('Blog')
      rql = 'Any BE ORDERBY D DESC WHERE BE entry_of B, BE publish_date D, B eid %(b)s'
 
      def render_entity_relations(self, entity):
@@ -260,7 +260,7 @@
 
  class BlogEntryInBlogView(EntityView):
      __regid__ = 'inblogcontext'
-     __select__ = implements('BlogEntry')
+     __select__ = is_instance('BlogEntry')
 
      def cell_call(self, row, col):
          entity = self.cw_rset.get_entity(row, col)
--- a/doc/book/en/devweb/views/views.rst	Wed Aug 25 19:01:58 2010 +0200
+++ b/doc/book/en/devweb/views/views.rst	Thu Aug 26 10:13:48 2010 +0200
@@ -121,7 +121,7 @@
         """
         __regid__ = 'search-associate'
         title = _('search for association')
-        __select__ = one_line_rset() & match_search_state('linksearch') & implements('Any')
+        __select__ = one_line_rset() & match_search_state('linksearch') & is_instance('Any')
 
 
 XML views, binaries views...
--- a/doc/book/en/tutorials/advanced/index.rst	Wed Aug 25 19:01:58 2010 +0200
+++ b/doc/book/en/tutorials/advanced/index.rst	Thu Aug 26 10:13:48 2010 +0200
@@ -335,7 +335,7 @@
 
 .. sourcecode:: python
 
-    from cubicweb.selectors import implements
+    from cubicweb.selectors import is_instance
     from cubicweb.server import hook
 
     class SetVisibilityOp(hook.Operation):
@@ -347,7 +347,7 @@
 
     class SetVisibilityHook(hook.Hook):
 	__regid__ = 'sytweb.setvisibility'
-	__select__ = hook.Hook.__select__ & implements('Folder', 'File', 'Image', 'Comment')
+	__select__ = hook.Hook.__select__ & is_instance('Folder', 'File', 'Image', 'Comment')
 	events = ('after_add_entity',)
 	def __call__(self):
 	    hook.set_operation(self._cw, 'pending_visibility', self.entity.eid,
--- a/doc/book/en/tutorials/base/create-cube.rst	Wed Aug 25 19:01:58 2010 +0200
+++ b/doc/book/en/tutorials/base/create-cube.rst	Thu Aug 26 10:13:48 2010 +0200
@@ -307,11 +307,11 @@
 
 .. sourcecode:: python
 
-  from cubicweb.selectors import implements
+  from cubicweb.selectors import is_instance
   from cubicweb.web.views import primary
 
   class BlogEntryPrimaryView(primary.PrimaryView):
-      __select__ = implements('BlogEntry')
+      __select__ = is_instance('BlogEntry')
 
       def render_entity_attributes(self, entity):
           self.w(u'<p>published on %s</p>' %
@@ -376,7 +376,7 @@
 .. sourcecode:: python
 
  class BlogEntryPrimaryView(primary.PrimaryView):
-     __select__ = implements('BlogEntry')
+     __select__ = is_instance('BlogEntry')
 
      ...
 
--- a/server/sources/__init__.py	Wed Aug 25 19:01:58 2010 +0200
+++ b/server/sources/__init__.py	Thu Aug 26 10:13:48 2010 +0200
@@ -306,7 +306,7 @@
         pass
 
     def authenticate(self, session, login, **kwargs):
-        """if the source support CWUser entity type, it should implements
+        """if the source support CWUser entity type, it should implement
         this method which should return CWUser eid for the given login/password
         if this account is defined in this source and valid login / password is
         given. Else raise `AuthenticationError`
--- a/web/facet.py	Wed Aug 25 19:01:58 2010 +0200
+++ b/web/facet.py	Thu Aug 26 10:13:48 2010 +0200
@@ -482,7 +482,7 @@
       class AgencyFacet(RelationFacet):
           __regid__ = 'agency'
           # this facet should only be selected when visualizing offices
-          __select__ = RelationFacet.__select__ & implements('Office')
+          __select__ = RelationFacet.__select__ & is_instance('Office')
           # this facet is a filter on the 'Agency' entities linked to the office
           # through the 'proposed_by' relation, where the office is the subject
           # of the relation
@@ -659,7 +659,7 @@
       class PostalCodeFacet(RelationAttributeFacet):
           __regid__ = 'postalcode'
           # this facet should only be selected when visualizing offices
-          __select__ = RelationAttributeFacet.__select__ & implements('Office')
+          __select__ = RelationAttributeFacet.__select__ & is_instance('Office')
           # this facet is a filter on the PostalAddress entities linked to the
           # office through the 'has_address' relation, where the office is the
           # subject of the relation
@@ -722,7 +722,7 @@
 
       class SurfaceFacet(AttributeFacet):
           __regid__ = 'surface'
-          __select__ = AttributeFacet.__select__ & implements('Office')
+          __select__ = AttributeFacet.__select__ & is_instance('Office')
           # this facet is a filter on the office'surface
           rtype = 'surface'
           # override the default value of operator since we want to filter
@@ -794,7 +794,7 @@
 
       class SurfaceFacet(RangeFacet):
           __regid__ = 'surface'
-          __select__ = RangeFacet.__select__ & implements('Office')
+          __select__ = RangeFacet.__select__ & is_instance('Office')
           # this facet is a filter on the office'surface
           rtype = 'surface'
 
@@ -880,7 +880,7 @@
 
       class HasImageFacet(HasRelationFacet):
           __regid__ = 'hasimage'
-          __select__ = HasRelationFacet.__select__ & implements('Book')
+          __select__ = HasRelationFacet.__select__ & is_instance('Book')
           rtype = 'has_image'
           role = 'subject'
     """