def extract_fields(self):
        """Extract the given fieldnames from the object

        :returns: Schema name/value mapping
        :rtype: dict
        """

        # get the proper data manager for the object
        dm = IDataManager(self.context)

        # filter out ignored fields
        fieldnames = filter(lambda name: name not in self.ignore, self.keys)

        # schema mapping
        out = dict()

        for fieldname in fieldnames:
            try:
                # get the field value with the data manager
                fieldvalue = dm.json_data(fieldname)
            # https://github.com/collective/plone.jsonapi.routes/issues/52
            # -> skip restricted fields
            except Unauthorized:
                logger.debug("Skipping restricted field '%s'" % fieldname)
                continue
            except ValueError:
                logger.debug("Skipping invalid field '%s'" % fieldname)
                continue

            out[fieldname] = api.to_json_value(self.context, fieldname, fieldvalue)

        return out
def extract_fields ( self ) : dm = IDataManager ( self . context ) fieldnames = filter ( lambda name : name not in self . ignore , self . keys ) out = dict ( ) for fieldname in fieldnames : try : fieldvalue = dm . json_data ( fieldname ) except Unauthorized : logger . debug ( "Skipping restricted field '%s'" % fieldname ) continue except ValueError : logger . debug ( "Skipping invalid field '%s'" % fieldname ) continue out [ fieldname ] = api . to_json_value ( self . context , fieldname , fieldvalue ) return out
Extract the given fieldnames from the object

        :returns: Schema name/value mapping
        :rtype: dict