@@ -139,16 +139,16 @@ def _build_rec_dict(self, naming_map, appendTo):
139
139
140
140
def add_to_pack (self , pack , push = False ):
141
141
# This function adds records that will be pushed to (or updated from) the cloud, to the SenML pack.
142
- # NOTE: When adding records to be pushed to the cloud (push=True) Only initialized records are added
143
- # to the pack. And when adding records to be updated from the cloud (push=False), records whose values
144
- # are None are allowed to be added to the pack, so they can be initialized from the cloud.
142
+ # NOTE: When pushing records to the cloud (push== True) only fully initialized records are added to
143
+ # the pack. And when updating records from the cloud (push== False), partially initialized records
144
+ # are allowed in the pack, so they can be initialized from the cloud.
145
145
# NOTE: all initialized sub-records are added to the pack whether they changed their state since the
146
146
# last update or not, because the cloud currently does not support partial objects updates.
147
- if isinstance (self .value , dict ):
148
- for r in self .value . values () :
149
- if r . _value is not None or ( r ._value is None and not push ):
147
+ if isinstance (self ._value , dict ):
148
+ if not push or self .initialized :
149
+ for r in self ._value . values ( ):
150
150
pack .add (r )
151
- elif self . _value is not None or ( self ._value is None and not push ) :
151
+ elif not push or self ._value is not None :
152
152
pack .add (self )
153
153
self .updated = False
154
154
0 commit comments