stalker.models.structure.Structure¶
-
class
stalker.models.structure.Structure(templates=None, custom_template=None, **kwargs)[source]¶ Bases:
stalker.models.entity.EntityDefines folder structures for
Projects.Structures are generally owned by
Projectobjects. Whenever aProjectis physically created, project folders are created by looking atStructure.custom_templateof theStructure, theProjectobject 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
FilenameTemplates) – A list ofFilenameTemplates which defines a specific template for the givenFilenameTemplate.target_entity_types. - custom_template (str) –
A string containing several lines of folder names. The folders are relative to the
Projectroot. 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 aStructurefor aProjectcan 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
Assets. Even it is possible to create aProjectstructure 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 theAssets are not created yet (or in fact noVersions are created for theTasks). Anyway, it is much suitable and desired to create this details by usingFilenameTemplateobjects. Which are specific to certainFilenameTemplate.target_entity_types. And by using theStructure.custom_templateattribute, Stalker can not place any source or output file of aVersionin theRepositorywhere as it can by usingFilenameTemplates.But for certain types of
Tasks 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_templateparameter can be None or an empty string if it is not needed.
A
Structurecan not be created without atype(__strictly_typed__ = True). By giving atypeto 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 newProjects.-
__init__(templates=None, custom_template=None, **kwargs)¶
Methods
__init__([templates, custom_template])Attributes
created_byThe Userwho has created this object.created_by_idThe id of the Userwho has created this entity.custom_templatedate_createdA datetime.datetimeinstance showing the creation date and time of this object.date_updatedA datetime.datetimeinstance showing the update date and time of this object.descriptionDescription of this object. entity_groupsentity_identity_typegeneric_dataThis attribute can hold any kind of data which exists in SOM. generic_textThis attribute can hold any text. html_classhtml_styleidmetadatanameName of this object nice_nameNice name of this object. notesAll the Notess attached to this entity.plural_class_namethe plural name of this class querystructure_idtagsA list of tags attached to this object. templatesthumbnailthumbnail_idtjp_idreturns TaskJuggler compatible id to_tjprenders a TaskJuggler compliant string used for TaskJuggler typeThe type of the object. type_idThe id of the Typeof this entity.updated_byThe Userwho has updated this object.updated_by_idThe id of the Userwho has updated this entity.-
date_created¶ A
datetime.datetimeinstance showing the creation date and time of this object.
-
date_updated¶ A
datetime.datetimeinstance 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
Notess attached to this entity.It is a list of
Noteinstances 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
Taginstances 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
Typeinstance with a properType.target_entity_type.
- templates (list of