diff --git a/app/model/__init__.py b/app/model/__init__.py index a471798..6f87dd6 100644 --- a/app/model/__init__.py +++ b/app/model/__init__.py @@ -1,48 +1,51 @@ # -*- coding: utf-8 -*- # # Copyright 2014 Kolab Systems AG (http://www.kolabsys.com) # # Thomas Bruederli # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # from event import Event from task import Task +from note import Note from system import System from user import User, Permission, AnonymousUser __all__ = [ 'System', 'Event', 'Task', + 'Note', 'User', 'Permission', 'AnonymousUser', ] __class_map__ = { 'event': Event, 'task': Task, + 'note': Note, 'system': System, } def get_instance(classname, **kw): """ Returns an instance of the given model class """ if __class_map__.has_key(classname): return __class_map__[classname](**kw) return None \ No newline at end of file diff --git a/app/model/__init__.py b/app/model/note.py similarity index 57% copy from app/model/__init__.py copy to app/model/note.py index a471798..366260b 100644 --- a/app/model/__init__.py +++ b/app/model/note.py @@ -1,48 +1,35 @@ # -*- coding: utf-8 -*- # -# Copyright 2014 Kolab Systems AG (http://www.kolabsys.com) +# Copyright 2015 Kolab Systems AG (http://www.kolabsys.com) # # Thomas Bruederli # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # -from event import Event -from task import Task -from system import System -from user import User, Permission, AnonymousUser +from kolabobject import KolabObject +from pykolab.xml import note_from_message -__all__ = [ - 'System', - 'Event', - 'Task', - 'User', - 'Permission', - 'AnonymousUser', -] - -__class_map__ = { - 'event': Event, - 'task': Task, - 'system': System, -} - -def get_instance(classname, **kw): +class Note(KolabObject): """ - Returns an instance of the given model class + Model class for accessing Kolab Groupware Note objects """ - if __class_map__.has_key(classname): - return __class_map__[classname](**kw) - return None \ No newline at end of file + def __init__(self, *args, **kw): + KolabObject.__init__(self, *args, **kw) + self.folder_type = 'note' + self.x_kolab_type = 'application/x-vnd.kolab.note' + + def _object_from_message(self, message): + return note_from_message(message)