当前位置: 首页>>代码示例>>Python>>正文


Python TacticServerStub.insert方法代码示例

本文整理汇总了Python中tactic_client_lib.TacticServerStub.insert方法的典型用法代码示例。如果您正苦于以下问题:Python TacticServerStub.insert方法的具体用法?Python TacticServerStub.insert怎么用?Python TacticServerStub.insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tactic_client_lib.TacticServerStub的用法示例。


在下文中一共展示了TacticServerStub.insert方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import insert [as 别名]
def main(testing_flag):
    config = ConfigParser.ConfigParser()
    config.read('config.ini')

    # Get credentials from config file
    user = config.get('credentials', 'user')
    password = config.get('credentials', 'password')
    project = config.get('credentials', 'project')

    # If the testing flag is passed, use the test server, otherwise use the live server
    if testing_flag:
        url = config.get('server', 'test')
    else:
        url = config.get('server', 'live')

    # Get a server object to perform queries
    server = TacticServerStub(server=url, project=project, user=user, password=password)

    territories_str = 'Afghanistan|Aland Islands|Albania|Algeria|American Samoa|Andorra|Angola|Anguilla|Antigua and Barbuda|Argentina|Armenia|Aruba|Australia|Austria|Azerbaijan|Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bermuda|Bhutan|Bolivia|Bonaire|Bosnia and Herzegovina|Botswana|Bouvet Island|Brazil|Brunei Darussalam|Bulgaria|Burkina Faso|Burundi|Cambodia|Cameroon|Canada|Cantonese|Cape Verde|Cayman Islands|Central African Republic|Chad|Chile|China|Christmas Island|Cocos Islands|Colombia|Comoros|Congo|Dem. Rep. of Congo|Cook Islands|Costa Rica|Croatia|Cuba|Curacao|Cyprus|Czech|Denmark|Djibouti|Dominica|Dominican Republic|Ecuador|Egypt|El Salvador|English|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Falkland Islands|Faroe Islands|Fiji|Finland|France|French Guiana|French Polynesia|Gabon|Gambia|Georgia|Germany|Ghana|Gibraltar|Greece|Greek|Greenland|Grenada|Guadeloupe|Guam|Guatemala|Guernsey|Guinea|Guinea-Bissau|Guyana|Haiti|Honduras|Hong Kong|Hungary|Iceland|India|Indonesia|Iran|Iraq|Ireland|Isle of Man|Israel|Italy|Ivory Coast|Jamaica|Japan|Jersey|Jordan|Kazakhstan|Kenya|Kiribati|Kuwait|Kyrgyztan|Laos|Latin America|Latin Spanish|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luzembourg|Macao|Macedonia|Madagascar|Malawi|Malaysia|Maldives|Mali|Malta|Marshall Islands|Martinique|Mauritania|Mauritius|Mayotte|Mexico|Micronesia|Moldova|Monaco|Mongolia|Montenegro|Montserrat|Morocco|Mozambique|Multi-language|Myanmar|Namibia|Nauru|Nepal|Netherlands|New Caledonia|New Zealand|Nicaragua|Niger|Nigeria|Niue|Norfolk Island|North Korea|Northern Mariana Islands|Norway|Oman|Pakistan|Palau|Palestine|Panama|Papua New Guinea|Pan-Asia|Paraguay|Peru|Philippines|Pitcairn|Poland|Portugal|Puerto Rico|Qatar|Reunion|Romania|Russia|Russian|Rwanda|St Barthelemy|St Helena|St Kitts and Nevis|St Lucia|St Martin|St Pierre and Miquelo|St Vincent and Grenadines|Samoa|San Marino|Sao Tome and Principe|Saudi Arabia|Senegal|Serbia|Seychelles|Sierra Leone|Signapore|Sint Maarten|Slovakia|Slovenia|Solomon Islands|Somalia|South Africa|South Georgia and Swch Islands|South Korea|South Sudan|Spain|Sri Lanka|Sudan|Suriname|Svalbard|Swaziland|Sweden|Switzerland|Syria|Taiwan|Tajikistan|Tanzania|Thai|Thailand|Timor-Leste|Togo|Tokelau|Tonga|Trinidad and Tobago|Tunisia|Turkey|Turkmenistan|Turks and Caicos Islands|Tuvalu|Uganda|Ukraine|UAE|United Kingdom|United States|Uruguay|Uzbekistan|Vanuatu|Various|Vatican|Venezuela|Vietnam|Virgin Islands|Wallis and Futuna|West Indies|Western Sahara|Yemen|Zambia|Zimbabwe'
    territories = territories_str.split('|')

    for territory in territories:
        territory_search = server.eval("@SOBJECT(twog/territory['name', '{0}'])".format(territory))

        if not territory_search:
            # Territory does not exist yet, insert it
            server.insert('twog/territory', {'name': territory})
