def ensure_utf_8_keywords(self): for obj in self.objects(self.query, 'Ensure keywords are utf-8'): doc = IDocumentMetadata(obj) doc.keywords = tuple( safe_unicode(keyword).encode('utf-8') for keyword in doc.keywords)
def make_document_keywords_unicode(self): query = {'object_provides': [IDocumentMetadata.__identifier__]} for obj in self.objects(query, 'Ensure document keywords are unicode'): doc = IDocumentMetadata(obj) doc.keywords = tuple( safe_unicode(keyword) for keyword in doc.keywords)