コード例 #1
0
 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
コード例 #2
0
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
コード例 #3
0
 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())
コード例 #4
0
 def content_obj(self):
     return content.RegPatches()