Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Commit 0ded034

Browse files
committed
Add pickle support for atomx.models
1 parent 667373c commit 0ded034

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
of a :class:`atomx.models.ScheduledReport`
1717
- :meth:`atomx.Atomx.get` also accepts a model class or instance as resource argument.
1818
E.g.: ``atomx_api.get(atomx.models.Advertiser)`` or ``atomx_api.get(atomx.models.Advertiser(42))``
19+
- Add :mod:`pickle` support for :mod:`atomx.models`.
1920

2021

2122
1.4

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2015, Spot Media Solutions Sdn. Bhd. <daniel@atomx.com>
1+
Copyright (c) 2015-2016, Spot Media Solutions Sdn. Bhd. <daniel@atomx.com>
22

33
Permission to use, copy, modify, and/or distribute this software for any
44
purpose with or without fee is hereby granted, provided that the above

atomx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
__title__ = 'atomx'
2424
__version__ = VERSION
2525
__author__ = 'Spot Media Solutions Sdn. Bhd.'
26-
__copyright__ = 'Copyright 2015 Spot Media Solutions Sdn. Bhd.'
26+
__copyright__ = 'Copyright 2015-2016 Spot Media Solutions Sdn. Bhd.'
2727

2828
API_ENDPOINT = 'https://api.atomx.com/{}'.format(API_VERSION)
2929

atomx/models.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ def __repr__(self):
9595
def __eq__(self, other):
9696
return self.id == getattr(other, 'id', 'INVALID')
9797

98+
def __getstate__(self): # for pickle dump
99+
return self._attributes
100+
101+
def __setstate__(self, state): # for pickle load
102+
self.__init__(**state)
103+
104+
98105
@_class_property
99106
def _resource_name(cls):
100107
from atomx.utils import model_name_to_rest

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
'sphinx.ext.intersphinx',
3636
]
3737

38-
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None)}
38+
intersphinx_mapping = {'python': ('https://docs.python.org/3.5', None)}
3939

4040
# Add any paths that contain templates here, relative to this directory.
4141
templates_path = ['_templates']
@@ -53,7 +53,7 @@
5353

5454
# General information about the project.
5555
project = 'atomx-api-python'
56-
copyright = '2015, Spot Media Solutions Sdn. Bhd.'
56+
copyright = '2015-2016, Spot Media Solutions Sdn. Bhd.'
5757
author = 'Spot Media Solutions Sdn. Bhd.'
5858

5959
# The version info for the project you're documenting, acts as replacement for

0 commit comments

Comments
 (0)