stalker.models.structure.Structure¶
-
class
stalker.models.structure.
Structure
(templates=None, custom_template=None, **kwargs)[source]¶ Bases:
stalker.models.entity.Entity
Defines folder structures for
Projects
.Structures are generally owned by
Project
objects. Whenever aProject
is physically created, project folders are created by looking atStructure.custom_template
of theStructure
, theProject
object is generally given to theStructure
. So it is possible to use a variable like “{{project}}” or derived variables like:{% for seq in project.sequences %} {{do something here}}
Every line of this rendered template will represent a folder and Stalker will create these folders on the attached
Repository
.Parameters: - templates (list of
FilenameTemplate
s) – A list ofFilenameTemplate
s which defines a specific template for the givenFilenameTemplate.target_entity_type
s. - custom_template (str) –
A string containing several lines of folder names. The folders are relative to the
Project
root. It can also contain a Jinja2 Template code. Which will be rendered to show the list of folders to be created with the project. The Jinja2 Template is going to have the {{project}} variable. The important point to be careful about is to list all the custom folders of the project in a new line in this string. For example aStructure
for aProject
can have the followingStructure.custom_template
:ASSETS {% for asset in project.assets %} {% set asset_root = ‘ASSETS/’ + asset.code %} {{asset_root}} {% for task in asset.tasks %} {% set task_root = asset_root + ‘/’ + task.code %} {{task_root}} SEQUENCES {% for seq in project.sequences %}} {% set seq_root = ‘SEQUENCES/’ + {{seq.code}} %} {{seq_root}}/Edit {{seq_root}}/Edit/Export {{seq_root}}/Storyboard {% for shot in seq.shots %} {% set shot_root = seq_root + ‘/SHOTS/’ + shot.code %} {{shot_root}} {% for task in shot.tasks %} {% set task_root = shot_root + ‘/’ + task.code %} {{task_root}}
The above example has gone far beyond deep than it is needed, where it started to define paths for
Asset
s. Even it is possible to create aProject
structure like that, in general it is unnecessary. Because the above folders are going to be created but they are probably going to be empty for a while, because theAsset
s are not created yet (or in fact noVersion
s are created for theTask
s). Anyway, it is much suitable and desired to create this details by usingFilenameTemplate
objects. Which are specific to certainFilenameTemplate.target_entity_type
s. And by using theStructure.custom_template
attribute, Stalker can not place any source or output file of aVersion
in theRepository
where as it can by usingFilenameTemplate
s.But for certain types of
Task
s it is may be good to previously create the folder structure just because in certain environments (programs) it is not possible to run a Python code that will place the file in to the Repository like in Photoshop.The
custom_template
parameter can be None or an empty string if it is not needed.
A
Structure
can not be created without atype
(__strictly_typed__ = True). By giving atype
to theStructure
, you can create one structure for Commercials and another project structure for Movies and another one for Print projects etc. and can reuse them with newProject
s.-
__init__
(templates=None, custom_template=None, **kwargs)¶
Methods
__init__
([templates, custom_template])Attributes
created_by
The User
who has created this object.created_by_id
The id of the User
who has created this entity.custom_template
date_created
A datetime.datetime
instance showing the creation date and time of this object.date_updated
A datetime.datetime
instance showing the update date and time of this object.description
Description of this object. entity_groups
entity_id
entity_type
generic_data
This attribute can hold any kind of data which exists in SOM. generic_text
This attribute can hold any text. html_class
html_style
id
metadata
name
Name of this object nice_name
Nice name of this object. notes
All the Notes
s attached to this entity.plural_class_name
the plural name of this class query
structure_id
tags
A list of tags attached to this object. templates
thumbnail
thumbnail_id
tjp_id
returns TaskJuggler compatible id to_tjp
renders a TaskJuggler compliant string used for TaskJuggler type
The type of the object. type_id
The id of the Type
of this entity.updated_by
The User
who has updated this object.updated_by_id
The id of the User
who has updated this entity.-
date_created
¶ A
datetime.datetime
instance showing the creation date and time of this object.
-
date_updated
¶ A
datetime.datetime
instance showing the update date and time of this object.
-
description
¶ Description of this object.
-
generic_data
¶ This attribute can hold any kind of data which exists in SOM.
-
generic_text
¶ This attribute can hold any text.
-
name
¶ Name of this object
-
nice_name
¶ Nice name of this object.
It has the same value with the name (contextually) but with a different format like, all the white spaces replaced by underscores (“_”), all the CamelCase form will be expanded by underscore (_) characters and it is always lower case.
-
notes
¶ All the
Notes
s attached to this entity.It is a list of
Note
instances or an empty list, setting it to None will raise a TypeError.
-
plural_class_name
¶ the plural name of this class
A list of tags attached to this object.
It is a list of
Tag
instances which shows the tags of this object
-
tjp_id
¶ returns TaskJuggler compatible id
-
to_tjp
¶ renders a TaskJuggler compliant string used for TaskJuggler integration. Needs to be overridden in inherited classes.
-
type
¶ The type of the object.
It is a
Type
instance with a properType.target_entity_type
.
- templates (list of