File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
mapswipe_workers/mapswipe_workers/utils Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -125,11 +125,16 @@ def remove_noise_and_add_user_info(json: dict) -> dict:
125125
126126 for feature in json ["features" ]:
127127 changeset = changeset_results [feature ["properties" ]["changesetId" ]]
128- # we need to replace " as this will cause problems when importing to postgres
129- feature ["properties" ]["username" ] = changeset ["username" ].replace ('"' , "" )
130128 feature ["properties" ]["userid" ] = changeset ["userid" ]
131- feature ["properties" ]["comment" ] = changeset ["comment" ].replace ('"' , "" )
132- feature ["properties" ]["created_by" ] = changeset ["created_by" ].replace ('"' , "" )
129+ for attribute_name in ["username" , "comment" , "created_by" ]:
130+ # we need to replace " as this will cause problems
131+ # when importing to postgres
132+ try :
133+ feature ["properties" ][attribute_name ] = changeset [
134+ attribute_name
135+ ].replace ('"' , "" )
136+ except AttributeError :
137+ pass
133138
134139 logger .info ("finished filtering and adding extra info" )
135140 if any (x > 0 for x in missing_rows .values ()):
You can’t perform that action at this time.
0 commit comments