Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@require(is_project_user())
@expose('spam.templates.libgroup.tabs.summary')
def summary(self):
"""Handle the 'summary' tab.
This tab offers a quick view on the current status of the libgroup.
"""
project = tmpl_context.project
user = tmpl_context.user
libgroup = tmpl_context.libgroup
# tmpl_context.b_libgroups_status = b_libgroups_status
# tmpl_context.b_categories_status = b_categories_status
# tmpl_context.b_tags = b_tags
tmpl_context.t_notes = t_notes
# cat_extra_data = dict(proj_id=libgroup.proj_id,
# container_type='libgroup', container_id=libgroup.id)
@require(is_project_user())
@with_trailing_slash
@expose('json')
@expose('spam.templates.tabbed_content')
def get_one(self, proj, sc, sh):
"""Return a `tabbed` page for shot tabs."""
shot = shot_get(proj, sc, sh)
tabs = [('Summary', 'tab/summary'),
('Assets', url('/asset/%s/shot/%s' %
(shot.project.id, shot.id))),
]
return dict(page='%s' % shot.path, shot=shot, tabs=tabs,
sidebar=('projects', shot.project.id))
@require(is_project_user())
@expose('spam.templates.notes.get_all')
def get_all(self, proj, annotable_id):
"""Return a html fragment with a list of notes for this object."""
annotable = annotable_get(annotable_id)
t_notes.value = annotable.notes
t_notes.update_filter = annotable.id
t_notes.extra_data = dict(proj=tmpl_context.project.id)
tmpl_context.t_notes = t_notes
return dict()
@require(is_project_user())
@expose('spam.templates.scene.get_all')
def get_all(self, proj):
"""Return a `tab` page with a list of scenes for a project and a
button to add new scenes.
This page is used as the `scenes` tab in the project view:
:meth:`spam.controllers.project.main.get_one`.
"""
project = tmpl_context.project
user = tmpl_context.user
t_scenes.value = project.scenes
t_scenes.extra_data = dict(project=project, user_id=user.user_id)
tmpl_context.t_scenes = t_scenes
return dict(page='scenes', sidebar=('projects', project.id))
@require(is_project_user())
@with_trailing_slash
@expose('json')
@expose('spam.templates.tabbed_content')
def get_one(self, proj):
"""Return a `tabbed` page for project tabs."""
project = tmpl_context.project
tabs = [('Summary', 'tab/summary'),
('Scenes', url('/scene/%s' % project.id)),
('Library', url('/libgroup/%s' % project.id)),
]
if is_project_admin():
tabs.append(('Users', 'tab/users'))
return dict(page='project/%s' % project.id, project=project, tabs=tabs,
sidebar=('projects', project.id))
@require(is_project_user())
@expose('spam.templates.project.tabs.summary')
def summary(self):
"""Handle the 'summary' tab.
This tab offers a quick view on the current status of the project.
"""
# tmpl_context.b_scenes_status = b_scenes_status
# tmpl_context.b_libgroups_status = b_libgroups_status
#project = tmpl_context.project
return dict()
@require(is_project_user())
@expose('spam.templates.shot.tabs.summary')
def summary(self):
"""Handle the 'summary' tab.
This tab offers a quick view on the current status of the shot.
"""
project = tmpl_context.project
user = tmpl_context.user
shot = tmpl_context.shot
# tmpl_context.b_categories_status = b_categories_status
# tmpl_context.b_tags = b_tags
tmpl_context.t_notes = t_notes
# cat_extra_data = dict(proj_id=shot.proj_id, container_type='shot',
# container_id=shot.id)
# tag_extra_data = dict(taggable_id=shot.id, user_id=user.user_id,
@require(is_project_user())
@expose('spam.templates.libgroup.get_all')
def get_subgroups(self, proj, parent_id):
"""Return a `tab` page with a list of subgroups for a libgroup.
This page is used as the `subgroups` tab in the libgroup view:
:meth:`spam.controllers.libgroup.main.get_one`.
"""
project = tmpl_context.project
user = tmpl_context.user
parent = libgroup_get(proj, parent_id)
tmpl_context.parent = parent
t_libgroups.value = parent.subgroups
t_libgroups.parent_id = parent_id
t_libgroups.extra_data = dict(project=project, user_id=user.user_id)
tmpl_context.t_libgroups = t_libgroups
@require(is_project_user())
@expose('spam.templates.scene.tabs.summary')
def summary(self):
"""Handle the 'summary' tab.
This tab offers a quick view on the current status of the scene.
"""
project = tmpl_context.project
user = tmpl_context.user
scene = tmpl_context.scene
# tmpl_context.b_shots_status = b_shots_status
# tmpl_context.b_tags = b_tags
# tag_extra_data = dict(taggable_id=scene.id, user_id=user.user_id,
# project=project)
t_notes.value = scene.notes
@require(is_project_user())
@expose()
def repo(self, *args):
"""
Return a file from the repository. We retrive file like that instead of
serving them statically so we can use authorization (a project file can
only be requested by a valid project user).
The path for the projects repository can be configured in the .ini file
with the "repository" variable.
"""
path = request.path
path = path.replace(url('/'), '')
path = path.replace('repo/', '')
path = os.path.join(G.REPOSITORY, path)
if not os.path.exists(path):
raise HTTPNotFound().exception