def applyAttributes(self, obj, attrs, codec=None): """ Applies the collection of attributes C{attrs} to aliased object C{obj}. Called when decoding reading aliased objects from an AMF byte stream. Override this to provide fine grain control of application of attributes to C{obj}. @param codec: An optional argument that will contain the en/decoder instance calling this function. """ if not self._compiled: self.compile() if not self.shortcut_decode: attrs = self.getDecodableAttributes(obj, attrs, codec=codec) else: if self.is_dict: obj.update(attrs) return if not self.sealed: obj.__dict__.update(attrs) return util.set_attrs(obj, attrs)
def applyAttributes(self, obj, attrs, codec=None): """ Applies the collection of attributes C{attrs} to aliased object C{obj}. Called when decoding reading aliased objects from an AMF byte stream. Override this to provide fine grain control of application of attributes to C{obj}. @param codec: An optional argument that will contain the en/decoder instance calling this function. """ attrs = self.getDecodableAttributes(obj, attrs, codec=codec) util.set_attrs(obj, attrs)
def applyAttributes(self, obj, attrs): """ Applies the collection of attributes C{attrs} to aliased object C{obj}. It is mainly used when reading aliased objects from an AMF byte stream. """ if 'static' in self.metadata: s, d = self.getAttrs(obj) if s is not None: for k in attrs.keys(): if k not in s: del attrs[k] util.set_attrs(obj, attrs)
def _readObject(self, obj, alias=None): obj_attrs = dict() key = self.readString().encode('utf8') while self.stream.peek() != TYPE_OBJECTTERM: obj_attrs[key] = self.readElement() key = self.readString().encode('utf8') # discard the end marker (TYPE_OBJECTTERM) self.stream.read(1) if alias: alias.applyAttributes(obj, obj_attrs, codec=self) else: util.set_attrs(obj, obj_attrs)
def applyAttributes(self, obj, attrs, codec=None): """ Applies the collection of attributes C{attrs} to aliased object C{obj}. It is mainly used when reading aliased objects from an AMF byte stream. @param codec: An optional argument that will contain the en/decoder instance calling this function. """ if 'static' in self.metadata: s, d = self.getAttrs(obj, codec=codec) if s is not None: for k in attrs.keys(): if k not in s: del attrs[k] util.set_attrs(obj, attrs)
def _readObject(self, obj, alias=None): ot = chr(ASTypes.OBJECTTERM) obj_attrs = dict() key = self.readString().encode("utf8") while self.stream.peek() != ot: obj_attrs[key] = self.readElement() key = self.readString().encode("utf8") # discard the end marker (ASTypes.OBJECTTERM) self.stream.read(len(ot)) if alias: alias.applyAttributes(obj, obj_attrs, codec=self) else: util.set_attrs(obj, obj_attrs)
def _readObject(self, obj, alias=None): ot = chr(ASTypes.OBJECTTERM) obj_attrs = dict() key = self.readString() while self.stream.peek() != ot: obj_attrs[key] = self.readElement() key = self.readString() # discard the end marker (ASTypes.OBJECTTERM) self.stream.read(len(ot)) if alias: alias.applyAttributes(obj, obj_attrs) else: util.set_attrs(obj, obj_attrs)