Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
annotable = annotable_get(annotable_id)
ob = annotable.annotated
note = Note(user, text)
annotable.notes.append(note)
session.refresh(annotable)
msg = '%s %s' % (_('Added note to:'), annotable.annotated.path)
updates = [dict(item=note, type='added', topic=TOPIC_NOTES,
filter=ob.annotable.id)]
if isinstance(ob, AssetVersion):
updates.append(dict(item=ob.asset, topic=TOPIC_ASSETS))
else:
updates.append(dict(item=ob, topic=TOPICS[ob.__class__]))
notify.send(updates)
return dict(msg=msg, status='ok', updates=updates)
session.delete(shot.annotable)
# invalidate project cache
project.touch()
msg = '%s %s' % (_('Deleted shot:'), shot.path)
# log into Journal
journal.add(user, '%s - %s' % (msg, shot))
# notify clients
updates = [
dict(item=shot, type='deleted', topic=TOPIC_SHOTS),
dict(item=project, type='updated', topic=TOPIC_PROJECT_STRUCTURE),
]
notify.send(updates)
return dict(msg=msg, status='ok', updates=updates)
repo.scene_create_dirs(project.id, scene)
# invalidate project cache
project.touch()
msg = '%s %s' % (_('Created scene:'), scene.path)
# log into Journal
journal.add(user, '%s - %s' % (msg, scene))
# notify clients
updates = [
dict(item=scene, type='added', topic=TOPIC_SCENES),
dict(item=project, type='updated', topic=TOPIC_PROJECT_STRUCTURE),
]
notify.send(updates)
return dict(msg=msg, status='ok', updates=updates)
removed_tags.append(tag)
# prepare updates
updates.append(dict(item=tag, type='deleted', topic=TOPIC_TAGS,
filter=taggable_id))
if removed_tags:
removed = ', '.join([t.id for t in removed_tags])
msg = '%s %s %s' % (removed,
n_('tag removed from:',
'tags removed from:', len(removed_tags)),
taggable_id)
status = 'ok'
# notify clients
notify.send(updates)
# log into Journal
journal.add(user, '%s - %s' % (msg, taggable.tagged))
else:
msg = _('No tag removed')
status = 'info'
return dict(msg=msg, status=status, updates=updates)
# prepare updates to notify clients
updates.append(dict(item=supervisor.user, type='added',
topic=TOPIC_PROJECT_SUPERVISORS,
filter='%s-%s' % (project.id, category.id)))
added = ', '.join(added)
if added:
# log into Journal
msg = '%s %s %s/%s' % (added,
n_('set as supervisor for:',
'set as supervisors for:', len(added)),
project.id, category.id)
journal.add(user, msg)
notify.send(updates)
return dict(msg=msg, status='ok', updates=updates)
return dict(msg='%s %s' % (
_('Selected users are already supervisors for:'), project.id),
status='info', updates=[])
session.delete(scene.annotable)
# invalidate project cache
project.touch()
msg = '%s %s' % (_('Deleted scene:'), scene.path)
# log into Journal
journal.add(user, '%s - %s' % (msg, scene))
# notify clients
updates = [
dict(item=scene, type='deleted', topic=TOPIC_SCENES),
dict(item=project, type='updated', topic=TOPIC_PROJECT_STRUCTURE),
]
notify.send(updates)
return dict(msg=msg, status='ok', updates=updates)