def reg(request):
    """Reg action"""
    data, code, valid = validator.create(request)

    if valid:
        if settings.ENV == 'production':
            try:
                data, code, user = resource.create(request)
            except:
                return {'code': 'account/create/fail'}, 404
        else:
            data, code, user = resource.create(request)

    return data, code
def create(request):
    """Create record"""

    data, code, valid = validator.create(request)

    if valid:
        if settings.ENV == 'production':
            try:
                data, code, item = resource.create(request)
            except:
                return {'code': 'html_cache/create/fail'}, 404
        else:
            data, code, item = resource.create(request)

    return data, code
def create(request):
    """Create record"""

    data, code, valid = validator.create(request)

    if valid:
        if settings.ENV == "production":
            try:
                data, code, item = resource.create(request)
            except:
                return {"code": "tag/create/fail"}, 404
        else:
            data, code, item = resource.create(request)

    return data, code
    def __init__(self, blueprintName):
        # self._apiurl = "http://127.0.0.1:1108/task"
        self._apiurl = "http://hypnos.innotechx.com/task"
        self._outputVideo = None
        self._outputAlpha = None

        self._bpDesc = blueprintDesc.create(blueprintName)
        self._outputDesc = None
        self._resource = resource.create()
        self._elements = []
        self._actions = []
        self._hypnosConfig = hypnosConfig.create()
        self._blueprint = None

        self._actionLevels = []
        self._levelConfigs = []
        self._resourceNameSet = set()

        # action name format
        self._actionNameFormat = "ACT-{}-{}-*{}-{}*"
        self._elementNameFormat = "ELE-{}-{}"
        self._resTrackFormat0 = "##TRACK-{}"
        self._resTrackFormat1 = "##TRACK-{}-{}"
        self._resElementFormat0 = "##ELEMENT-{}-{}"
        self._resElementFormat1 = "##ELEMENT-{}-{}-{}"
        self._resAlphaFormat0 = "##ALPHA-{}-{}"
        self._resAlphaFormat1 = "##ALPHA-{}-{}-{}"