from Products.ERP5Type.Log import log
from Products.ZSQLCatalog.SQLCatalog import Query, SimpleQuery

portal = context.getPortalObject()
portal_catalog = portal.portal_catalog

kw_dict = {"portal_type": "Data Descriptor"}
content = None
for document in portal_catalog(**kw_dict):
  if document.reference == reference:
    found = True
    content = document.getTextContent()
    if content is not None:
      return content
    else:
      return "No metadata available for this type of file yet"
if content is None:
  return "Data descriptor not found"
