Created
January 30, 2014 05:06
-
-
Save cooncesean/8702935 to your computer and use it in GitHub Desktop.
Parsing if/else logic.... not very scalable.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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