How to use the spam.lib.base.SPAMBaseController function in spam

To help you get started, we’ve selected a few spam examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lento / spam / spam / controllers / project / tabs.py View on Github external
from spam.lib.base import SPAMBaseController
from spam.model import session_get, Category, project_get
from spam.lib.predicates import is_project_user, is_project_admin
from spam.lib.widgets import TableProjectAdmins, TableProjectSupervisors
from spam.lib.widgets import TableProjectArtists
#from spam.lib.widgets import BoxLibgroupsStatus, BoxScenesStatus

# live widgets
#b_scenes_status = BoxScenesStatus()
#b_libgroups_status = BoxLibgroupsStatus()
t_project_admins = TableProjectAdmins()
t_project_supervisors = TableProjectSupervisors()
t_project_artists = TableProjectArtists()

class TabController(SPAMBaseController):
    """The controller for project tabs."""
    
    def _before(self, *args, **kw):
        proj = request.url.split('/')[-3]
        tmpl_context.project = project_get(proj)

    @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
github lento / spam / spam / controllers / shot / tabs.py View on Github external
from tg import expose, request, tmpl_context, require
from pylons.i18n import ugettext as _, lazy_ugettext as l_
from repoze.what import predicates

from spam.lib.base import SPAMBaseController
from spam.model import scene_get, shot_get
from spam.lib.predicates import is_project_user
from spam.lib.widgets import TableNotes
#from spam.lib.widgets import BoxTags, BoxCategoriesStatus

# live widgets
#b_categories_status = BoxCategoriesStatus()
#b_tags = BoxTags()
t_notes = TableNotes()

class TabController(SPAMBaseController):
    """The controller for shot tabs."""
    def _before(self, *args, **kw):
        proj, sc, sh = request.url.split('/')[-5:-2]
        shot = shot_get(proj, sc, sh)
        tmpl_context.project = shot.project
        tmpl_context.scene = shot.parent
        tmpl_context.shot = shot

    @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
github lento / spam / spam / controllers / scene / tabs.py View on Github external
from tg import expose, request, tmpl_context, require
from pylons.i18n import ugettext as _, lazy_ugettext as l_
from repoze.what import predicates

from spam.lib.base import SPAMBaseController
from spam.model import scene_get
from spam.lib.predicates import is_project_user
from spam.lib.widgets import TableNotes
#from spam.lib.widgets import BoxTags, BoxShotsStatus

# live widgets
#b_shots_status = BoxShotsStatus()
#b_tags = BoxTags()
t_notes = TableNotes(id='t_notes')

class TabController(SPAMBaseController):
    """The controller for scene tabs."""
    def _before(self, *args, **kw):
        proj, sc = request.url.split('/')[-4:-2]
        scene = scene_get(proj, sc)
        tmpl_context.project = scene.project
        tmpl_context.scene = scene

    @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
github lento / spam / spam / controllers / libgroup / tabs.py View on Github external
from pylons.i18n import ugettext as _, lazy_ugettext as l_
from repoze.what import predicates

from spam.lib.base import SPAMBaseController
from spam.model import libgroup_get
from spam.lib.predicates import is_project_user
from spam.lib.widgets import TableNotes
#from spam.lib.widgets import BoxTags, BoxLibgroupsStatus, BoxCategoriesStatus

# live widgets
#b_libgroups_status = BoxLibgroupsStatus()
#b_categories_status = BoxCategoriesStatus()
#b_tags = BoxTags()
t_notes = TableNotes()

class TabController(SPAMBaseController):
    """The controller for libgroup tabs."""
    def _before(self, *args, **kw):
        proj, libgroup_id = request.url.split('/')[-4:-2]
        libgroup = libgroup_get(proj, libgroup_id)
        tmpl_context.project = libgroup.project
        tmpl_context.libgroup = libgroup

    @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
github lento / spam / spam / controllers / root.py View on Github external
from repoze.what.predicates import not_anonymous

from spam.lib.base import SPAMBaseController
from spam.model import User, Group, Permission, Project
from spam.controllers.error import ErrorController
from spam.controllers.sandbox import SandboxController
from spam.controllers import user, category, tag, note, journal
from spam.controllers import project, scene, shot, asset, libgroup
from spam.lib.decorators import project_set_active
from spam.lib.predicates import is_project_user, is_project_admin


