Roundup Tracker - Issues

Message5089

Author ber
Recipients antmail, ber, jerrykan
Date 2014-04-25.13:00:01
Message-id <1398430802.64.0.180308116184.issue2550612@psf.upfronthosting.co.za>
In-reply-to
----------Original Message----------
From: Anthony Pankov <ant_mail@inbox.ru>
Sent: Friday 25 April 2014, 14:09:11
To: "roundup-devel" <roundup-devel@lists.sourceforge.net>
Cc: 
Subject: [Roundup-devel] 4 years opened issue and templating.py 
restructuring

Hello, All.

There is an issue http://issues.roundup-tracker.org/issue2550612 which
i can confirm.

As  i  see,  incorrect  date value is raised as DateHTMLProperty class
after  post.  For  example,  '999'  entered in date field.  '999' will
appear  as  string  _value  in base  HTMLProperty class and date value will 
be
None      in     ancestor     DateHTMLProperty.     When    displaying
DateHTMLProperty.pretty(),  DateHTMLProperty.plain()
functions   check   whether   _value   is  None  and  if  not  try  to
self._value.local(offset)  which  raise  an  error. This is because of
_value is not None, it is incorrect date string.

Converting in templating.py DateHTMLProperty.pretty() function from:
       if not self._value:
             return ''
       elif format is not self._marker:
            return self._value.local(offset).pretty(format)
       else:
           return self._value.local(offset).pretty()
to:
       if not self._value:
             return ''
       elif isinstance(self._value, str):
             return self._value
       elif format is not self._marker:
            return self._value.local(offset).pretty(format)
       else:
           return self._value.local(offset).pretty()

solve issue for me.

But  this  additional check must be copy-pasted in 
DateHTMLProperty.plain()
function     and    other.    It   is   hard   to   force myself to do
it.

There  is  a  20  entry  of  "  if  not  self.is_view_ok():"  check in
templating.py.

Is  there any plan to restructuring templating.py. What about to place
some common functionality to base HTMLproperty class?




Or,  may be somebody suggest another way to solve issue.
History
Date User Action Args
2014-04-25 13:00:02bersetmessageid: <1398430802.64.0.180308116184.issue2550612@psf.upfronthosting.co.za>
2014-04-25 13:00:02bersetrecipients: + ber, jerrykan, antmail
2014-04-25 13:00:02berlinkissue2550612 messages
2014-04-25 13:00:01bercreate