开发者ID:2gDigitalPost,项目名称:custom,代码行数:29,代码来源:territory_table_insert.py

示例2: main

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import insert [as 别名]
def main(testing_flag):
    config = ConfigParser.ConfigParser()
    config.read("config.ini")

    # Get credentials from config file
    user = config.get("credentials", "user")
    password = config.get("credentials", "password")
    project = config.get("credentials", "project")

    # If the testing flag is passed, use the test server, otherwise use the live server
    if testing_flag:
        url = config.get("server", "test")
    else:
        url = config.get("server", "live")

    # Get a server object to perform queries
    server = TacticServerStub(server=url, project=project, user=user, password=password)

    # Get titles marked as 'hot' items
    hot_titles = server.eval("@SOBJECT(twog/title['bigboard', 'True']['status', '!=', 'Completed'])")

    # Iterate through the titles, getting the client code and platform for each one
    for title in hot_titles:
        client_code = title.get("client_code")
        platform_name = title.get("platform")

        # Unfortunately, Titles hold the platform name, not the code, so a query has to be done to get that
        platform_code_search = server.eval("@SOBJECT(twog/platform['name', '{0}'])".format(platform_name))

        # This search returns a list (since multiple matches by 'name' is possible). Since this is just a quick, dirty
        # script to insert some example connections, we will take only the first result and ignore the rest.
        if platform_code_search:
            platform_code = platform_code_search[0].get("code")
        else:
            continue

        existing_connection_search = server.eval(
            "@SOBJECT(twog/client_platform['client_code', '{0}']['platform_code', '{1}'])".format(
                client_code, platform_code
            )
        )

        if not existing_connection_search:
            client_name_search = server.eval("@SOBJECT(twog/client['code', '{0}'])".format(client_code))

            if client_name_search:
                client_name = client_name_search[0].get("name")

                # Finally, insert the entry into the twog/client_platform table.
                server.insert(
                    "twog/client_platform",
                    {
                        "client_code": client_code,
                        "platform_code": platform_code,
                        "name": "{0} to {1}".format(client_name, platform_name),
                        "connection_status": "disconnected",
                    },
                )
开发者ID:2gDigitalPost,项目名称:custom,代码行数:60,代码来源:create_client_platform_connections_on_hot_today.py

示例3: post

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import insert [as 别名]
    def post(self):
        json_data = request.get_json()

        ticket = json_data.get('token')
        element_evaluation_data = json_data.get('element_evaluation')

        server = TacticServerStub(server=url, project=project, ticket=ticket)

        server.insert('twog/element_evaluation', element_evaluation_data)

        return jsonify({'status': 200})
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:13,代码来源:element_evaluations.py

示例4: _test_insert_trigger

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import insert [as 别名]
    def _test_insert_trigger(self):



        # create a db trigger
        sobject = Search.eval("@SOBJECT(sthpw/trigger['event','insert|unittest/person'])", single=True)
        if sobject:
            raise Exception('Please delete the insert|unittest/person trigger in sthpw first')
        trigger_sobj = SearchType.create("sthpw/trigger")
        trigger_sobj.set_value("event", "insert|unittest/person")
        trigger_sobj.set_value("class_name", "pyasm.command.command_test.TestInsertHandler")
        trigger_sobj.set_value("description", "Unittest Test Api Handler")
        trigger_sobj.commit()


        search = Search("sthpw/trigger")
        count = search.get_count()

        # use the client api to insert that trigger
        server = TacticServerStub(protocol='xmlrpc')

        server.start("insert trigger test")
        try:
            # create a new person
            search_type = "unittest/person"
            code = "fred"
            search_key = server.build_search_key(search_type, code)

            Container.put("TestApiHandler/search_key", search_key)
            # insert
            data = { 'code': code }

            # insert test: if the trigger fails then an exception should be
            # raised ...?
            server.insert(search_type, data)
        finally:
            server.abort()

        trigger_sobj.delete()

        search = Search('sthpw/trigger')
        search.add_filter('event', 'insert|unittest/person')
        trig = search.get_sobject()
        self.assertEquals(trig, None)
