Mercurial > libervia-backend
comparison sat_frontends/jp/base.py @ 2704:ab37d1c7c38c
jp (base): new date_decoder to specify dates in arguments
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 01 Dec 2018 10:41:37 +0100 |
parents | 7d4679ee7ded |
children | 0bb811aaf11d |
comparison
equal
deleted
inserted
replaced
2703:3ba53b1cd1e6 | 2704:ab37d1c7c38c |
---|---|
33 from importlib import import_module | 33 from importlib import import_module |
34 from sat_frontends.tools.jid import JID | 34 from sat_frontends.tools.jid import JID |
35 from sat.tools import config | 35 from sat.tools import config |
36 from sat.tools.common import dynamic_import | 36 from sat.tools.common import dynamic_import |
37 from sat.tools.common import uri | 37 from sat.tools.common import uri |
38 from sat.tools.common import date_utils | |
38 from sat.core import exceptions | 39 from sat.core import exceptions |
39 import sat_frontends.jp | 40 import sat_frontends.jp |
40 from sat_frontends.jp.constants import Const as C | 41 from sat_frontends.jp.constants import Const as C |
41 from sat_frontends.tools import misc | 42 from sat_frontends.tools import misc |
42 import xml.etree.ElementTree as ET # FIXME: used temporarily to manage XMLUI | 43 import xml.etree.ElementTree as ET # FIXME: used temporarily to manage XMLUI |
133 | 134 |
134 | 135 |
135 def unicode_decoder(arg): | 136 def unicode_decoder(arg): |
136 # Needed to have unicode strings from arguments | 137 # Needed to have unicode strings from arguments |
137 return arg.decode(locale.getpreferredencoding()) | 138 return arg.decode(locale.getpreferredencoding()) |
139 | |
140 | |
141 def date_decoder(arg): | |
142 return date_utils.date_parse_ext(arg, default_tz=date_utils.TZ_LOCAL) | |
138 | 143 |
139 | 144 |
140 class Jp(object): | 145 class Jp(object): |
141 """ | 146 """ |
142 This class can be use to establish a connection with the | 147 This class can be use to establish a connection with the |