__all__ = ['RootController']


class RootController(SPAMBaseController):
    """
    The root controller for the SPAM application.
    
    It manages login and logout, parsed javascripts and upload-to/download-from
    the projects repository.
    All other functionalities are mounted as subcontrollers.
    """
    
    error = ErrorController()
    user = user.Controller()
    sandbox = SandboxController()
    project = project.Controller()
    scene = scene.Controller()
    shot = shot.Controller()
    asset = asset.Controller()
    category = category.Controller()
github lento / spam / spam / controllers / journal.py View on Github external
from tg import expose, url, tmpl_context, require
from tg.decorators import paginate
from pylons.i18n import ugettext as _, lazy_ugettext as l_
from sqlalchemy import desc
from spam.lib.base import SPAMBaseController
from spam.model import session_get, Journal
from spam.lib.widgets import TableJournal
from repoze.what.predicates import in_group

import logging
log = logging.getLogger(__name__)

# livetable widgets
t_journal = TableJournal()

class Controller(SPAMBaseController):
    """Controller for the journal"""
    
    @require(in_group('administrators'))
    @expose('spam.templates.journal')
    @paginate('journal', items_per_page=30)
    def index(self):
        """Return a `full` page with a paginated table of journal entries."""
        tmpl_context.t_journal = t_journal
        query = session_get().query(Journal)
        journal = query.order_by(desc('created'))
        return dict(page='user/journal', sidebar=('admin', 'journal'),
                                                                journal=journal)
github lento / spam / spam / controllers / sandbox.py View on Github external
"""Sandbox controller"""

import logging, os, time
from tg import request
from tg import url, expose, validate, tmpl_context
from spam.lib.base import SPAMBaseController
from spam.lib.widgets import TableScenes
from spam.model import project_get, shot_get, session_get, User
from spam.lib.widgets import TableUsers, TableGroupUsers

t_users = TableUsers(id='t_users')
t_scenes = TableScenes()

log = logging.getLogger(__name__)

class SandboxController(SPAMBaseController):
    """A testing and debugging environment.
    
    Sandbox methods are just quick tests for new features or for debugging
    errors.
    """
    
    @expose('spam.templates.sandbox.stomp')
    def stomp(self):
        return dict(page='sandbox/stomp')

    @expose('spam.templates.sandbox.location')
    def location(self, *args, **kwargs):
        return dict(page='sandbox/location', args=args, kwargs=kwargs)
    
    @expose('spam.templates.sandbox.scenes')
    def scenes(self, proj):
github lento / spam / spam / controllers / user / tabs.py View on Github external
#
"""User tabs"""

from tg import expose, request, tmpl_context, require
from pylons.i18n import ugettext as _, lazy_ugettext as l_
from repoze.what.predicates import in_group

from spam.lib.base import SPAMBaseController
from spam.model import session_get, User, user_get, Group
from spam.lib.widgets import TableUsers, TableGroupUsers

# livetable widgets
t_users = TableUsers()
t_group_users = TableGroupUsers()

class TabController(SPAMBaseController):
    """The controller for user tabs."""
    
    @require(in_group('administrators'))
    @expose('spam.templates.user.tabs.users')
    def users(self):
        """Handle the 'users' tab.
        
        This tab allows to add, remove and edit SPAM users. Users added here
        can then be assigned to a project as artists or supervisors in the
        project's ``users`` tab: :meth:`spam.controllers.project.tabs.users`.
        """
        tmpl_context.t_users = t_users
        users = session_get().query(User)
        return dict(users=users)

    @require(in_group('administrators'))
github lento / spam / spam / controllers / admin / admin.py View on Github external
from tg import expose
from spam.lib.base import SPAMBaseController
from spam.controllers.admin.projects import ProjectsController

__all__ = ['AdminController']


class AdminController(SPAMBaseController):

    projects = ProjectsController()
github lento / spam / spam / controllers / form.py View on Github external
from tg import url, expose, tmpl_context
from spam.lib.base import SPAMBaseController

__all__ = ['FormController']


class FormController(SPAMBaseController):
    pass