Skip to content

Commit f3e308d

Browse files
committed
use getattr to make code less
1 parent 92122ec commit f3e308d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

uliweb_apijson/apijson/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def _conver():
300300
nonlocal v
301301
if v and col.type.python_type==datetime:
302302
_v = v
303-
v = to_datetime(v,tzinfo=request.tzinfo if (request and hasattr(request,"tzinfo")) else None)
303+
v = to_datetime(v,tzinfo=getattr(request,"tzinfo",None))
304304
if v==None:
305305
raise UliwebError("'%s' cannot convert to datetime"%(_v))
306306
if c1=='>':

0 commit comments

Comments
 (0)