cctool

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

commit
7483ef50ab3b38ded7857a0dae59f63d23b115d4
parent
a000d454c424eed0de8f45330ede46d0b04f463e
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2015-05-08 19:46
unicode literals from future

Diffstat

M cctool.py 7 ++++---
M tests.py 2 ++

2 files changed, 6 insertions, 3 deletions


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

@@ -34,6 +34,7 @@ In addition, each item may have the generic fields 'tag', 'comment', and 'url'.
   34    34 """
   35    35 
   36    36 from __future__ import print_function
   -1    37 from __future__ import unicode_literals
   37    38 
   38    39 from collections import OrderedDict
   39    40 from datetime import date
@@ -237,7 +238,7 @@ class BSDCal(Format):
  237   238 	def dump(cls, data, fh):
  238   239 		_fh = codecs.getwriter('utf8')(fh)
  239   240 		for item in data:
  240    -1 			if u'dtstart' in item and u'summary' in item:
   -1   241 			if 'dtstart' in item and 'summary' in item:
  241   242 				dt = item.first('dtstart')
  242   243 				if 'yearly' in item['freq']:
  243   244 					_fh.write('%s\t%s\n' % (dt.strftime('%m/%d*'), item.join('summary')))
@@ -358,7 +359,7 @@ class ABook(Format):
  358   359 		config_parser = ConfigParser()
  359   360 		config_parser.readfp(_fh)
  360   361 		for section in config_parser.sections():
  361    -1 			if section != u'format':
   -1   362 			if section != 'format':
  362   363 				d = MultiDict()
  363   364 				for key, value in config_parser.items(section):
  364   365 					if key == 'bday':
@@ -366,7 +367,7 @@ class ABook(Format):
  366   367 							value = '1900' + value[1:]
  367   368 						d[key] = [datetime.strptime(value, '%Y-%m-%d')]
  368   369 					else:
  369    -1 						d[key] = value.split(u',')
   -1   370 						d[key] = value.split(',')
  370   371 				yield map_keys(d, cls.fields)
  371   372 
  372   373 	@classmethod

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

@@ -1,3 +1,5 @@
   -1     1 from __future__ import unicode_literals
   -1     2 
    1     3 import unittest
    2     4 from datetime import datetime
    3     5