开发者ID:mincau,项目名称:TACTIC,代码行数:46,代码来源:command_test.py

示例5: _test_create_submission

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import insert [as 别名]
    def _test_create_submission(self):

        server = TacticServerStub()
        server.set_project("sample3d")

        # choose some arbitrary bin
        bin_id = 4
        filters = []


        # asset
        parent_type = "prod/asset"
        parent_code = "chr001"
        parent_key = server.build_search_key(parent_type, parent_code)
        parent = server.get_by_search_key(parent_key)
        parent_id = parent.get('id')

        # create a submission
        data = {
            'description': 'A test submission',
            'artist': 'joe',
            'context': 'model'
        }
        submission = server.insert("prod/submission", data, parent_key=parent_key)
        submission_key = submission.get('__search_key__')
        submission_id = submission.get('id')

        file_path = './miso_ramen.jpg'
        context = "publish"
        snapshot = server.simple_checkin(submission_key, context, file_path, mode="upload")

        # no connect to the bin with a connector
        data = {
            "bin_id": bin_id,
            'submission_id': submission_id
        }
        server.insert("prod/submission_in_bin", data)
开发者ID:Southpaw-TACTIC,项目名称:TACTIC,代码行数:39,代码来源:sample3d_test.py

示例6: main

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import insert [as 别名]
def main(args, login=None):
    # USAGE: checkin_render.py   
    type = args[0]
    if type == "shot":
        parent_search_type = "prod/shot"
    elif type == "asset":
        parent_search_type = "prod/asset"
    

    else:
        parent_search_type = type

    code = args[1]
    file_range = args[2]
    pattern = args[3]
    layer_name = ''
    context = 'publish'

    if type == "layer":
        parent_search_type = "prod/layer"
        code, layer_name = args[1].split('|')
        
    server = TacticServerStub(login)

    # do the actual work
    server.start("Checked in file group [%s] to %s [%s]" % (pattern,type,code))

    try:
        # checkin the uploaded file  
        filters = []
        if type=='layer':
            filters.append(('shot_code', code))
            filters.append(('name', layer_name))
        else:
            filters.append(('code', code))
        results = server.query(parent_search_type, filters)
       
        # take the first one
        if results:
            id = results[0].get('id')
        else:
            if type =='layer':
                print "%s Code [%s] name [%s] not found. Please insert an entry in TACTIC first." %(type, code, layer_name)
            else:
                print "%s Code [%s] not found. Please insert an entry in TACTIC first." %(type, code)
        search_type = server.build_search_type(parent_search_type)
        file_type = 'main'
        render_type = '' # not used yet
        # move the file
        dir = server.get_handoff_dir()
        paths = expand_paths(pattern, file_range)
        copy_file(paths, dir)

        file_name = os.path.basename(pattern)
        new_pattern =  '%s/%s' %(dir, file_name)
        print "Copied files to handoff dir\n"
        render = find_render(server, search_type, id, login, render_type)
        if not render:
            render_data = {
                'search_type': search_type,
                'search_id': id,
                'login': login
                #'type': render_type
            }
            render = server.insert("prod/render", render_data)
        
        # run group checkin
        server.group_checkin(render.get("__search_key__"), context=context, file_path=new_pattern, file_type=file_type, file_range=file_range)
        
    except:
        server.abort()
        raise
    else:
        server.finish()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:76,代码来源:checkin_render.py

示例7: ExpressionApiTest

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import insert [as 别名]
class ExpressionApiTest(unittest.TestCase):

    def setUp(self):
        pass

    def test_all(self):

        self.server = TacticServerStub()
        project_code = "unittest"
        self.server.set_project(project_code)

        self.server.start("Expression Test")
        try:
            self._setup()


            self._test_expression()

        except:
            self.server.abort()
            raise
        else:
            self.server.abort()


    def _setup(self):

        city_data = {
            'code': 'los_angeles'
        }

        search_type = "unittest/person"
        self.persons = []
        for i in range(0,4):
            data = {
                'name_first': 'person%s' % i,
                'name_last': 'Test',
                'city_code': 'los_angeles',
                'age': '25'
            }
            person = self.server.insert(search_type, data)
            self.persons.append( person )


    def _test_expression(self):

        # get the people sobjects
        expr = "@SOBJECT(unittest/person)"
        result = self.server.eval(expr)
        self.assertEquals(4, len(result))
        self.assertEquals("los_angeles", result[0].get("city_code") )

        # get a single person
        expr = "@SOBJECT(unittest/person)"
        result = self.server.eval(expr, single=True)
        self.assertEquals("los_angeles", result.get('city_code'))

        # get the first_name
        expr = "@GET(unittest/person.name_first)"
        names = self.server.eval(expr)
        self.assertEquals(len(names), 4)
        #self.assertEquals("person0", names[0])
        #self.assertEquals("person1", names[1])
 
 
        # count the number of people
        expr = "@COUNT(unittest/person)"
        count = self.server.eval(expr)
        self.assertEquals(4, count)

        # get the age of a person
        expr = "@GET(unittest/person.age)"
        age = self.server.eval(expr, self.persons[0], single=True)
        self.assertEquals(25, age)

      
        return
开发者ID:Southpaw-TACTIC,项目名称:TACTIC,代码行数:79,代码来源:expression_test.py

示例8: main

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import insert [as 别名]
def main(args, login=None):
    # USAGE: checkin_render_layer.py
    shot_code = args[0]
    layer_name = args[1]
    version = args[2]
    context = args[3]
    file_range = args[4]
    pattern = args[5]

    server = TacticServerStub(login)

    # do the actual work
    server.start("Checked in file group [%s] to shot [%s] layer [%s]" % (pattern, shot_code, layer_name))
    try:
        # move the file
        dir = server.get_handoff_dir()
        paths = expand_paths(pattern, file_range)
        move_file(paths, dir)

        file_name = os.path.basename(pattern)
        new_pattern = "%s/%s" % (dir, file_name)
        print "Files moved to handoff dir.\n"

        # checkin the moved files
        filters = []
        filters.append(("shot_code", shot_code))
        filters.append(("name", layer_name))
        results = server.query("prod/layer", filters)

        # take the first one
        if results:
            id = results[0].get("id")

        search_type = server.build_search_type("prod/layer")
        # find the layer snapshot
        filters = []
        filters.append(("version", version))
        filters.append(("search_type", search_type))
        filters.append(("search_id", id))
        # TODO : may need a context to search for the proper layer
        results = server.query("sthpw/snapshot", filters)
        snap_code = ""
        if results:
            snap_code = results[0].get("code")

        # find the render
        render = None
        filters = []
        filters.append(("search_type", search_type))
        filters.append(("search_id", id))
        filters.append(("snapshot_code", snap_code))
        results = server.query(SEARCH_TYPE, filters)
        if results:
            render = results[0]

        if not render:
            render_data = {"search_type": search_type, "search_id": id, "snapshot_code": snap_code}

            render = server.insert("prod/render", render_data)
        """
        results = server.query(SEARCH_TYPE, filters)
        render_id = 0
        if results:
            render_id = results[0].get('id')
        # find the render id    
        search_key = server.build_search_key(SEARCH_TYPE, render_id, column='id')
        """
        file_type = "main"

        # run group checkin
        server.group_checkin(
            render.get("__search_key__"),
            context=context,
            file_path=new_pattern,
            file_type=file_type,
            file_range=file_range,
        )

    except:
        server.abort()
        raise
    else:
        server.finish()
开发者ID:hellios78,项目名称:TACTIC,代码行数:85,代码来源:checkin_render_layer.py

示例9: TacticServerStub

# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import insert [as 别名]
import tacticenv
from tactic_client_lib import TacticServerStub

server = TacticServerStub(protocol="xmlrpc")
#server.set_project("sample3d")
server.set_ticket("60128265ebea63620de1f5b0ffc502eb")
search_type = "prod/shot"

server.start(title='cow')
sobject = server.insert(search_type, { 'description': 'wow'} )
server.update(search_key, { 'description': 'another update'} )
server.finish()

sobject = server.insert(search_type, { 'description': 'wow2'} )
sobject = server.insert(search_type, { 'description': 'wow3'} )



开发者ID:0-T-0,项目名称:TACTIC,代码行数:17,代码来源:transaction_test.py


注:本文中的tactic_client_lib.TacticServerStub.insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。