Draft
Conversation
ramnes
reviewed
Jul 31, 2019
| return self.create(payload, **kwargs) | ||
| except KeyError: | ||
| raise NotImplementedError("Clone method isn't yet available for {} service." | ||
| .format(self.service_name)) |
Contributor
There was a problem hiding this comment.
The message isn't correlated to the actual error.
ramnes
reviewed
Jul 31, 2019
| from thingy import Thingy | ||
|
|
||
| from appnexus.client import AppNexusClient, client, services_list | ||
| from appnexus.clone_mixin import CloneMixin, clone_services_unrequired_fields |
Contributor
There was a problem hiding this comment.
No need for a module just for this mixin. :)
ramnes
reviewed
Jul 31, 2019
| if service_name in ("AdQualityRule", "Advertiser", "Campaign", | ||
| "Creative", "LineItem", "PaymentRule"): | ||
| ancestors.append(ProfileMixin) | ||
| if service_name in clone_services_unrequired_fields.keys(): |
Contributor
There was a problem hiding this comment.
Suggested change
| if service_name in clone_services_unrequired_fields.keys(): | |
| if service_name in ("Advertiser"): |
ramnes
reviewed
Jul 31, 2019
| "Creative", "LineItem", "PaymentRule"): | ||
| ancestors.append(ProfileMixin) | ||
| if service_name in clone_services_unrequired_fields.keys(): | ||
| ancestors.append(CloneMixin) |
Contributor
There was a problem hiding this comment.
Suggested change
| ancestors.append(CloneMixin) | |
| ancestors.append(CloneMixin) | |
| attrs["_unrequired_fields"] = clone_services_unrequired_fields[service_name] |
ramnes
reviewed
Jul 31, 2019
| ancestors.append(ProfileMixin) | ||
| if service_name in clone_services_unrequired_fields.keys(): | ||
| ancestors.append(CloneMixin) | ||
| model = type(service_name, tuple(ancestors), {}) |
Contributor
There was a problem hiding this comment.
Suggested change
| model = type(service_name, tuple(ancestors), {}) | |
| model = type(service_name, tuple(ancestors), attrs) |
ramnes
reviewed
Jul 31, 2019
| try: | ||
| payload = {} | ||
| for field in self.__dict__.keys(): | ||
| if field not in clone_services_unrequired_fields[type(self).__name__]: |
Contributor
There was a problem hiding this comment.
Suggested change
| if field not in clone_services_unrequired_fields[type(self).__name__]: | |
| if field not in self._unrequired_fields: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.