fix "when" field in calendar not showing dates http://bugs.gentoo.org/show_bug.cgi?id=355913 http://code.google.com/p/googlecl/issues/detail?id=358 Index: googlecl/base.py =================================================================== --- src/googlecl/base.py (revision 527) +++ src/googlecl/base.py (working copy) @@ -673,10 +673,12 @@ except ValueError, err: LOG.debug(err.args[0] + ' (Did not add value for field ' + attr + ')') except AttributeError, err: + LOG.debug(err.args[0] + ' (value for field ' + attr + ')') try: # Last ditch effort to blindly grab the attribute val = getattr(wrapped_entry.entry, attr).text or missing_field_value except AttributeError: + LOG.debug(err.args[0] + ' (value for field ' + attr + ')') val = missing_field_value # Apparently, atom(?) doesn't always return a Unicode type when there are # non-latin characters, so force everything to Unicode. Index: googlecl/calendar/__init__.py =================================================================== --- src/googlecl/calendar/__init__.py (revision 527) +++ src/googlecl/calendar/__init__.py (working copy) @@ -235,12 +235,22 @@ class CalendarEntryToStringWrapper(googlecl.base.BaseEntryToStringWrapper): + def __init__(self, entry, config): + """Initialize a CalendarEntry wrapper. + + Args: + entry: CalendarEntry to interpret to strings. + config: Configuration parser. Needed for some values. + """ + googlecl.base.BaseEntryToStringWrapper.__init__(self, entry) + self.config_parser = config + @property def when(self): """When event takes place.""" start_date, end_date, freq = get_datetimes(self.entry) - print_format = googlecl.CONFIG.lazy_get(SECTION_HEADER, - 'date_print_format') + print_format = self.config_parser.lazy_get(SECTION_HEADER, + 'date_print_format') start_text = time.strftime(print_format, start_date) end_text = time.strftime(print_format, end_date) value = start_text + ' - ' + end_text @@ -277,9 +287,9 @@ for entry in single_events: print googlecl.base.compile_entry_string( - CalendarEntryToStringWrapper(entry), - options.fields.split(','), - delimiter=options.delimiter) + CalendarEntryToStringWrapper(entry, client.config), + options.fields.split(','), + delimiter=options.delimiter) #===============================================================================