# HG changeset patch # User Sascha L. Teichmann # Date 1217845966 -7200 # Node ID feb6bb4427fefb084ad0ddf427148a0aefa81150 # Parent 4f782a05b4dc3232c87b5095cf2780b847a15d26 Applied a variation of Stephan Holl's zeiterfassung.non-utf8-chars-in-db.patch to force the encoding given by --encoding=. diff -r 4f782a05b4dc -r feb6bb4427fe ChangeLog --- a/ChangeLog Sun Aug 03 16:11:21 2008 +0200 +++ b/ChangeLog Mon Aug 04 12:32:46 2008 +0200 @@ -1,3 +1,9 @@ +2008-08-04 Sascha L. Teichmann + + * contrib/zeiterfassung: Applied a variation of Stephan Holl's + zeiterfassung.non-utf8-chars-in-db.patch to force the encoding + given by --encoding=. + 2008-08-03 Sascha L. Teichmann * contrib/zeiterfassung: Added parameter -e | --encoding=. diff -r 4f782a05b4dc -r feb6bb4427fe contrib/zeiterfassung --- a/contrib/zeiterfassung Sun Aug 03 16:11:21 2008 +0200 +++ b/contrib/zeiterfassung Mon Aug 04 12:32:46 2008 +0200 @@ -52,7 +52,7 @@ SELECT date(start_time), sum(strftime('%s', stop_time) - strftime('%s', start_time)), - 'no description' + 'no description' AS description FROM entries WHERE project_id = :project_id AND @@ -67,10 +67,9 @@ ''' def human_time(s): - s_h = s % 3600 h = s / 3600 - m = s_h / 60 - if (s_h % 60) >= 30: + m = (s % 3600) / 60 + if (s % 60) >= 30: m += 1 if m == 60: m = 0 @@ -137,6 +136,8 @@ try: try: con = db.connect(database) + if encoding: + con.text_factory = lambda s: s.decode(encoding) cur = con.cursor() if list_projects: @@ -173,7 +174,7 @@ if m: workpackage = m.group(1) c = c[m.end():].strip() - print u"%s %sh %s %3s [%s] %s" % ( + print "%s %sh %s %3s [%s] %s" % ( d.strftime("%d.%m.%Y"), human_time(t), TYPE_OF_ENTRY,