def get_dynamic_property_and_language(self, name, dynamic_schema, language=None): value, language = ShopFolder.get_property_and_language(self, name, language) datatype = dynamic_schema[name] # Default value if value is None: value = datatype.get_default() elif getattr(datatype, "multiple", False): if not isinstance(value, list): # Decode the property # Only support list of strings value = list(Tokens.decode(value)) # Else a list was already set by "set_property" else: value = datatype.decode(value) return value, language
def get_dynamic_property_and_language(self, name, dynamic_schema, language=None): value, language = ShopFolder.get_property_and_language( self, name, language) datatype = dynamic_schema[name] # Default value if value is None: value = datatype.get_default() elif getattr(datatype, 'multiple', False): if not isinstance(value, list): # Decode the property # Only support list of strings value = list(Tokens.decode(value)) # Else a list was already set by "set_property" else: value = datatype.decode(value) return value, language
def test_Tokens(self): data = 'value1 value2 value3' result = ('value1', 'value2', 'value3') self.assertEqual(Tokens.decode(data), result) self.assertEqual(Tokens.encode(result), data)
def test_Tokens(self): data = "value1 value2 value3" result = ("value1", "value2", "value3") self.assertEqual(Tokens.decode(data), result) self.assertEqual(Tokens.encode(result), data)