stalker.models.repository.Repository

Inheritance diagram of stalker.models.repository.Repository
class stalker.models.repository.Repository(code='', linux_path='', windows_path='', osx_path='', **kwargs)

Bases: stalker.models.entity.Entity, stalker.models.mixins.CodeMixin

Manages fileserver/repository related data.

A repository is a network share that all users have access to.

A studio can create several repositories, for example, one for movie projects and one for commercial projects.

A repository also defines the default paths for linux, windows and mac foreshores.

The path separator in the repository is always forward slashes (“/”). Setting a path that contains backward slashes (“”), will be converted to a path with forward slashes.

New in version 0.2.24: Code attribute

Starting with v0.2.24 Repository instances have a new code attribute whose value is used by the stalker.models.studio.Studio to generate environment variables that contains the path of this stalker.models.repository.Repository (i.e. $REPOCP/path/to/asset.ma CP here is the Repository.code) so that instead of using absolute full paths one can use the make_relative` path to generate a universal path that can be used across OSes and different installations of Stalker.

Parameters:
  • code – The code of the stalker.models.repository.Repository. This attribute value is used by the stalker.models.studio.Studio to generate environment variables that contains the path of this Repository (i.e. $REPOCP/path/to/asset.ma) so that instead of using absolute full paths one can use the repository_relative path to generate a universal path that can be used across OSes and different installations of Stalker.
  • linux_path – shows the linux path of the repository root, should be a string
  • osx_path – shows the mac osx path of the repository root, should be a string
  • windows_path – shows the windows path of the repository root, should be a string
__init__(code='', linux_path='', windows_path='', osx_path='', **kwargs)

Methods

__init__([code, linux_path, windows_path, …])
find_repo(path) returns the repository from the given path
is_in_repo(path) Returns True or False depending of the given is in this repo or not
make_relative(path) makes the given path relative to the repository root
to_linux_path(path) Returns the linux version of the given path
to_native_path(path) Returns the native version of the given path
to_os_independent_path(path) Replaces the part of the given path with repository environment variable which makes the given path OS independent.
to_osx_path(path) Returns the osx version of the given path
to_windows_path(path) Returns the windows version of the given path

Attributes

code The code name of this object.
created_by The User who has created this object.
created_by_id The id of the User who has created 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.
entity_groups
entity_id
entity_type
env_var returns the env var of this repo
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
linux_path
metadata
name Name of this object
nice_name Nice name of this object.
notes All the Notess attached to this entity.
osx_path
path Returns the path for the current os
plural_class_name the plural name of this class
query
repository_id
tags A list of tags attached to this object.
thumbnail
thumbnail_id
tjp_id returns TaskJuggler compatible id
to_tjp renders a TaskJuggler compliant string used for TaskJuggler integration.
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.
windows_path
code

The code name of this object.

It accepts strings. Can not be None.

created_by

The User who has created this object.

created_by_id

The id of the User who has created 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.

env_var

returns the env var of this repo

classmethod find_repo(path)

returns the repository from the given path

Parameters:path (str) – path in a repository
Returns:stalker.models.repository.Repository
generic_data

This attribute can hold any kind of data which exists in SOM.

generic_text

This attribute can hold any text.

is_in_repo(path)

Returns True or False depending of the given is in this repo or not

Parameters:path – The path to be investigated
Returns:
make_relative(path)

makes the given path relative to the repository root

Parameters:path – The path to be made relative
Returns:str
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 Note instances or an empty list, setting it to None will raise a TypeError.

path

Returns the path for the current os

plural_class_name

the plural name of this class

tags

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_linux_path(path)

Returns the linux version of the given path

Parameters:path – The path that needs to be converted to linux path.
Returns:
to_native_path(path)

Returns the native version of the given path

Parameters:path – The path that needs to be converted to native path.
Returns:
classmethod to_os_independent_path(path)

Replaces the part of the given path with repository environment variable which makes the given path OS independent.

Parameters:path – path to make OS independent
Returns:
to_osx_path(path)

Returns the osx version of the given path

Parameters:path – The path that needs to be converted to osx path.
Returns:
to_tjp

renders a TaskJuggler compliant string used for TaskJuggler integration. Needs to be overridden in inherited classes.

to_windows_path(path)

Returns the windows version of the given path

Parameters:path – The path that needs to be converted to windows path.
Returns:
type

The type of the object.

It is a Type instance with a proper Type.target_entity_type.

type_id

The id of the Type of this entity. Mainly used by SQLAlchemy to create a Many-to-One relates between SimpleEntities and Types.

updated_by

The User who has updated this object.

updated_by_id

The id of the User who has updated this entity.