25 Commits

Author SHA1 Message Date
04761f09c6 Use remove_private_keys() instead of popping predefined keys 2019-05-31 17:02:48 +02:00
c8eec9fa9d Added pickle support for Resource classes, albeit a bit hacky.
Unpickling requires the class to be known, so we can't simply use to_dict()
to pickle and pass the dict to __init__() to unpickle. This works for the
pickled object itself (as pickle restores its type), but fails to restore
the class of subobjects, such as some_node.picture. This is why the code
now pickles each subobject too.
2017-09-19 13:43:48 +02:00
cfcaf96ac6 Removed Resource.from_dict(), it was never used and is broken in Python 3. 2017-09-19 12:25:43 +02:00
3c39506014 Allow PATCHing nodes. 2016-07-28 11:28:32 +02:00
50cefd49d4 Using HTTP OPTIONS call for Project.node_type_has_method() 2016-07-13 16:02:55 +02:00
1bcbd866ce PEP8 formatting 2016-07-13 15:10:22 +02:00
cdb68fbcf7 Ensure Resource.find_first returns an object of the correct type. 2016-06-17 14:29:16 +02:00
7b96aa656b Separated api.get() from utils.convert_datetime() call.
Both are equally likely to fail, so now we can see which from the stack
trace and the line number.
2016-05-31 17:58:13 +02:00
72499b6fbb Added Resource.new(dict_or_resource) class method.
This allows one to up-cast a Resource to a File, Project, Node, etc.
2016-05-31 17:57:40 +02:00
2d195c7cd3 Added User.me() and Find.find_from_endpoint() class methods. 2016-05-23 14:19:14 +02:00
3e223bcc9f Added List.all_from_endpoint(url) function.
This is useful when resources should be loaded from a custom Pillar
endpoint.
2016-05-18 13:02:26 +02:00
99d46593bf made "'field' in resource" work 2016-05-10 15:02:27 +02:00
e088b56560 Pop more _deleted attributes. 2016-05-02 17:43:06 +02:00
463eb068f6 Ensuring more projections 2016-04-13 15:31:58 +02:00
2c39a88cfe Removed unused import 2016-03-22 12:42:13 +01:00
914e8f9eaa Moved _ensure_projections(...) up from Find to Resource
It's now also used in List
2016-03-18 10:59:57 +01:00
6ff7adeb27 Use utils.remove_none_attributes in more methods 2016-03-09 16:56:50 +01:00
8c34f04bc6 Adds generic way of adding extra projections to Pillar queries 2016-03-09 14:00:33 +01:00
1a1c2c51fe Added parameter support to Resource.find()
This makes the overrides in subclasses unnecessary
2016-03-09 12:41:52 +01:00
bc1a146ef2 New remove_none_attributes utility
Returns a new dict with all None values removed.
2016-03-05 23:18:40 +01:00
c2db3eb4cd Fixes for mixing exception call 2015-11-05 00:23:20 +01:00
227d13c45f Added function to rebuild Resource from a dictionary 2015-11-04 12:54:55 +01:00
c1ff4ba9bb Introducing convert_datetime function
Starting from an JSON object, find and replace the _create and _updated
keys with actual datetime objects.
2015-10-20 13:03:34 +02:00
3d392b3b13 Added find_one as a resource class method 2015-10-19 19:09:48 +02:00
991cc27e30 Renaming to Pillar SDK. 2015-08-31 19:25:01 +02:00