"""Module providing views for asset storage folder"""
from Products.Five.browser import BrowserView
from plone import api
from plone.app.blob.interfaces import IATBlobImage


class AssetRepositoryView(BrowserView):
    """ Folderish content page default view """

    def contained_items(self, uid):
        stack = api.content.get(UID=uid)
        return stack.restrictedTraverse('@@folderListing')()

    def item_index(self, uid):
        return len(self.contained_items(uid))

    def preview_image(self, uid):
        images = self.contained_items(uid)
        preview = None
        if len(images):
            first_item = images[0].getObject()
            if IATBlobImage.providedBy(first_item):
                preview = first_item
        return preview

"""Module providing views for asset storage folder"""
from Products.Five.browser import BrowserView
from plone import api
from plone.app.contenttypes.interfaces import IImage

class AssetRepositoryView(BrowserView):
    """ Folderish content page default view """

    def contained_items(self, uid):
        stack = api.content.get(UID=uid)
        return stack.restrictedTraverse('@@folderListing')()

    def item_index(self, uid):
        return len(self.contained_items(uid))

    def preview_image(self, uid):
        images = self.contained_items(uid)
        preview = None
        if len(images):
            first_item = images[0].getObject()
            if IImage.providedBy(first_item):
                preview = first_item
        return preview

Use newer interface for filtering
Use newer interface for filtering

The image provided by `plone.app.contenttypes` does reintroduce the global
IImage identifier lost during the transition to dexterity based types

  """Module providing views for asset storage folder"""
  from Products.Five.browser import BrowserView
  from plone import api
- from plone.app.blob.interfaces import IATBlobImage
+ from plone.app.contenttypes.interfaces import IImage
- 
  
  class AssetRepositoryView(BrowserView):
      """ Folderish content page default view """
  
      def contained_items(self, uid):
          stack = api.content.get(UID=uid)
          return stack.restrictedTraverse('@@folderListing')()
  
      def item_index(self, uid):
          return len(self.contained_items(uid))
  
      def preview_image(self, uid):
          images = self.contained_items(uid)
          preview = None
          if len(images):
              first_item = images[0].getObject()
-             if IATBlobImage.providedBy(first_item):
+             if IImage.providedBy(first_item):
                  preview = first_item
          return preview
  
Use newer interface for filtering
## Code Before:
"""Module providing views for asset storage folder"""
from Products.Five.browser import BrowserView
from plone import api
from plone.app.blob.interfaces import IATBlobImage


class AssetRepositoryView(BrowserView):
    """ Folderish content page default view """

    def contained_items(self, uid):
        stack = api.content.get(UID=uid)
        return stack.restrictedTraverse('@@folderListing')()

    def item_index(self, uid):
        return len(self.contained_items(uid))

    def preview_image(self, uid):
        images = self.contained_items(uid)
        preview = None
        if len(images):
            first_item = images[0].getObject()
            if IATBlobImage.providedBy(first_item):
                preview = first_item
        return preview

## Instruction:
Use newer interface for filtering
## Code After:
"""Module providing views for asset storage folder"""
from Products.Five.browser import BrowserView
from plone import api
from plone.app.contenttypes.interfaces import IImage

class AssetRepositoryView(BrowserView):
    """ Folderish content page default view """

    def contained_items(self, uid):
        stack = api.content.get(UID=uid)
        return stack.restrictedTraverse('@@folderListing')()

    def item_index(self, uid):
        return len(self.contained_items(uid))

    def preview_image(self, uid):
        images = self.contained_items(uid)
        preview = None
        if len(images):
            first_item = images[0].getObject()
            if IImage.providedBy(first_item):
                preview = first_item
        return preview
