Example #1
0
    def import_entry(self, data):
        project = Project.get_by(shotgun_id=data["shotgun_id"])

        if project is None:
            project = Project(**data)

            tree_name = current_app.config["DEFAULT_FILE_TREE"]
            try:
                project.file_tree = file_tree_service.get_tree_from_file(
                    tree_name)
            except WrongFileTreeFileException:
                current_app.logger.error(
                    "Can't find default file to set project file tree. Set "
                    "an empty file tree instead.")
                project.file_tree = {}

            project.save()
            current_app.logger.info("Project created: %s" % project)

        else:
            project.update(data)
            current_app.logger.info("Project updated: %s" % project)

        return project
Example #2
0
    def import_entry(self, data):
        project = Project.get_by(shotgun_id=data["shotgun_id"])

        if project is None:
            project = Project(**data)

            tree_name = current_app.config["DEFAULT_FILE_TREE"]
            project.file_tree = file_tree_service.get_tree_from_file(tree_name)

            project.save()
            current_app.logger.info("Project created: %s" % project)

        else:
            project.update(data)
            current_app.logger.info("Project updated: %s" % project)

        return project