cctool

A tool for managing contacts and calendars.
git clone https://git.ce9e.org/cctool.git

commit
e46595d107084d9d948c17d4ec70bbdf94efac83
parent
2ef6b0db1f2f322dbe0778918f5b4db5e68934c0
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2015-04-11 06:48
MultiDict.join(): return default if key does not exist

Diffstat

M cctool.py 9 ++++++---

1 files changed, 6 insertions, 3 deletions


diff --git a/cctool.py b/cctool.py

@@ -111,10 +111,13 @@ class MultiDict(OrderedDict):
  111   111 			raise KeyError
  112   112 
  113   113 	def join(self, key, default='', sep=u','):
  114    -1 		if key in self and len(self[key]) == 1:
  115    -1 			return self[key][0]
   -1   114 		if key in self:
   -1   115 			if len(self[key]) == 1:
   -1   116 				return self[key][0]
   -1   117 			else:
   -1   118 				return sep.join(self[key])
  116   119 		else:
  117    -1 			return sep.join(self[key])
   -1   120 			return default
  118   121 
  119   122 	def update(self, other):
  120   123 		for key in other: