comparison getan/project.py @ 413:a499441249af

Fixes sorting by day for templates. * Adds a string attribute 'startisoday' to the Entry object, so it can be used by jinja2's sort and groupby filters.
author Bernhard Reiter <bernhard@intevation.de>
date Wed, 03 May 2017 13:35:58 +0200
parents 5f557bd2cfe0
children a47c7c0e01ec
comparison
equal deleted inserted replaced
412:cc56bc1fd56b 413:a499441249af
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 # 3 #
4 # (c) 2008, 2009, 2010 by 4 # (c) 2008, 2009, 2010 by
5 # Sascha L. Teichmann <sascha.teichmann@intevation.de> 5 # Sascha L. Teichmann <sascha.teichmann@intevation.de>
6 # Ingo Weinzierl <ingo.weinzierl@intevation.de> 6 # Ingo Weinzierl <ingo.weinzierl@intevation.de>
7 # (c) 2017 by Intevation GmbH
8 # Authors:
9 # * Sascha L. Teichmann <sascha.teichmann@intevation.de>
10 # * Ingo Weinzierl <ingo.weinzierl@intevation.de>
11 # ' Bernhard Reiter <bernhard.reiter@intevation.de>
7 # 12 #
8 # This is Free Software licensed unter the terms of GPLv3 or later. 13 # This is Free Software licensed unter the terms of GPLv3 or later.
9 # For details see LICENSE coming with the source of 'getan'. 14 # For details see LICENSE coming with the source of 'getan'.
10 15
11 import locale 16 import locale
90 self.start = start 95 self.start = start
91 self.end = end 96 self.end = end
92 self.desc = desc 97 self.desc = desc
93 self.workpackage = "-" 98 self.workpackage = "-"
94 99
100 # we add this attribute for use in jinja2 templates,
101 # as filters like sort() or groupby() work only on attributes
102 # and sorting or grouping by day is common for reporting
103 self.startisoday = start.date().isoformat()
104
95 # carefully handle non unicode string 105 # carefully handle non unicode string
96 # urwid seems to have some issue with plain str 106 # urwid seems to have some issue with plain str
97 if self.desc and not isinstance(self.desc, unicode): 107 if self.desc and not isinstance(self.desc, unicode):
98 self.desc = unicode(self.desc, locale.getpreferredencoding()) 108 self.desc = unicode(self.desc, locale.getpreferredencoding())
99 109
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)