Skip to content

Attributes are not persisted when assigned on an object #35

@sjyn

Description

@sjyn

When a field on an object is assigned, the value is not persisted down to the values dict on the object. I suspect this is probably due to the fact that setattr is being used to populate the fields on initialization, so it's not able to be overloaded.
Unfortunately, this makes using the object basically useless, since they can't really be updated given the currently available methods.

Example:

subscription = chargebee.Subscription.retrieve('subscriptionId')
assert subscription.plan_id == 'oldPlanId'   # this passes
subscription.plan_id = 'newPlanId'
serializedSub = json.loads(str(subscription))
assert serializedSub['plan_id'] == 'newPlanId  # this fails

It would be nice to provide a way for the attributes of the object to be "serialized" into a dict that can be passed to the update call of a chargebee model, or implement some sort of update that can be called on the object itself, rather than passing in the id and update params.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions