How to use the spam.model.Category 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 / websetup / bootstrap.py View on Github external
naming_convention=u'^[a-zA-Z0-9_]+_PNT\.[a-zA-Z0-9]+$')
        session.add(paint)

        audio = model.Category(u'audio', ordering=8,
                        naming_convention=u'^[a-zA-Z0-9_]+_AUD\.[a-zA-Z0-9]+$')
        session.add(audio)

        animatic = model.Category(u'animatic', ordering=9,
                        naming_convention=u'^[a-zA-Z0-9_]+_A[23]D\.[a-zA-Z0-9]+$')
        session.add(animatic)

        layout = model.Category(u'layout', ordering=10,
                        naming_convention=u'^[a-zA-Z0-9_]+_LAY\.[a-zA-Z0-9]+$')
        session.add(layout)

        animation = model.Category(u'animation', ordering=11,
                        naming_convention=u'^[a-zA-Z0-9_]+_ANI\.[a-zA-Z0-9]+$')
        session.add(animation)

        effects = model.Category(u'effects', ordering=12,
                        naming_convention=u'^[a-zA-Z0-9_]+_FX\.[a-zA-Z0-9]+$')
        session.add(effects)

        render = model.Category(u'render', ordering=13,
                        naming_convention=u'^[a-zA-Z0-9_]+_RND\.#\.[a-zA-Z0-9]+$')
        session.add(render)

        compositing = model.Category(u'compositing', ordering=14,
                        naming_convention=u'^[a-zA-Z0-9_]+_CMP\.#\.[a-zA-Z0-9]+$')
        session.add(compositing)

        transaction.commit()
github lento / spam / spam / lib / notifications.py View on Github external
TOPIC_SCENES = config.get('topic_scenes', 'scenes')
TOPIC_SHOTS = config.get('topic_shots', 'shots')
TOPIC_ASSETS = config.get('topic_assets', 'assets')
TOPIC_LIBGROUPS = config.get('topic_libgroups', 'libgroups')
TOPIC_PROJECT_STRUCTURE = config.get('topic_project_structure',
    'projects_structure')
TOPIC_PROJECT_ADMINS = config.get('topic_project_admins', 'project_admins')
TOPIC_PROJECT_SUPERVISORS = config.get('topic_project_supervisors',
    'project_supervisors')
TOPIC_PROJECT_ARTISTS = config.get('topic_project_artists', 'project_artists')
TOPIC_JOURNAL = config.get('topic_journal', 'journal')
TOPIC_NOTES = config.get('topic_notes', 'notes')
TOPIC_TAGS = config.get('topic_tags', 'tags')

TOPICS = {User: TOPIC_USERS,
          Category: TOPIC_CATEGORIES,
          Project: TOPIC_PROJECTS_ACTIVE,
          Scene: TOPIC_SCENES,
          Shot: TOPIC_SHOTS,
          Asset: TOPIC_ASSETS,
          Libgroup: TOPIC_LIBGROUPS,
          Journal: TOPIC_JOURNAL,
          Note: TOPIC_NOTES,
          Tag: TOPIC_TAGS,
         }


class DummyClient(object):
    def send(self, *args, **kw):
        pass
github lento / spam / spam / model / helpers.py View on Github external
def category_get(category_id):
    """Return a asset category."""
    session = session_get()
    query = session.query(Category).filter_by(id=category_id.decode('utf-8'))
    try:
        return query.one()
    except NoResultFound:
        raise SPAMDBNotFound('Category "%s" could not be found.' % category_id)
    except MultipleResultsFound:
        raise SPAMDBError('Error when searching category "%s".' % category_id)
github lento / spam / spam / controllers / asset / main.py View on Github external
def new(self, proj, container_type, container_id, **kwargs):
        """Display a NEW form."""
        project = tmpl_context.project
        container = container_get(project.id, container_type, container_id)
        
        f_new.value = dict(proj=project.id,
                           container_type=container_type,
                           container_id=container_id,
                           project_name_=project.name,
                          )

        query = session_get().query(Category)
        categories = query.order_by('ordering', 'id')
        category_choices = ['']
        category_choices.extend([cat.id for cat in categories])
        f_new.child.children.category_id.options = category_choices

        tmpl_context.form = f_new
        return dict(title=_('Create a new asset'))
github lento / spam / spam / controllers / project / tabs.py View on Github external
def users(self):
        """Handle the 'users' tab.
        
        This tab allows to assign users to a category as artists or supervisors,
        and to define project administrators.
        """
        session = session_get()
        project = tmpl_context.project
        tmpl_context.t_project_admins = t_project_admins
        tmpl_context.t_project_supervisors = t_project_supervisors
        tmpl_context.t_project_artists = t_project_artists
        categories = session_get().query(Category)
        supervisors = {}
        for cat in categories:
            supervisors[cat.id] = project.supervisors[cat]
        artists = {}
        for cat in categories:
            artists[cat.id] = project.artists[cat]
        
        return dict(categories=categories, supervisors=supervisors,
                                                                artists=artists)
github lento / spam / spam / websetup / bootstrap.py View on Github external
import traceback
        log.info(traceback.format_exc())
        transaction.abort()
        log.info('Continuing with bootstrapping...')

    # default categories
    try:
        design = model.Category(u'design', ordering=1,
                        naming_convention=u'^[a-zA-Z0-9_]+_DRW\.[a-zA-Z0-9]+$')
        session.add(design)
        
        modelling = model.Category(u'model', ordering=2,
                        naming_convention=u'^[a-zA-Z0-9_]+_MDL\.[a-zA-Z0-9]+$')
        session.add(modelling)
        
        texture = model.Category(u'texture', ordering=3,
                        naming_convention=u'^[a-zA-Z0-9_]+_TEX\.[a-zA-Z0-9]+$')
        session.add(texture)
        
        rig = model.Category(u'rig', ordering=4,
                        naming_convention=u'^[a-zA-Z0-9_]+_RIG\.[a-zA-Z0-9]+$')
        session.add(rig)
        
        storyboard = model.Category(u'storyboard', ordering=5,
                        naming_convention=u'^[a-zA-Z0-9_]+_STB\.#\.[a-zA-Z0-9]+$')
        session.add(storyboard)

        plate = model.Category(u'plate', ordering=6,
                        naming_convention=u'^[a-zA-Z0-9_]+_PLT\.#\.[a-zA-Z0-9]+$')
        session.add(plate)

        paint = model.Category(u'paint', ordering=7,
github lento / spam / spam / websetup / bootstrap.py View on Github external
naming_convention=u'^[a-zA-Z0-9_]+_TEX\.[a-zA-Z0-9]+$')
        session.add(texture)
        
        rig = model.Category(u'rig', ordering=4,
                        naming_convention=u'^[a-zA-Z0-9_]+_RIG\.[a-zA-Z0-9]+$')
        session.add(rig)
        
        storyboard = model.Category(u'storyboard', ordering=5,
                        naming_convention=u'^[a-zA-Z0-9_]+_STB\.#\.[a-zA-Z0-9]+$')
        session.add(storyboard)

        plate = model.Category(u'plate', ordering=6,
                        naming_convention=u'^[a-zA-Z0-9_]+_PLT\.#\.[a-zA-Z0-9]+$')
        session.add(plate)

        paint = model.Category(u'paint', ordering=7,
                        naming_convention=u'^[a-zA-Z0-9_]+_PNT\.[a-zA-Z0-9]+$')
        session.add(paint)

        audio = model.Category(u'audio', ordering=8,
                        naming_convention=u'^[a-zA-Z0-9_]+_AUD\.[a-zA-Z0-9]+$')
        session.add(audio)

        animatic = model.Category(u'animatic', ordering=9,
                        naming_convention=u'^[a-zA-Z0-9_]+_A[23]D\.[a-zA-Z0-9]+$')
        session.add(animatic)

        layout = model.Category(u'layout', ordering=10,
                        naming_convention=u'^[a-zA-Z0-9_]+_LAY\.[a-zA-Z0-9]+$')
        session.add(layout)

        animation = model.Category(u'animation', ordering=11,
github lento / spam / spam / controllers / category.py View on Github external
def post(self, category_id, ordering=None, naming_convention=None):
        """Create a new category"""
        session = session_get()
        user = tmpl_context.user

        # add category to shared db
        category = Category(category_id, ordering=ordering,
                                            naming_convention=naming_convention)
        session.add(category)

        msg = '%s %s' % (_('Created category:'), category_id)

        # log into Journal
        journal.add(user, '%s - %s' % (msg, category))

        # notify clients
        updates = [dict(item=category, type='added', topic=TOPIC_CATEGORIES)]
        notify.send(updates)

        return dict(msg=msg, status='ok', updates=updates)
github lento / spam / spam / controllers / category.py View on Github external
def get_all(self):
        """Return a `full` page with a list of all categories and a button to
        add new categories."""
        query = session_get().query(Category)
        categories = query.order_by('ordering', 'id')

        t_categories.value = categories.all()
        tmpl_context.t_categories = t_categories
        return dict(page='admin/categories', sidebar=('admin', 'categories'))