Proposal
def encode(self, value, mutation_context): child_data = self.get_child_data(mutation_context=mutation_context)
"Aligned" can't get child data using 'get_child_data' because of it has no stack menber.I suggest taking a approach like "Size" function to get the data associated with the request parameter.
Use-Case
My modified code is as follows:
def encode(self, value, mutation_context): if self.request is not None and self.block_name is not None: target_block = self.request.resolve_name(self.context_path,self.block_name) child_data = target_block.render(mutation_context=mutation_context) padding_length = self._modulus - (len(child_data) % self._modulus) a, b = divmod(padding_length, len(self._pattern)) # remove return child_data return self._pattern * a + self._pattern[:b] else: return
Anything else?
No response