[Zope] unsupported format character 'Y' - LocalFS / ZMI
Dieter Maurer
dieter@handshake.de
Thu, 24 Apr 2003 21:40:23 +0200
Florian Konnertz wrote at 2003-4-23 19:14 +0200:
> ...
> Module DocumentTemplate.DT_Var, line 280, in render
> - __traceback_info__: ('bobobase_modification_time', None, {'fmt':
> '%Y-%m-%d %H:%M', '': 'bobobase_modification_time'})
> ValueError: unsupported format character 'Y' (0x59) at index 1
> ...
> <dtml-var bobobase_modification_time fmt="%Y-%m-%d %H:%M">
Seems that "bobobase_modification_time[()]" is not a
"DateTime.DateTime.DateTime" instance.
Such instances define "__getattr__" as
def __getattr__(self,key):
if '%' in key: return self.strftime(key)
raise AttributeError, key
This magic lets "percent_fmt" in "<dtml-var datetime fmt=percent_fmt>"
be interpreted as an "strftime" format.
Without this magic, such a format string is interpreted as
a C format string and it does not recognize "Y".
I do not know why your "bobobase_modification_time" does not
return the correct type.
Dieter