remove unneeded connector code

This commit is contained in:
Mouse Reeve 2020-05-10 14:56:53 -07:00
parent 7493abeb53
commit 4555d7713a
2 changed files with 3 additions and 10 deletions

View file

@ -267,19 +267,13 @@ def update_from_mappings(obj, data, mappings):
if key == 'id': if key == 'id':
continue continue
if has_attr(obj, key): try:
hasattr(obj, key)
except ValueError:
obj.__setattr__(key, formatter(value)) obj.__setattr__(key, formatter(value))
return obj return obj
def has_attr(obj, key):
''' helper function to check if a model object has a key '''
try:
return hasattr(obj, key)
except ValueError:
return False
def get_date(date_string): def get_date(date_string):
''' helper function to try to interpret dates ''' ''' helper function to try to interpret dates '''
if not date_string: if not date_string:

View file

@ -3,7 +3,6 @@ from dateutil import parser
from django.test import TestCase from django.test import TestCase
import json import json
import pathlib import pathlib
import pytz
from fedireads import models from fedireads import models
from fedireads.connectors.fedireads_connector import Connector from fedireads.connectors.fedireads_connector import Connector