Skip to content

Conversation

@rambobinator
Copy link
Contributor

No description provided.

return self.create(payload, **kwargs)
except KeyError:
raise NotImplementedError("Clone method isn't yet available for {} service."
.format(self.service_name))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message isn't correlated to the actual error.

from thingy import Thingy

from appnexus.client import AppNexusClient, client, services_list
from appnexus.clone_mixin import CloneMixin, clone_services_unrequired_fields
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for a module just for this mixin. :)

if service_name in ("AdQualityRule", "Advertiser", "Campaign",
"Creative", "LineItem", "PaymentRule"):
ancestors.append(ProfileMixin)
if service_name in clone_services_unrequired_fields.keys():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if service_name in clone_services_unrequired_fields.keys():
if service_name in ("Advertiser"):

"Creative", "LineItem", "PaymentRule"):
ancestors.append(ProfileMixin)
if service_name in clone_services_unrequired_fields.keys():
ancestors.append(CloneMixin)
Copy link
Contributor

@ramnes ramnes Jul 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ancestors.append(CloneMixin)
ancestors.append(CloneMixin)
attrs["_unrequired_fields"] = clone_services_unrequired_fields[service_name]

ancestors.append(ProfileMixin)
if service_name in clone_services_unrequired_fields.keys():
ancestors.append(CloneMixin)
model = type(service_name, tuple(ancestors), {})
Copy link
Contributor

@ramnes ramnes Jul 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
model = type(service_name, tuple(ancestors), {})
model = type(service_name, tuple(ancestors), attrs)

try:
payload = {}
for field in self.__dict__.keys():
if field not in clone_services_unrequired_fields[type(self).__name__]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if field not in clone_services_unrequired_fields[type(self).__name__]:
if field not in self._unrequired_fields:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants