Ejemplo n.º 1
0
    def _addTestIfNeeded(self, testName, branch, platform):

        def execute(id):
            test = Test.get_by_key_name(testName)
            returnValue = None
            if not test:
                test = Test(id=id, name=testName, key_name=testName)
                returnValue = test
            if branch.key() not in test.branches:
                test.branches.append(branch.key())
            if platform.key() not in test.platforms:
                test.platforms.append(platform.key())
            test.put()
            return returnValue
        createInTransactionWithNumericIdHolder(execute)
Ejemplo n.º 2
0
    def _createBranch(self, key, name):
        if not key or not name:
            return 'Invalid key or name'

        error = [None]

        def execute(id):
            if Branch.get_by_key_name(key):
                error[0] = 'Branch "%s" already exists' % key
                return
            branch = Branch(id=id, name=name, key_name=key)
            branch.put()
            return branch

        createInTransactionWithNumericIdHolder(execute)
        return error[0]
Ejemplo n.º 3
0
    def _createPlatform(self, key, name):
        if not key or not name:
            return 'Invalid key name'

        error = [None]

        def execute(id):
            if Platform.get_by_key_name(key):
                error[0] = 'Platform "%s" already exists' % key
                return
            platform = Platform(id=id, name=name, key_name=key)
            platform.put()
            return platform

        createInTransactionWithNumericIdHolder(execute)
        return error[0]