def merge_changes(self, document_number, changes): patches = content.RegPatches().get(document_number) if patches: changes = copy.copy(changes) for key in patches: if key in changes: changes[key].extend(patches[key]) else: changes[key] = patches[key] return changes
def merge_changes(document_number, changes): """Changes can be present in the notice or in an external set inside the `content` module. If any are present in the latter, they extend the former""" patches = content.RegPatches().get(document_number) if patches: changes = copy.copy(changes) for key in patches: if key in changes: changes[key].extend(patches[key]) else: changes[key] = patches[key] return changes
def invalidate_by_notice(self, notice): """Using the notice structure, invalidate based on the 'changes' field""" self.invalidate([key for key in notice.get('changes', {})]) patches = content.RegPatches().get(notice['document_number'], {}) self.invalidate(patches.keys())
def content_obj(self): return content.RegPatches()