pombreda / formalchemy

Automatically exported from code.google.com/p/formalchemy
MIT License
0 stars 0 forks source link

00:00 time gets rendered as empty string or unselected <select> #151

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. in model/__init__.py
timr = Table('timer', Base.metadata,
        Column('id_timer', Integer, primary_key=True),
        Column('ora', Time, unique=True),
    )

2. in websetup.py
timer = model.Timer(ora=datetime.time(0))
Session.add(timer)
Session.commit()

3. in form/__init__.py
TimerGrid = Grid(model.Timer)
TimerGridRO = Grid(model.Timer)
TimerGridRO.configure(readonly=True)

4. render both readonly and not in a page

What is the expected output? What do you see instead?
Time 00:00:00 is rendered as an empty string or unselected <select>

What version of the product are you using? On what operating system?
In [2]: formalchemy.__version__ 
Out[2]: '1.3.5'

In [4]: pylons.__version__ 
Out[4]: '1.0'

In [6]: sqlalchemy.__version__ 
Out[6]: '0.6.4'

Please provide any additional information below.

Original issue reported on code.google.com by neur...@gmail.com on 19 Oct 2010 at 9:59

GoogleCodeExporter commented 9 years ago
I forgot the model class:

class Timer(object):
    def __init__(self, **kwargs):
        self.__dict__.update(kwargs)

    def __unicode__(self):
        return unicode(str(self.ora))

    __str__ = __unicode__

I expected it would render like this
>>> import datetime
>>> unicode(str(datetime.time(0)))
u'00:00:00'

Original comment by neur...@gmail.com on 19 Oct 2010 at 10:03

GoogleCodeExporter commented 9 years ago
fixed. thanks

Original comment by gael.pas...@gmail.com on 11 Nov 2010 at 1:09