本文整理汇总了Python中client.tactic_client_lib.TacticServerStub.get_widget方法的典型用法代码示例。如果您正苦于以下问题:Python TacticServerStub.get_widget方法的具体用法?Python TacticServerStub.get_widget怎么用?Python TacticServerStub.get_widget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类client.tactic_client_lib.TacticServerStub
的用法示例。
在下文中一共展示了TacticServerStub.get_widget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _test_csv_export
# 需要导入模块: from client.tactic_client_lib import TacticServerStub [as 别名]
# 或者: from client.tactic_client_lib.TacticServerStub import get_widget [as 别名]
def _test_csv_export(self):
from tactic.ui.widget import CsvExportWdg
view = 'table'
search_type ='sthpw/task'
search_view = 'auto_search:table'
#search_view = ''
simple_search_view = 'simple_search'
search_class =''
mode = 'export_matched'
element_name= 'project_tasks'
filter = [{"prefix":"main_body","main_body_enabled":"on","main_body_column":"project_code","main_body_relation":"is","main_body_value":"{$PROJECT}"}, {"prefix":"main_body","main_body_enabled":"on","main_body_column":"search_type","main_body_relation":"is not","main_body_value":"sthpw/project"}]
from pyasm.common import jsondumps, jsonloads
values = {'json': jsondumps(filter)}
element_names = ['code','id','description']
server = TacticServerStub(protocol='xmlrpc')
current_project = 'vfx'
server.set_project(current_project)
rtn = server.get_widget('tactic.ui.widget.CsvExportWdg', args={'search_type':search_type, 'view':view,\
'filter': filter, 'element_name': element_name, 'show_search_limit':'false', 'search_limit':-1, 'search_view':search_view, \
'element_names': element_names, 'mode':mode, 'search_class':search_class, 'simple_search_view':simple_search_view,\
'init_load_num':-1, 'test':True}, values=values )
expected_columns = ['code','id','description']
expected_sql = '''SELECT "sthpw"."public"."task".* FROM "sthpw"."public"."task" WHERE ( "task"."project_code" = \'%s\' AND ( "task"."search_type" != \'sthpw/project\' OR "task"."search_type" is NULL ) ) AND ("task"."s_status" != \'retired\' or "task"."s_status" is NULL) AND ("task"."s_status" != \'retired\' or "task"."s_status" is NULL) AND ("task"."s_status" != \'retired\' or "task"."s_status" is NULL) ORDER BY "task"."search_type", "task"."search_code"'''%current_project
expr = "@COUNT(sthpw/task['project_code','%s']['search_type','!=','sthpw/project])"%current_project
expected_count = Search.eval(expr, single=True)
rtn = jsonloads(rtn)
self.assertEquals(expected_columns, rtn.get('columns'))
self.assertEquals(expected_sql, rtn.get('sql'))
self.assertEquals(expected_count, rtn.get('count'))
mode = 'export_displayed'
selected_search_keys = ['sthpw/task?id=4385','sthpw/task?id=4386','sthpw/task?id=4387']
rtn = server.get_widget('tactic.ui.widget.CsvExportWdg', args={'search_type':search_type, 'view':view,\
'filter': filter, 'element_name': element_name, 'show_search_limit':'false', 'search_limit':-1, 'search_view':search_view, \
'element_names': element_names, 'mode':mode, 'search_class':search_class, 'simple_search_view':simple_search_view,\
'init_load_num':-1, 'test':True, 'selected_search_keys': selected_search_keys}, values=values )
expected_count = 3
rtn = jsonloads(rtn)
self.assertEquals(expected_columns, rtn.get('columns'))
self.assertEquals(expected_count, rtn.get('count'))