本文整理汇总了Python中tactic_client_lib.TacticServerStub类的典型用法代码示例。如果您正苦于以下问题:Python TacticServerStub类的具体用法?Python TacticServerStub怎么用?Python TacticServerStub使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TacticServerStub类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: GET
def GET(my):
method = my.kwargs.get("method")
print my.kwargs
print "method: ", method
print "expression: ", my.kwargs.get("expression")
# /rest/get_by_code/cars/CAR00009
# /rest/query?search_type=sthpw/cars
if method == "query":
code = my.kwargs.get("data")
from pyasm.search import Search
sobject = Search.get_by_code(search_type, code)
sobject_dict = sobject.get_sobject_dict()
return sobject_dict
# /rest/expression/@SOBJECT(sthpw/task)
elif method == "expression":
expression = my.kwargs.get("expression")
server = TacticServerStub.get()
return server.eval(expression)
# /rest/simple_checkin?search_key=dfadfdsas&data={}
elif method == "expression":
expression = my.kwargs.get("expression")
server = TacticServerStub.get()
return server.eval(expression)
return {}
开发者ID:0-T-0,项目名称:TACTIC,代码行数:31,代码来源:rest_handler.py
示例2: execute
def execute(my):
#protocol = 'xmlrpc'
protocol = 'local'
if protocol == 'local':
server = TacticServerStub.get()
else:
server = TacticServerStub(protocol=protocol,setup=False)
TacticServerStub.set(server)
project = my.data.get("project")
ticket = my.data.get("ticket")
assert project
assert ticket
server.set_server("localhost")
server.set_project(project)
server.set_ticket(ticket)
my.class_name = my.data.get('class_name')
assert my.class_name
my.kwargs = my.data.get('kwargs')
if not my.kwargs:
my.kwags = {}
#trigger = eval("%s(**my.kwargs)" % my.class_name)
trigger = Common.create_from_class_path(my.class_name, kwargs=my.kwargs)
input_data = my.get_input_data()
trigger.set_input(input_data)
trigger.execute()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:30,代码来源:subprocess_trigger.py
示例3: main
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,代码行数:27,代码来源:territory_table_insert.py
示例4: main
def main(args):
server = TacticServerStub(setup=False)
server.get_info_from_user(force=True)
return
"""
开发者ID:0-T-0,项目名称:TACTIC,代码行数:7,代码来源:get_ticket.py
示例5: get_element_eval_from_tactic_one
def get_element_eval_from_tactic_one(element_eval_code, username, password):
server = TacticServerStub(server='http://tactic01.2gdigital.com', project='twog', user=username,
password=password)
element_eval = server.eval("@SOBJECT(twog/element_eval['code', '{0}'])".format(element_eval_code))
element_eval_lines = server.eval("@SOBJECT(twog/element_eval_lines['element_eval_code', '{0}'])".format(element_eval_code))
element_eval_audio_lines = server.eval("@SOBJECT(twog/element_eval_audio['element_eval_code', '{0}'])".format(element_eval_code))
print(element_eval)
print(element_eval_lines)
print(element_eval_audio_lines)
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:11,代码来源:import_element_eval_from_tactic_one.py
示例6: post
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,代码行数:11,代码来源:element_evaluations.py
示例7: get
def get(self):
parser = reqparse.RequestParser()
parser.add_argument('token', required=True)
args = parser.parse_args()
ticket = args.get('token')
server = TacticServerStub(server=url, project=project, ticket=ticket)
element_evaluations = server.eval("@SOBJECT(twog/element_evaluation)")
return jsonify({'element_evaluations': element_evaluations})
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:12,代码来源:element_evaluations.py
示例8: main
def main(args):
usage = "USAGE: checkin.py <search_type> <code> [context] <path>\n"
usage += "example: python checkin.py beat Sc01.Bt01 .\\test\\image.png"
context = "publish"
# TODO: lots of assumptions here
if len(args) == 2:
# assume code and file path are equivalent
code = args[1]
file_path = args[1]
elif len(args) == 3:
code = args[1]
file_path = args[2]
elif len(args) == 4:
code = args[1]
context = args[2]
file_path = args[3]
else:
print usage
return
search_type = args[0]
server = TacticServerStub()
# do the actual work
server.start("Checked in file [%s] to [%s] - [%s]" % (file_path, search_type, code) )
try:
# query all of the search_types to simplify argument
if search_type.find("/") == -1:
columns = ["search_type"]
results = server.query("sthpw/search_object", columns=columns)
for result in results:
test = result.get("search_type")
if test.endswith("/%s" % search_type):
search_type = test
break
else:
raise Exception("Search type [%s] not found" % search_type)
search_key = server.build_search_key(search_type, code)
# upload the file
server.upload_file(file_path)
# checkin the uploaded file
result = server.simple_checkin(search_key, context, file_path)
except Exception, e:
server.abort()
print "ERROR: ", e.__str__()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:51,代码来源:checkin_pipeline.py
示例9: main
def main():
# get an instance of the stub
server = TacticServerStub()
# start the transaction
server.start("Set query")
try:
# define the search type we are searching for
search_type = "prod/asset"
# define a filter
filters = []
filters.append( ("asset_library", "chr") )
# do the query
assets = server.query(search_type, filters)
# show number found
print("found [%s] assets" % len(assets) )
# go through the asset and print the code
for asset in assets:
code = asset.get("code")
print(code)
except:
# in the case of an exception, abort all of the interactions
server.abort()
raise
else:
# otherwise, finish the transaction
server.finish()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:34,代码来源:query.py
示例10: execute
def execute(self):
# ensure that the protocol is "local"
server = TacticServerStub.get()
if server.get_protocol() != "local":
raise Exception("TacticServerStub protocol is not 'local'")
# test some inputs
is_insert = self.get_input_value("is_insert")
if is_insert != True:
raise Exception("is_insert != True")
is_insert = self.get_input_value("is_insert")
if is_insert != True:
raise Exception("is_insert != True")
search_key = self.get_input_value('search_key')
if search_key != 'unittest/person?project=unittest&code=fred':
raise Exception("search_key != 'unittest/person?project=unittest&code=fred'")
prev_data = self.get_input_value('prev_data')
if prev_data.get('code') != None:
raise Exception("prev_data['code'] != None")
prev_data = self.get_input_value('update_data')
if prev_data.get('code') != 'fred':
raise Exception("update_data['code'] != 'fred'")
开发者ID:mincau,项目名称:TACTIC,代码行数:26,代码来源:command_test.py
示例11: _execute
def _execute(self):
# get the server name
server_name = self.get_option("server_name")
if not server_name:
raise ClientCallbackException("No [server_name] option delivered to callback")
server_name = server_name[0]
# get the project
project_code = self.get_option("project_code")
if not project_code:
raise ClientCallbackException("No [project_code] option delivered to callback")
project_code = project_code[0]
# the entire pipeline is run in a TacticServer Transaction
from tactic_client_lib import TacticServerStub
self.server = TacticServerStub()
self.server.set_server(server_name)
self.server.set_ticket(self.ticket)
self.server.set_project(project_code)
self.server.start("Pipeline checkin")
try:
self.execute()
except Exception, e:
self.server.abort()
raise
开发者ID:Southpaw-TACTIC,项目名称:TACTIC,代码行数:29,代码来源:callback.py
示例12: get_to
def get_to(my):
from tactic_client_lib import TacticServerStub
from pyasm.common import Environment
recipients = set()
to = '[email protected]'
login_obj = Environment.get_login()
login = login_obj.get_login()
server = TacticServerStub.get()
eq = my.sobject
wo_code = eq.get_value('work_order_code')
if wo_code not in [None,'']:
wo = server.eval("@SOBJECT(twog/work_order['code','%s'])" % wo_code)
if wo:
wo = wo[0]
if wo.get('login') != login:
the_obj = Login.get_by_code(wo.get('login'))
if the_obj:
recipients.add(the_obj)
# creator_login_obj = server.eval("@SOBJECT(sthpw/login['login','%s'])" % wo.get('login'))
# if creator_login_obj:
# creator_login_obj = creator_login_obj[0]
# #to = creator_login_obj.get('email')
# to = creator_login_obj
print "RETURN Recipients: %s" % recipients
return recipients
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:26,代码来源:email_handler.py
示例13: get_display
def get_display(my):
from tactic_client_lib import TacticServerStub
server = TacticServerStub.get()
print "MY.KWARGS = %s" % my.kwargs
title_codes = my.kwargs.get('title_codes').split('|')
order_titles = {}
for title_code in title_codes:
title = server.eval("@SOBJECT(twog/title['code','%s'])" % title_code)
if title:
title = title[0]
order_code = title.get('order_code')
if order_code not in order_titles.keys():
order = server.eval("@SOBJECT(twog/order['code','%s'])" % order_code)[0]
order_titles[order_code] = {'order': order, 'titles': []}
order_titles[order_code]['titles'].append(title)
widget = DivWdg()
table = Table()
for order_code in order_titles.keys():
table.add_row()
table.add_cell('ORDER: %s' % order_titles[order_code]['order'].get('name'))
for title in order_titles[order_code]['titles']:
table.add_row()
title_name = title.get('title')
if title.get('episode') not in [None,'']:
title_name = '%s: %s' % (title_name, title.get('episode'))
table.add_cell('TITLE: %s' % title_name)
widget.add(table)
return widget
开发者ID:2gDigitalPost,项目名称:custom,代码行数:29,代码来源:calendar_delivery.py
示例14: accesshandler
def accesshandler(request):
cookies = Cookie.get_cookies(request)
# if login ticket cookie does not exist, then deny
if not cookies.has_key('login_ticket'):
# just refuse access
return apache.HTTP_FORBIDDEN
ticket = cookies['login_ticket'].value
if not ticket:
return apache.HTTP_FORBIDDEN
server = TacticServerStub.get(protocol='local')
expr = "@SOBJECT(sthpw/ticket['ticket','%s'])" % ticket
sobject = server.eval(expr, single=True)
now = SPTDate.now()
expiry = sobject.get("expiry")
if expiry and expiry < str(now):
return apache.HTTP_FORBIDDEN
request.add_common_vars()
path = str(request.subprocess_env['REQUEST_URI'])
if path == None:
return apache.HTTP_FORBIDDEN
# FIXME: find some mechanism which is more acceptable ... like /icons
#if path.find("_icon_") != -1:
# return apache.OK
return apache.OK
开发者ID:0-T-0,项目名称:TACTIC,代码行数:32,代码来源:asset_security.py
示例15: log_message
def log_message(my, sobject, process, status):
# need to use API for now
key = "%s|%s|status" % (sobject.get_search_key(), process)
from tactic_client_lib import TacticServerStub
server = TacticServerStub.get()
server.log_message(key, status)
开发者ID:jayvdb,项目名称:TACTIC,代码行数:7,代码来源:workflow.py
示例16: update_related
def update_related(self, login_group, prev_login_group):
'''Update related table login_in_group'''
search = Search('sthpw/login_in_group')
search.add_filter('login_group', prev_login_group)
login_in_groups = search.get_sobjects()
if login_in_groups:
server = TacticServerStub.get()
login_in_group_dict = {}
data = {
"login_group": login_group
}
for login_in_group in login_in_groups:
login_in_group_code = login_in_group.get("code")
login_in_group_sk = server.build_search_key("sthpw/login_in_group", login_in_group_code)
login_in_group_dict[login_in_group_sk] = data
try:
server.update_multiple(login_in_group_dict)
except Exception, e:
raise TacticException('Error updating login_in_group %s' % e.str())
开发者ID:mincau,项目名称:TACTIC,代码行数:25,代码来源:login_group_trigger.py
示例17: init
def init(my):
from client.tactic_client_lib import TacticServerStub
from pyasm.common import Environment
my.server = TacticServerStub.get()
my.login = Environment.get_login()
my.user = my.login.get_login()
my.movement_code = my.kwargs.get('movement_code')
开发者ID:2gDigitalPost,项目名称:custom,代码行数:7,代码来源:movement_maker.py
示例18: main
def main(args):
# USAGE: create_project.py <project_code> <project_title> <project_type>
project_code = args[0]
project_title = args[1]
project_type = args[2]
assert project_type in ['prod','flash','simple','unittest']
assert project_title
regexs = '^\d|\W'
m = re.search(r'%s' % regexs, project_code)
if m:
raise TacticApiException('<project_code> cannot contain special characters or start with a number.')
server = TacticServerStub.get();
# do the actual work
server.start("Create Project", "Project creation for [%s] of type [%s]" % (project_code, project_type))
try:
args = {
'project_code': project_code,
'project_title': project_title,
'project_type': project_type}
class_name = "tactic.command.CreateProjectCmd";
ret_val = server.execute_cmd(class_name, args=args);
print ret_val
except:
server.abort()
raise
else:
server.finish()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:33,代码来源:create_project.py
示例19: get_subject
def get_subject(my):
from tactic_client_lib import TacticServerStub
server = TacticServerStub.get()
eq = my.sobject
equipment_name = eq.get_value('name')
work_order_code = eq.get_value('work_order_code')
work_order = None
proj = None
title = None
order = None
if work_order_code not in [None,'']:
work_order = server.eval("@SOBJECT(twog/work_order['code','%s'])" % work_order_code)[0]
proj = server.eval("@SOBJECT(twog/proj['code','%s'])" % work_order.get('proj_code'))[0]
title = server.eval("@SOBJECT(twog/title['code','%s'])" % proj.get('title_code'))[0]
order = server.eval("@SOBJECT(twog/order['code','%s'])" % title.get('order_code'))[0]
po_number = ''
order_name = ''
title_title = ''
title_episode = ''
proj_code = ''
if order:
po_number = order.get('po_number')
order_name = order.get('name')
if title:
title_title = title.get('title')
title_episode = title.get('episode')
if proj:
proj_code = proj.get('code')
subject = 'Equipment Added by Operator in %s (%s), to %s: %s-%s-%s ' % (order_name, po_number, title_title, title_episode, proj_code, work_order_code)
return subject
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:31,代码来源:email_handler.py
示例20: main
def main(server=None, input_data=None):
if not input_data:
input_data = {}
if not server:
server = TacticServerStub.get()
input_sobject = input_data.get('sobject')
order_code = input_sobject.get('code')
priority = input_sobject.get('priority')
component_search = Search('twog/component')
component_search.add_filter('order_code', order_code)
component_sobjects = component_search.get_sobjects()
for component_sobject in component_sobjects:
tasks = get_task_sobjects_from_component_sobject(component_sobject)
data_to_insert = {}
for task in tasks:
task_search_key = server.build_search_key('sthpw/task', task.get_code(), project_code='twog')
data_to_insert[task_search_key] = {'priority': priority}
server.update_multiple(data_to_insert)
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:27,代码来源:match_task_priority_with_order_priority_on_change.py
注:本文中的tactic_client_lib.TacticServerStub类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论