def put(self, proj, libgroup_id, description=None): """Edit a libgroup""" session = session_get() user = tmpl_context.user libgroup = libgroup_get(proj, libgroup_id) old = libgroup.__dict__.copy() modified = False if description is not None and not libgroup.description == description: libgroup.description = description modified = True if modified: new = libgroup.__dict__.copy() msg = '%s %s' % (_('Updated libgroup:'), libgroup.path) # log into Journal journal.add(user, '%s - %s' % (msg, diff_dicts(old, new))) # notify clients updates = [ dict(item=libgroup, type='updated', topic=TOPIC_LIBGROUPS), ] notify.send(updates) return dict(msg=msg, status='ok', updates=updates) return dict(msg='%s %s' % (_('Libgroup is unchanged:'), libgroup.path), status='info', updates=[])
def put(self, proj, sc, description=None): """Edit a scene""" session = session_get() user = tmpl_context.user scene = scene_get(proj, sc) old = scene.__dict__.copy() modified = False if description is not None and not scene.description == description: scene.description = description modified = True if modified: new = scene.__dict__.copy() msg = '%s %s' % (_('Updated scene:'), scene.path) # log into Journal journal.add(user, '%s - %s' % (msg, diff_dicts(old, new))) # notify clients updates = [dict(item=scene, type='updated', topic=TOPIC_SCENES)] notify.send(updates) return dict(msg=msg, status='ok', updates=updates) return dict(msg='%s %s' % (_('Scene is unchanged:'), scene.path), status='info', updates=[])
def put(self, user_id, display_name=None): """Edit a user""" session = session_get() user = tmpl_context.user edituser = user_get(user_id) old = edituser.__dict__.copy() modified = False if display_name and not edituser.display_name == display_name: edituser.display_name = display_name modified = True if modified: new = edituser.__dict__.copy() msg = '%s %s' % (_('Updated user:'******'%s - %s' % (msg, diff_dicts(old, new))) # notify clients updates = [ dict(item=edituser, type='updated', topic=TOPIC_USERS) ] notify.send(updates) return dict(msg=msg, status='ok', updates=updates) return dict(msg='%s %s' % (_('User is unchanged:'), edituser.user_id), status='info', updates=[])
def put(self, proj, project_name=None, description=None): """Edit a project""" project = tmpl_context.project old = project.__dict__.copy() session = session_get() user = tmpl_context.user modified = False if project_name is not None and not project.name == project_name: project.name = project_name modified = True if description is not None and not project.description == description: project.description = description modified = True if modified: new = project.__dict__.copy() # invalidate cache project.touch() msg = "%s %s" % (_("Updated project:"), proj) # log into Journal journal.add(user, u"%s - %s" % (msg, diff_dicts(old, new))) # notify clients updates = [dict(item=project, type="updated", topic=TOPIC_PROJECTS_ACTIVE)] notify.send(updates) return dict(msg=msg, status="ok", updates=updates) return dict(msg="%s %s" % (_("Project is unchanged:"), proj), status="info", updates=[])
def put(self, category_id, ordering=None, naming_convention=None): """Edit a category""" session = session_get() user = tmpl_context.user category = category_get(category_id) old = category.__dict__.copy() modified = False if ordering is not None and not ordering == category.ordering: category.ordering = ordering modified = True if (naming_convention is not None and not naming_convention == category.naming_convention): category.naming_convention = naming_convention modified = True if modified: new = category.__dict__.copy() msg = '%s %s' % (_('Updated category:'), category_id) # log into Journal journal.add(user, '%s - %s' % (msg, diff_dicts(old, new))) # notify clients updates = [ dict(item=category, type='updated', topic=TOPIC_CATEGORIES) ] notify.send(updates) return dict(msg=msg, status='ok', updates=updates) return dict(msg='%s %s' % (_('Category is unchanged:'), category_id), status='info', updates=[])
def put(self, proj, sc, sh, description=None, action=None, frames=None, handle_in=None, handle_out=None): """Edit a shot""" session = session_get() user = tmpl_context.user shot = shot_get(proj, sc, sh) old = shot.__dict__.copy() modified = False if description is not None and not shot.description == description: shot.description = description modified = True if action is not None and not shot.action == action: shot.action = action modified = True if frames is not None and not shot.frames == frames: shot.frames = frames modified = True if handle_in is not None and not shot.handle_in == handle_in: shot.handle_in = handle_in modified = True if handle_out is not None and not shot.handle_out == handle_out: shot.handle_out = handle_out modified = True if modified: new = shot.__dict__.copy() msg = '%s %s' % (_('Updated shot:'), shot.path) # log into Journal journal.add(user, '%s - %s' % (msg, diff_dicts(old, new))) # notify clients updates = [dict(item=shot, type='updated', topic=TOPIC_SHOTS)] notify.send(updates) return dict(msg=msg, status='ok', updates=updates) return dict(msg='%s %s' % (_('Shot is unchanged:'), shot.path), status='info', updates=[])