def _parse_properties(self, properties):
        """Make list of properties into 2 things:
        (1) dictionary of { 'aliased-field': 1, ... } for a mongodb query eg. {''}
        (2) dictionary, keyed by aliased field, for display
        """
        props = {}
        # TODO: clean up prop_dict?
        prop_dict = OrderedDict()
        # We use a dict instead of list to provide for a richer syntax
        for p in properties:
            if p in self.aliases:
                if isinstance(properties, dict):
                    props[self.aliases[p]] = properties[p]
                else:
                    props[self.aliases[p]] = 1
                prop_dict[p] = self.aliases[p].split(".")
            else:
                if isinstance(properties, dict):
                    props[p] = properties[p]
                else:
                    props[p] = 1
                prop_dict[p] = p.split(".")
        # including a lower-level key after a higher level key e.g.:
        # {'output': 1, 'output.crystal': 1} instead of
        # {'output.crystal': 1, 'output': 1}
        # causes mongo to skip the other higher level keys.
        # this is a (sketchy) workaround for that. Note this problem
        # doesn't appear often in python2 because the dictionary ordering
        # is more stable.
        props = OrderedDict(sorted(props.items(), reverse=True))
        return props, prop_dict
def _parse_properties ( self , properties ) : props = { } prop_dict = OrderedDict ( ) for p in properties : if p in self . aliases : if isinstance ( properties , dict ) : props [ self . aliases [ p ] ] = properties [ p ] else : props [ self . aliases [ p ] ] = 1 prop_dict [ p ] = self . aliases [ p ] . split ( "." ) else : if isinstance ( properties , dict ) : props [ p ] = properties [ p ] else : props [ p ] = 1 prop_dict [ p ] = p . split ( "." ) props = OrderedDict ( sorted ( props . items ( ) , reverse = True ) ) return props , prop_dict
Make list of properties into 2 things:
        (1) dictionary of { 'aliased-field': 1, ... } for a mongodb query eg. {''}
        (2) dictionary, keyed by aliased field, for display