def _set_properties(self, properties, header_tag):
        # NOTE(stevemar): As per the API, the headers have to be in the form
        # of "X-Account-Meta-Book: MobyDick". In the case of a Container
        # property we use: "X-Add-Container-Meta-Book: MobyDick", and the same
        # logic applies for Object properties

        log = logging.getLogger(__name__ + '._set_properties')

        headers = {}
        for k, v in properties.items():
            if not utils.is_ascii(k) or not utils.is_ascii(v):
                log.error('Cannot set property %s to non-ascii value', k)
                continue

            header_name = header_tag % k
            headers[header_name] = v
        return headers
    def _set_properties(self, properties, header_tag):
        # NOTE(stevemar): As per the API, the headers have to be in the form
        # of "X-Account-Meta-Book: MobyDick". In the case of a Container
        # property we use: "X-Add-Container-Meta-Book: MobyDick", and the same
        # logic applies for Object properties

        log = logging.getLogger(__name__ + '._set_properties')

        headers = {}
        for k, v in six.iteritems(properties):
            if not utils.is_ascii(k) or not utils.is_ascii(v):
                log.error('Cannot set property %s to non-ascii value', k)
                continue

            header_name = header_tag % k
            headers[header_name] = v
        return headers
 def test_is_ascii_string(self):
     self.assertFalse(utils.is_ascii(u'\u2665'))
 def test_is_ascii_bytes(self):
     self.assertFalse(utils.is_ascii(b'\xe2'))
Exemplo n.º 5
0
 def test_is_ascii_string(self):
     self.assertFalse(utils.is_ascii(u'\u2665'))
Exemplo n.º 6
0
 def test_is_ascii_bytes(self):
     self.assertFalse(utils.is_ascii(b'\xe2'))