selectors.py
changeset 5858 384d34e76d6d
parent 5736 375819ec7d43
child 5877 0c7b7b76a84f
equal deleted inserted replaced
5854:b49f58a320e6 5858:384d34e76d6d
   732     def __init__(self, mimetype, once_is_enough=False):
   732     def __init__(self, mimetype, once_is_enough=False):
   733         super(has_mimetype, self).__init__(once_is_enough)
   733         super(has_mimetype, self).__init__(once_is_enough)
   734         self.mimetype = mimetype
   734         self.mimetype = mimetype
   735 
   735 
   736     def score_entity(self, entity):
   736     def score_entity(self, entity):
   737         idownloadable =  entity.cw_adapt_to('IDownloadable')
   737         idownloadable = entity.cw_adapt_to('IDownloadable')
   738         if idownloadable is None:
   738         if idownloadable is None:
   739             return 0
   739             return 0
   740         mt = idownloadable.download_content_type()
   740         mt = idownloadable.download_content_type()
   741         if not (mt and mt.startswith(self.mimetype)):
   741         if not (mt and mt.startswith(self.mimetype)):
   742             return 0
   742             return 0