IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 10, 2010, 9:39:28 AM (16 years ago)
Author:
Serge CHASTEL
Message:

Unstable. Added logging (no tused yet. p2 is currently very slow

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sc_branches/psps_testing/psi/psi_inquisitor.py

    r29115 r29140  
    22from suds.xsd.doctor import Import, ImportDoctor
    33from suds import sudsobject
     4from utilities.util import convert
     5import unicodedata
    46
    57class PsiInquisitor:
     
    4244        >>> # we cannot guarantee the order in result
    4345        >>> print result['items']
    44         [{u'[frameID]': u'105439'}]
     46        [{'frameID': 105439}]
    4547        >>> print result['fields']
    46         [u'[frameID]']
     48        ['[frameID]']
    4749        >>> print result['types']
    48         {u'[frameID]': u'Integer'}
     50        {'[frameID]': 'Integer'}
    4951        >>> # This test has to be completed with exhaustive ones...
    5052        >>> # e.g. unit tests against the csr data base.
     
    6264        line_count = 0
    6365        for line in lines:
     66            # Unicode normalization comes from
     67            # http://www.peterbe.com/plog/unicode-to-ascii. I don't
     68            # know where the NFKD means...
     69            line = unicodedata.normalize('NFKD', line).encode('ascii','ignore')
    6470            if first_line_not_seen:
    6571                # Build up the field list and the types dictionary
     
    8591                element = {}
    8692                for i in range(len(values)):
    87                     element[contents['fields'][i]] = values[i]
     93                    field_name = contents['fields'][i].replace('[',
     94                                                               '').replace(']',
     95                                                                           '')
     96                    element[field_name] = convert(types_dictionary[contents['fields'][i]],
     97                                                  values[i])
    8898                contents['items'].append(element)
    8999        return contents
Note: See TracChangeset for help on using the changeset viewer.