Previous topic

oyProjectManager.core.models.EnvironmentBase

Next topic

oyProjectManager.core.models.Sequence

This Page

oyProjectManager.core.models.Project

Inheritance diagram of oyProjectManager.core.models.Project

class oyProjectManager.core.models.Project(name, code=None, client=None)[source]

Bases: sqlalchemy.ext.declarative.Base

Manages project related data.

The Project class is in the center of the Asset Management system. Everything starts with the Project instance.

Creating a Project

All Projects have their own folder structure in the repository. Creating a Project instance is not enough to physically create the project folder structure. To make it happen the create() should be called to finish the creation process. This will both create the project folder and the general structure of the project and a .metadata.db file. Any Project, which has a .metadata.db file (thus a folder with a name of Project.name) considered an existing Project and Project.exists returns True.

A Project can not be created without a name or with a name which is None or with an invalid name. For example, a project with name “’^+’^” can not be created because the name will become an empty string after the name validation process.

The name of the project can freely be changed, but the path of the project will not change after the name of the project is changed.

Parameters:
  • name

    The name of the project. Should be a string or unicode. Name can not be None, a TypeError will be raised when it is given as None, can not be an empty string, a ValueError will be raised when it is an empty string.

    The given project name is validated against the following rules:

    • The name can only have a-z, A-Z, 0-9 and “-_” characters, all the other characters will be filtered out.
    • The name can only start with literals, no spaces, no numbers or any other character is not allowed.
    • Numbers and underscores are only be allowed if they are not the first letter.
  • code

    The code of the project. Should be a string or unicode. If given as None it will be generated from the name attribute. If it an empty string or become an empty string after validation a ValueError will be raised.

    • The name can only have A-Z and 0-9 and “_” characters, all the other chars are going to be filtered out.
    • The name can only start with literals, no spaces, no numbers or any other character is not allowed.
    • Numbers and underscores are only be allowed if they are not the first letter.
    • All the letters should be upper case.
    • All the minus (“-”) signs will be converted to underscores (“_”)
    • All the CamelCase formatting are expanded to underscore (CAMEL_CASE)

    The code is a read only attribute.

  • fps (int) – The frame rate in frame per second format. It is an integer. The default value is 25. It can be skipped. If set to None. The default value will be used.
__init__(name, code=None, client=None)[source]

Methods

__init__(name[, code, client])
create() Creates the project directory structure and saves the project, thus
query()
save() Saves the Project related information to the database.

Attributes

active
client
client_id
code Returns the code of this Project instance.
description
fps The frames per second setting of this project.
full_path The full_path of this project instance.
height
id
metadata A collection of Table objects and their associated schema constructs.
name
path The path of this project instance.
pixel_aspect
rev_number_padding
rev_number_prefix
sequences
shot_number_padding
shot_number_prefix
structure
ver_number_padding
ver_number_prefix
width
fps

The frames per second setting of this project. The default value is 25

save()[source]

Saves the Project related information to the database.

If there is no .metadata.db file it will be created, but be careful that the project structure will not be created. The safest way to both create the project structure and the .metadata.db file is to call the create() method.

create()[source]

Creates the project directory structure and saves the project, thus creates the .metadata.db file in the repository.

path[source]

The path of this project instance. Basically it is the same value with what $REPO env variable holds

full_path[source]

The full_path of this project instance.

code[source]

Returns the code of this Project instance.

The code attribute is read-only.

Returns:str