From 7745ec5c7fccf0b562fc319c905e131f1a7a16fa Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 3 Jan 2011 08:45:31 +0000 Subject: [PATCH] unicode, key_type --- pandora/item/managers.py | 4 ++-- pandora/item/models.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pandora/item/managers.py b/pandora/item/managers.py index 1b1e203..90cb813 100644 --- a/pandora/item/managers.py +++ b/pandora/item/managers.py @@ -34,8 +34,8 @@ def parseCondition(condition): else: exclude = False - key_type = models.site_config['keys'].get(k, 'string') - return { + key_type = models.site_config['keys'].get(k, {'type':'string'}).get('type') + key_type = { 'title': 'string', 'person': 'string' }.get(key_type, key_type) diff --git a/pandora/item/models.py b/pandora/item/models.py index 444a3ea..b304886 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -522,11 +522,11 @@ class Item(models.Model): s = ItemSort(item=self) def sortNames(values): - sort_value = '' + sort_value = u'' if values: - sort_value = '; '.join([get_name_sort(name) for name in values]) + sort_value = u'; '.join([get_name_sort(name) for name in values]) if not sort_value: - sort_value = '' + sort_value = u'' return sort_value base_keys = ( @@ -572,9 +572,9 @@ class Item(models.Model): setattr(s, '%s_desc'%name, value) elif field_type == 'text': #FIXME: what use pural_key? - value = self.get(name, '') + value = self.get(name, u'') if isinstance(value, list): - value = ','.join(value) + value = u','.join(value) value = unicodedata.normalize('NFKD', value) setattr(s, name, value) if not value: