Adds 'Create Copy' feature to clone a watch (#184)
This commit is contained in:
committed by
GitHub
parent
54d80ddea0
commit
05f7e123ed
@@ -242,6 +242,27 @@ class ChangeDetectionStore:
|
||||
|
||||
self.needs_write = True
|
||||
|
||||
# Clone a watch by UUID
|
||||
def clone(self, uuid):
|
||||
with self.lock:
|
||||
new_uuid = str(uuid_builder.uuid4())
|
||||
_clone = deepcopy(self.data['watching'][uuid])
|
||||
_clone.update({'uuid': new_uuid})
|
||||
|
||||
attributes_to_reset = [
|
||||
'last_checked',
|
||||
'last_changed',
|
||||
'last_viewed',
|
||||
'newest_history_key',
|
||||
'previous_md5',
|
||||
'history'
|
||||
]
|
||||
for attribute in attributes_to_reset:
|
||||
_clone.update({attribute: self.generic_definition[attribute]})
|
||||
|
||||
self.data['watching'][new_uuid] = _clone
|
||||
self.needs_write = True
|
||||
|
||||
def url_exists(self, url):
|
||||
|
||||
# Probably their should be dict...
|
||||
|
||||
Reference in New Issue
Block a user