Changeset View
Changeset View
Standalone View
Standalone View
pykolab/xml/note.py
Show First 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | def get_classification(self, translated=True): | ||||
return _class | return _class | ||||
def set_classification(self, classification): | def set_classification(self, classification): | ||||
if classification in self.classification_map.keys(): | if classification in self.classification_map.keys(): | ||||
self.setClassification(self.classification_map[classification]) | self.setClassification(self.classification_map[classification]) | ||||
elif classification in self.classification_map.values(): | elif classification in self.classification_map.values(): | ||||
self.setClassification(status) | self.setClassification(status) | ||||
else: | else: | ||||
raise ValueError, _("Invalid classification %r") % (classification) | raise ValueError(_("Invalid classification %r") % (classification)) | ||||
def add_category(self, category): | def add_category(self, category): | ||||
_categories = self.categories() | _categories = self.categories() | ||||
_categories.append(ustr(category)) | _categories.append(ustr(category)) | ||||
self.setCategories(_categories) | self.setCategories(_categories) | ||||
def _translate_value(self, val, map): | def _translate_value(self, val, map): | ||||
name_map = dict([(v, k) for (k, v) in map.iteritems()]) | name_map = dict([(v, k) for (k, v) in map.iteritems()]) | ||||
Show All 23 Lines | class Note(kolabformat.Note): | ||||
def __str__(self): | def __str__(self): | ||||
xml = kolabformat.writeNote(self) | xml = kolabformat.writeNote(self) | ||||
error = kolabformat.error() | error = kolabformat.error() | ||||
if error == None or not error: | if error == None or not error: | ||||
return xml | return xml | ||||
else: | else: | ||||
raise NoteIntegrityError, kolabformat.errorMessage() | raise NoteIntegrityError(kolabformat.errorMessage()) | ||||
class NoteIntegrityError(Exception): | class NoteIntegrityError(Exception): | ||||
def __init__(self, message): | def __init__(self, message): | ||||
Exception.__init__(self, message) | Exception.__init__(self, message) |