Пример #1
0
def _tsv(json):
    # These should be the names of the original fields in the index document.
    download_fields = vnutil.download_field_list()
    values = []
    for x in download_fields:
        if json.has_key(x):
            if x=='dynamicproperties':
                dp = vnutil.format_json(json[x])
                values.append(unicode(dp.rstrip()))
            else:
                values.append(unicode(json[x]).rstrip())        
        else:
            values.append(u'')
    return u'\t'.join(values).encode('utf-8')
Пример #2
0
def _tsv(json):
    # These should be the names of the original fields in the index document.
    download_fields = vnutil.download_field_list()
    values = []
    for x in download_fields:
        if json.has_key(x):
            if x=='dynamicproperties':
                dp = vnutil.format_json(json[x])
                values.append(unicode(dp.rstrip()))
            else:
                values.append(unicode(json[x]).rstrip())        
        else:
            values.append(u'')
#     logging.debug('%s: JSON: %s' % (DOWNLOAD_VERSION, json))
#     logging.debug('%s: DOWNLOAD_FIELDS: %s' % (UTIL_VERSION, download_fields))
#     logging.debug('%s: VALUES: %s' % (DOWNLOAD_VERSION, values))
    return u'\t'.join(values).encode('utf-8')
Пример #3
0
    def tsv(self):
        # Note similar functionality in download.py _tsv(json)
        json = self.json
#        json['datasource_and_rights'] = json.get('url')
#        download_fields = vnutil.DWC_HEADER_LIST
        download_fields = vnutil.download_field_list()
        values = []
        for x in download_fields:
            if json.has_key(x):
                if x=='dynamicproperties':
#                    logging.info('dynamicproperties before: %s' % json[x] )
                    dp = vnutil.format_json(json[x])
#                    logging.info('dynamicproperties after: %s' % dp)
                    values.append(unicode(dp.rstrip()))
                else:
                    values.append(unicode(json[x]).rstrip())        
            else:
                values.append(u'')
        return u'\t'.join(values).encode('utf-8')
Пример #4
0
    def tsv(self):
        # Note similar functionality in download.py _tsv(json)
        json = self.json
#        json['datasource_and_rights'] = json.get('url')
#        download_fields = vnutil.DWC_HEADER_LIST
        download_fields = vnutil.download_field_list()
        values = []
        for x in download_fields:
            if json.has_key(x):
                if x=='dynamicproperties':
#                    logging.info('dynamicproperties before: %s' % json[x] )
                    dp = vnutil.format_json(json[x])
#                    logging.info('dynamicproperties after: %s' % dp)
                    values.append(unicode(dp.rstrip()))
                else:
                    values.append(unicode(json[x]).rstrip())        
            else:
                values.append(u'')
        return u'\t'.join(values).encode('utf-8')
Пример #5
0
def _tsv(json):
    # These should be the names of the original fields in the index document.
    download_fields = vnutil.download_field_list()
    values = []
    for x in download_fields:
        if json.has_key(x):
            if x == 'dynamicproperties':
                dp = vnutil.format_json(json[x])
                values.append(unicode(dp.rstrip()))
            else:
                values.append(unicode(json[x]).rstrip())
        else:
            values.append(u'')


#     logging.debug('%s: JSON: %s' % (DOWNLOAD_VERSION, json))
#     logging.debug('%s: DOWNLOAD_FIELDS: %s' % (UTIL_VERSION, download_fields))
#     logging.debug('%s: VALUES: %s' % (DOWNLOAD_VERSION, values))
    return u'\t'.join(values).encode('utf-8')