本文整理汇总了Python中tactic_client_lib.TacticServerStub.get方法的典型用法代码示例。如果您正苦于以下问题:Python TacticServerStub.get方法的具体用法?Python TacticServerStub.get怎么用?Python TacticServerStub.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tactic_client_lib.TacticServerStub
的用法示例。
在下文中一共展示了TacticServerStub.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GET
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
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 {}
示例2: execute
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
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
# get the script to run
script_code = my.data.get("script_code")
if script_code:
search_type = "config/custom_script"
search_key = server.build_search_key(search_type, script_code)
script_obj = server.get_by_search_key(search_key)
script = script_obj.get('script')
my.run_script(script)
else:
print "Nothing to run"
示例3: main
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
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,代码行数:29,代码来源:match_task_priority_with_order_priority_on_change.py
示例4: get_subject
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
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
示例5: get_client_img
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
def get_client_img(client_code):
img_path = ''
client_search = Search("twog/client")
client_search.add_filter('code', client_code)
client_search_object = client_search.get_sobject()
if client_search_object:
client_id = client_search_object.get_id()
snaps_s = Search("sthpw/snapshot")
snaps_s.add_filter('search_id', client_id)
snaps_s.add_filter('search_type', 'twog/client?project=twog')
snaps_s.add_filter('is_current', '1')
snaps_s.add_filter('version', '0', op='>')
snaps_s.add_where("\"context\" in ('publish','icon','MISC')")
snaps_s.add_order_by('timestamp desc')
snaps = snaps_s.get_sobjects()
if len(snaps) > 0:
server = TacticServerStub.get()
snap = snaps[0]
img_path = server.get_path_from_snapshot(snap.get_code(), mode="web")
if img_path:
img_path = 'http://' + server.get_server_name() + img_path
return img_path
else:
return None
示例6: execute
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
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'")
示例7: get_display
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
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
示例8: init
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
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')
示例9: accesshandler
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
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
示例10: get_to
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
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
示例11: log_message
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
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)
示例12: main
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
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()
示例13: update_related
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
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())
示例14: init
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
def init(my):
from client.tactic_client_lib import TacticServerStub
from pyasm.common import Environment
my.server = TacticServerStub.get()
my.sk = ''
my.code = ''
my.name = ''
示例15: add_task_to_component
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get [as 别名]
def add_task_to_component(self, process, component_code, login):
server = TacticServerStub.get()
component_search = Search('twog/component')
component_search.add_code_filter(component_code)
component = component_search.get_sobject()
server.insert('sthpw/task', {'process': process, 'login': login}, parent_key=component.get_search_key())