Skip to content

Instantly share code, notes, and snippets.

@cooncesean
Created January 30, 2014 05:06
Show Gist options
  • Save cooncesean/8702935 to your computer and use it in GitHub Desktop.
Save cooncesean/8702935 to your computer and use it in GitHub Desktop.
Parsing if/else logic.... not very scalable.
class ServiceSpecificSynchronizer(BaseSynchronizer):
...
def pull_data(self, user, content_type):
" Fetch data from the external service for the user and the specified content_type. "
response = self.client.read(user, content_type)
# Parse based on content type
if isinstance(content_object, SomeModel):
... parse this data like so ...
... create/update content object on our side ...
if isinstance(content_object, AnotherModel):
... parse this data like so ....
... create/update content object on our side ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment