pombreda / formalchemy

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

TimeFieldRenderer incorrectly access form data #153

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. use model like this:

class MyModel(Base):
    __tablename__ = 'test_table'
    id = Column(Integer, primary_key=True)
    integer_field = Column(Integer, nullable=False)
    time_field = Column(TIME, nullable=False, index=True)

2. render FieldSet bounded with existed model (try to edit one of the database 
rows) 

3. put incorrect value to the "integer_field" (e.g. "foo") and submit

What is the expected output? What do you see instead?
1. as expected for "integer_field" there is error "Value is not an integer"
2. instead of unchanged time_field value in the form we can see "HH:MM:SS"

At the "_render" method of the TimeFieldRenderer, if "data" is not None, 
"_ternary" function assign tuple insted of string to the "hh", "mm" and "ss" 
variables

Please see attached file that fixes the problem.

Original issue reported on code.google.com by Maksim.K...@gmail.com on 3 Nov 2010 at 3:44

Attachments:

GoogleCodeExporter commented 9 years ago
applied, thanks

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