Enforcing project and shot naming convention?
2 2

6 posts in this topic

Heya everyone,

Apologies for the rudimentary question.  Is it possible to enforce a naming convention for projects at creation time?  Ideally i'm hoping to use something like this as a filter:

re_valid_project_name = re.compile(r'^[0-9a-z_-]+\_\d{6}$')


For a brief time, I thought maybe http://ftrack.rtd.ftrack.com/en/3.5.0/developing/events/list.html#ftrack-validate would be what i'm after, but it seems that this event isn't published to the python api.

Any thoughts would be greatly appreciated.

Cheers,

G

ps: running 3.5.9 on a local deployment, in case it matters.

Share this post


Link to post
Share on other sites

For a local deployment it is possible to override the create project dialog with your own - and make the validations that way.  You can find more information here: http://ftrack.rtd.ftrack.com/en/stable/administering/managing_local_installation/configuring_server_options.html#override-the-default-create-project-behavior

Other alternatives are to setup an event listener and validate the project name. If not valide you can change it or ask the user to change it via a triggered action interface.

Share this post


Link to post
Share on other sites

Heya Mattias,

Thanks for the hint regarding the ftrack.create_project_action_identifier.  It works perfectly for our needs.

Any chance that such a facility exists for other entity types such as shot and sequence?
The closest I've been able to get thus far is listening for ftrack.update events and retroactively removing 'badly named' entities using

session.delete(pooly_named_entity)
session.commit()

Ideally, these entities would be prevented from being created in the first place.

G

Share this post


Link to post
Share on other sites

Hi,

Currently this does not exists for other entities, we are however discussing different approaches for allowing this in the future. In the meantime you could perhaps ( provided the entity was created through the web interface ) create send back some feedback to the user with something like:

        session.delete(
            task
        )

        event = ftrack_api.event.base.Event(
            topic='ftrack.action.trigger-user-interface',
            data={
                'type': 'message',
                'success': False,
                'message': 'Your task was incorrectly named'
            },
            target=(
                'applicationId=ftrack.client.web and user.id={0}'.format(
                    event['source']['user']['id']
                )
            )
        )

        session.event_hub.publish(
            event
        )

        session.commit()

 

cheers

Eric

Share this post


Link to post
Share on other sites

Thanks for the feedback Eric,

This is the path that I ended up taking, but, imo, it results in fairly poor UX.  the asset gets created, the 'green' notification fires', then a 'red' notification fires, and then the user is asked to refresh their browser.

If there's a vote being held anywhere, please put me down for a smoother UX option.

Cheers,

G

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
2 2