Skip to content

Commit

Permalink
[IMP] base_wamas_ubl dict item default value
Browse files Browse the repository at this point in the history
  • Loading branch information
santostelmo committed Sep 10, 2024
1 parent 9a311d7 commit 68df30d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions base_wamas_ubl/lib/wamas/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,10 @@ def _set_string_date(val, length, dp, **kwargs):


def _set_string_datetime(val, length, dp, **kwargs):
res = isinstance(val, str) and val != "" and parse(val) or val

try:
res = isinstance(val, str) and val != "" and parse(val) or val
except:
import pdb; pdb.set_trace()

Check warning on line 139 in base_wamas_ubl/lib/wamas/utils.py

View check run for this annotation

Codecov / codecov/patch

base_wamas_ubl/lib/wamas/utils.py#L138-L139

Added lines #L138 - L139 were not covered by tests
if isinstance(res, (date, datetime)):
if kwargs.get("do_convert_tz", False):
res = convert_tz(res, "UTC", DEFAULT_TIMEZONE)
Expand Down Expand Up @@ -299,9 +301,9 @@ def generate_wamas_dict(dict_item, grammar, **kwargs): # noqa: C901
if isinstance(ubl_path, list):
lst_val = []
for _item in ubl_path:
lst_val.append(dict_item.get(_item, ""))
lst_val.append(dict_item.get(_item) or "")
if lst_val:
val = " ".join(lst_val)
val = " ".join(lst_val).strip()
elif isinstance(ubl_path, dict):
for _key in ubl_path:
if dict_item.get(_key, False):
Expand Down

0 comments on commit 68df30d

Please sign in to comment.