So "session" stuff gets pickled and unpicked which makes sense that dates 
might come back as strings.  What puzzles me is that it "used to work" so 
did pickled date objects used to come back as date objects again?  That 
would seem like a much bigger change than just this example.

-- Joe

On Tuesday, August 21, 2018 at 1:28:44 PM UTC-7, icodk wrote:
>
> Turned out that after the upgrade  the   form.vars.end_date and 
> form.vars.end_date(both 
> defined as type 'date') returns a data type str instead of a 'date' type
>
> The form definition is:
>
> form = SQLFORM.factory(
>     Field('start_date', 'date', label=T('Date range: '))
>     ,Field('end_date', 'date', label=T(''))
>     ,Field('amount',label=T('Total'),default=def_amount, widget=lambda f, v: 
> SQLFORM.widgets.string.widget(f, v, _disabled=True))
>     ,Field('online_order','boolean',label=T('Online 
> orders'),default=session.online_order)
>     ,Field('manual_order','boolean',label=T('Manual 
> orders'),default=session.manual_order)
>
>
> And then later the session vars gets 'infected'  as  str by the form.vars 
> that should return 'date'
>
> if form.process().accepted:
>     session.start_date=*form.vars.start_date *# here the form.vars.start_date 
> is of type str
>     session.end_date = *form.vars.end_date   *# here the form.vars.end_date 
> is of type str
>     session.online_order=form.vars.online_order
>     session.manual_order = form.vars.manual_order
>
>
>
>
>
>
>
> On Tuesday, August 21, 2018 at 12:56:34 PM UTC+2, icodk wrote:
>>
>> Have:
>>
>> session.end_date=request.now.date()
>>
>> and then retrieve it as:
>>
>> datetimeEnd=datetime.datetime.combine(session.end_date, datetime.time.max)
>>
>> this all worked fine in 2.14.6
>>
>> but after upgrade to 2.17.1 I get:
>>
>> datetimeEnd=datetime.datetime.combine(session.end_date, datetime.time.max)
>>
>> TypeError: combine() argument 1 must be datetime.date, not str
>>
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to