equal
deleted
inserted
replaced
368 except ImportError: |
368 except ImportError: |
369 json_dumps = None |
369 json_dumps = None |
370 |
370 |
371 else: |
371 else: |
372 from logilab.common.date import ustrftime |
372 from logilab.common.date import ustrftime |
|
373 |
373 class CubicWebJsonEncoder(json.JSONEncoder): |
374 class CubicWebJsonEncoder(json.JSONEncoder): |
374 """define a json encoder to be able to encode yams std types""" |
375 """define a json encoder to be able to encode yams std types""" |
375 |
376 |
376 def default(self, obj): |
377 def default(self, obj): |
377 if hasattr(obj, 'eid'): |
378 if hasattr(obj, 'eid'): |
408 |
409 |
409 from logilab.common import date |
410 from logilab.common import date |
410 _THIS_MOD_NS = globals() |
411 _THIS_MOD_NS = globals() |
411 for funcname in ('date_range', 'todate', 'todatetime', 'datetime2ticks', |
412 for funcname in ('date_range', 'todate', 'todatetime', 'datetime2ticks', |
412 'days_in_month', 'days_in_year', 'previous_month', |
413 'days_in_month', 'days_in_year', 'previous_month', |
413 'next_month', 'first_day', 'last_day', 'ustrftime', |
414 'next_month', 'first_day', 'last_day', |
414 'strptime'): |
415 'strptime'): |
415 msg = '[3.6] %s has been moved to logilab.common.date' % funcname |
416 msg = '[3.6] %s has been moved to logilab.common.date' % funcname |
416 _THIS_MOD_NS[funcname] = deprecated(msg)(getattr(date, funcname)) |
417 _THIS_MOD_NS[funcname] = deprecated(msg)(getattr(date, funcname)) |