@@ -299,7 +299,11 @@ def set_field(self, name, value):
299299 self .vtodo .pop (name )
300300 if value :
301301 logger .debug ("Setting field %s to %s." , name , value )
302- self .vtodo .add (name , value )
302+ if name == 'categories' :
303+ v = icalendar .prop .vInline (',' .join (value ))
304+ self .vtodo .add (name , v )
305+ else :
306+ self .vtodo .add (name , value )
303307
304308 def serialize (self , original = None ):
305309 """Serialize a Todo into a VTODO."""
@@ -530,7 +534,6 @@ def add_file(self, list_name, path, mtime):
530534 raise exceptions .AlreadyExists ('file' , list_name ) from e
531535
532536 def add_category (self , uid , category ):
533- try :
534537 self ._conn .execute (
535538 '''
536539 INSERT INTO categories (
@@ -648,6 +651,7 @@ def todos(
648651 due = None ,
649652 start = None ,
650653 startable = False ,
654+ categories = None ,
651655 status = (
652656 'NEEDS-ACTION' ,
653657 'IN-PROCESS' ,
@@ -800,7 +804,7 @@ def _todo_from_db(self, row):
800804 todo .status = row ['status' ]
801805 todo .description = row ['description' ]
802806 todo .location = row ['location' ]
803- todo .categories = []
807+ todo .categories = None
804808 #row['categories']
805809 # TODO: category korrekt befüllen
806810 todo .sequence = row ['sequence' ]
@@ -959,6 +963,9 @@ def update_cache(self):
959963
960964 self .cache .save_to_disk ()
961965
966+ def todos (self , ** kwargs ):
967+ return self .cache .todos (** kwargs )
968+
962969 def todo (self , id , ** kwargs ):
963970 return self .cache .todo (id , ** kwargs )
964971
0 commit comments