Skip to content

Commit 68df30d

Browse files
committed
[IMP] base_wamas_ubl dict item default value
1 parent 9a311d7 commit 68df30d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

base_wamas_ubl/lib/wamas/utils.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ def _set_string_date(val, length, dp, **kwargs):
133133

134134

135135
def _set_string_datetime(val, length, dp, **kwargs):
136-
res = isinstance(val, str) and val != "" and parse(val) or val
137-
136+
try:
137+
res = isinstance(val, str) and val != "" and parse(val) or val
138+
except:
139+
import pdb; pdb.set_trace()
138140
if isinstance(res, (date, datetime)):
139141
if kwargs.get("do_convert_tz", False):
140142
res = convert_tz(res, "UTC", DEFAULT_TIMEZONE)
@@ -299,9 +301,9 @@ def generate_wamas_dict(dict_item, grammar, **kwargs): # noqa: C901
299301
if isinstance(ubl_path, list):
300302
lst_val = []
301303
for _item in ubl_path:
302-
lst_val.append(dict_item.get(_item, ""))
304+
lst_val.append(dict_item.get(_item) or "")
303305
if lst_val:
304-
val = " ".join(lst_val)
306+
val = " ".join(lst_val).strip()
305307
elif isinstance(ubl_path, dict):
306308
for _key in ubl_path:
307309
if dict_item.get(_key, False):

0 commit comments

Comments
 (0)