mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-09 19:04:33 -04:00
This changeset copies everything in notifications_utils to turn into a local project module. It includes dependency changes to account for this adjustment and the notifications_utils tests. It also fixes all of the import statements. Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
32 lines
983 B
Python
32 lines
983 B
Python
from ordered_set import OrderedSet
|
|
|
|
from notifications_utils.insensitive_dict import InsensitiveDict
|
|
|
|
|
|
class TemplateChange:
|
|
def __init__(self, old_template, new_template):
|
|
self.old_placeholders = InsensitiveDict.from_keys(old_template.placeholders)
|
|
self.new_placeholders = InsensitiveDict.from_keys(new_template.placeholders)
|
|
|
|
@property
|
|
def has_different_placeholders(self):
|
|
return bool(self.new_placeholders.keys() ^ self.old_placeholders.keys())
|
|
|
|
@property
|
|
def placeholders_added(self):
|
|
return OrderedSet(
|
|
[
|
|
self.new_placeholders.get(key)
|
|
for key in self.new_placeholders.keys() - self.old_placeholders.keys()
|
|
]
|
|
)
|
|
|
|
@property
|
|
def placeholders_removed(self):
|
|
return OrderedSet(
|
|
[
|
|
self.old_placeholders.get(key)
|
|
for key in self.old_placeholders.keys() - self.new_placeholders.keys()
|
|
]
|
|
)
|