You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def convert_exp_to_db(project, s):
"""
The argument is a plain reference field in export representation
(the reference is represented by the string domain:name).
The function converts it to database representation.
Invalid references raise an exception which must be handled by the caller.
"""
if s == '':
return None
m = pattern_ref_exp.match(s)
ref = m.group().split(':')
return SpecItem.objects.exclude(status='OBS').exclude(status='DEL').\
get(project_id=project.id, domain=ref[0], name=ref[1])
If I export a table where there are reference fields which are empty, the csv will have a value of 'None' for such cells. If I then import the same table, the function above will throw an exception when processing the cell with the 'None' value.
More generally, I need to modify this function to handle cases where there are invalid references.
The text was updated successfully, but these errors were encountered:
Consider the following function in
convert.py
:If I export a table where there are reference fields which are empty, the csv will have a value of 'None' for such cells. If I then import the same table, the function above will throw an exception when processing the cell with the 'None' value.
More generally, I need to modify this function to handle cases where there are invalid references.
The text was updated successfully, but these errors were encountered: