本文整理汇总了Python中pyasm.biz.Project类的典型用法代码示例。如果您正苦于以下问题:Python Project类的具体用法?Python Project怎么用?Python Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Project类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: create_set
def create_set(my, ticket, project_code, set_name, cat_name, selected):
'''an xml to create a new set node'''
xml = ''
asset_code = ''
try:
my.init(ticket)
Project.set_project(project_code)
cmd = MayaSetCreateCmd()
cmd.set_set_name(set_name)
cmd.set_cat_name(cat_name)
Command.execute_cmd(cmd)
asset_code = cmd.get_asset_code()
if asset_code:
cmd = CreateSetNodeCmd()
cmd.set_asset_code(asset_code)
cmd.set_instance(set_name)
cmd.set_contents(selected)
cmd.execute()
execute_xml = cmd.get_execute_xml()
xml = execute_xml.get_xml()
finally:
DbContainer.close_all()
return [xml, asset_code]
开发者ID:0-T-0,项目名称:TACTIC,代码行数:27,代码来源:base_xmlrpc.py
示例2: update_session
def update_session(my, ticket, project_code, user, pid, data):
try:
my.init(ticket)
Project.set_project(project_code)
# get the session sobject
sobject = None
search = Search("prod/session_contents", project_code=project_code)
search.add_filter("login", user)
search.add_filter("pid", pid)
sobject = search.get_sobject()
# if none exists, then create one
if sobject == None:
search_type = SearchType.build_search_type('prod/session_contents', project_code)
sobject = SearchType.create(search_type)
sobject.set_value("login", user)
sobject.set_value("pid", pid)
sobject.set_value("data", data)
impl = search.get_database_impl()
sobject.set_value("timestamp", impl.get_timestamp_now(), quoted=False)
sobject.commit()
finally:
DbContainer.close_all()
return True
开发者ID:0-T-0,项目名称:TACTIC,代码行数:29,代码来源:base_xmlrpc.py
示例3: test_all
def test_all(my):
try:
db_res = DbResource.get_default('unittest')
sql = DbContainer.get(db_res)
impl = sql.get_database_impl()
db_type = impl.get_database_type()
if db_type == "PostgreSQL":
my.prefix = '''"unittest"."public"'''
my.sthpw_prefix = '''"sthpw"."public"'''
else:
my.prefix = '''"unittest"'''
my.sthpw_prefix = '''"sthpw"'''
my._test_get_connect()
my._test_select_class()
my._test_insert_class()
my._test_update_class()
my._test_insert_and_delete()
my._test_create_table()
my._test_transaction()
my._test_order_by()
my._test_rpn_filters()
my._test_search_filter()
my._test_join()
my._test_add_drop_column()
finally:
Project.set_project('unittest')
my.test_env.delete()
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:34,代码来源:sql_test.py
示例4: setUp
def setUp(my):
# start batch environment
Batch()
from pyasm.biz import Project
Project.set_project("unittest")
开发者ID:hellios78,项目名称:TACTIC,代码行数:7,代码来源:relationship_test.py
示例5: init
def init(self):
web = WebContainer.get_web()
project_code = web.get_form_value("project")
if project_code:
Project.set_project(project_code)
method = web.get_form_value("method")
widget_class = web.get_form_value("widget")
if widget_class == "":
return
arg_type = web.get_form_value("arg_type")
if arg_type == "dict" and not method:
args = web.get_form_args()
exec(Common.get_import_from_class_path(widget_class))
widget = eval("%s.init_dynamic(args)" % widget_class)
elif method:
widget = Common.create_from_method(widget_class, method)
else:
widget_args = web.get_form_values(WebEnvironment.ARG_NAME)
widget = Common.create_from_class_path(widget_class, widget_args)
# tell the widget that it is the top widget
widget.set_as_top()
self.add(widget)
开发者ID:mincau,项目名称:TACTIC,代码行数:28,代码来源:base_sthpw_wdg.py
示例6: get_application_wdg
def get_application_wdg(self):
page = None
try:
project = Project.get()
except Exception as e:
Project.set_project("sthpw")
from pyasm.widget import Error404Wdg
page = Error404Wdg()
page.set_message(e.__str__())
page.status = ''
application = self.get_top_wdg()
# get the main page widget
# NOTE: this needs to happen after the body is put in a Container
if not page:
page = self.get_page_widget()
page.set_as_top()
if type(page) in types.StringTypes:
page = StringWdg(page)
application.add(page, 'content')
return application
开发者ID:mincau,项目名称:TACTIC,代码行数:28,代码来源:top_wdg.py
示例7: test_all
def test_all(self):
batch = Batch()
Environment.get_security().set_admin(True)
from pyasm.unittest import UnittestEnvironment, Sample3dEnvironment
test_env = UnittestEnvironment()
test_env.create()
sample3d_env = Sample3dEnvironment(project_code='sample3d')
sample3d_env.create()
Project.set_project("unittest")
try:
self.access_manager = Environment.get_security().get_access_manager()
self._test_all()
finally:
# Reset access manager for tear down
Environment.get_security()._access_manager = self.access_manager
Environment.get_security().reset_access_manager()
self._tear_down()
Environment.get_security().set_admin(True)
test_env.delete()
Environment.get_security().set_admin(True)
sample3d_env.delete()
Site.pop_site()
开发者ID:mincau,项目名称:TACTIC,代码行数:26,代码来源:security_test.py
示例8: _test_join
def _test_join(my):
""" test a select """
Project.set_project('unittest')
select = Select()
db_res = DbResource.get_default('unittest')
select.set_database(db_res)
select.add_table("person")
select.add_join('person','city', 'city_code','code')
select.add_join('city','country', 'country_code','code')
select.add_order_by("name_last")
statement = select.get_statement()
my.assertEquals(statement, '''SELECT %s"person".* FROM %s"person" LEFT OUTER JOIN %s"city" ON "person"."city_code" = "city"."code" LEFT OUTER JOIN %s"country" ON "city"."country_code" = "country"."code" ORDER BY "person"."name_last"''' % (my.prefix, my.prefix, my.prefix, my.prefix) )
search = Search('unittest/person')
search.add_join('unittest/city', 'unittest/person')
statement = search.get_statement()
my.assertEquals(statement, '''SELECT %s"person".* FROM %s"person" LEFT OUTER JOIN %s"city" ON "person"."city_code" = "city"."code"''' % (my.prefix,my.prefix, my.prefix))
statement = search.get_statement()
# this one has no schema connection, so will be ignored
search.add_join('sthpw/login', 'unittest/person')
my.assertEquals(statement, '''SELECT %s"person".* FROM %s"person" LEFT OUTER JOIN %s"city" ON "person"."city_code" = "city"."code"''' % (my.prefix, my.prefix, my.prefix))
search.add_join('unittest/country', 'unittest/city')
statement = search.get_statement()
my.assertEquals(statement, '''SELECT %s"person".* FROM %s"person" LEFT OUTER JOIN %s"city" ON "person"."city_code" = "city"."code" LEFT OUTER JOIN %s"country" ON "city"."country_code" = "country"."code"''' % (my.prefix, my.prefix, my.prefix, my.prefix) )
开发者ID:0-T-0,项目名称:TACTIC,代码行数:28,代码来源:sql_test.py
示例9: checkin_shot_set
def checkin_shot_set(my, ticket, project_code, shot_code, process, context, \
checkin_as, currency, unknown_ref, desc):
snapshot_code = ''
try:
my.init(ticket)
Project.set_project(project_code)
shot = Shot.get_by_code(shot_code)
checkin = ShotCheckin(shot)
checkin.set_description(desc)
checkin.set_process(process)
checkin.set_context(context)
is_current = True
if currency == 'False':
is_current = False
is_revision = False
if checkin_as == 'Revision':
is_revision = True
checkin.set_current(is_current)
checkin.set_revision(is_revision)
checkin.set_option("unknown_ref", unknown_ref)
Command.execute_cmd(checkin)
snapshot_code = checkin.snapshot.get_code()
finally:
DbContainer.close_all()
return snapshot_code
开发者ID:0-T-0,项目名称:TACTIC,代码行数:31,代码来源:base_xmlrpc.py
示例10: checkin_textures
def checkin_textures(my, ticket, project_code, asset_code, paths, file_ranges, node_names, attrs, use_handoff_dir=False, md5s=[]):
'''creates a number of textures under a single asset'''
new_paths = []
try:
my.init(ticket)
Project.set_project(project_code)
parent = Asset.get_by_code(asset_code)
#parent = Search.get_by_search_key(search_key)
context = 'publish'
checkin = TextureCheckin(parent, context, paths, file_ranges, node_names, attrs, use_handoff_dir=use_handoff_dir, md5s=md5s)
Command.execute_cmd(checkin)
new_paths = checkin.get_texture_paths()
#md5_list = checkin.get_texture_md5()
file_code_list = checkin.get_file_codes()
#loader_context = ProdLoaderContext()
#updater = loader_context.get_updater(snapshot, asset_code, instance)
#execute_xml = updater.get_execute_xml()
#xml = execute_xml.to_string()
finally:
DbContainer.close_all()
return new_paths, file_code_list
开发者ID:0-T-0,项目名称:TACTIC,代码行数:26,代码来源:base_xmlrpc.py
示例11: import_default_side_bar
def import_default_side_bar(self):
code = Search.eval("@GET(config/widget_config['code','WIDGET_CONFIG000000'].code)", single=True)
if code:
print "Default side bar already exists!"
return
project_code = self.kwargs.get('project_code')
# It looks like project=XXX on SearchType.create does not work
Project.set_project(project_code)
config = SearchType.create("config/widget_config?project=%s" % project_code)
config.set_value("code", "WIDGET_CONFIG000000")
config.set_value("category", "SideBarWdg")
config.set_value("search_type", "SideBarWdg")
config.set_value("view", "project_view")
xml = '''<?xml version='1.0' encoding='UTF-8'?>
<config>
<project_view>
<element name='_home' title='Examples'/>
</project_view>
</config>
'''
config.set_value("config", xml)
config.commit()
开发者ID:mincau,项目名称:TACTIC,代码行数:26,代码来源:create_project_cmd.py
示例12: test_all
def test_all(self):
Batch()
from pyasm.web.web_init import WebInit
WebInit().execute()
test_env = UnittestEnvironment()
test_env.create()
self._test_command()
self._test_trigger()
trigger_key = "triggers:cache"
Container.put(trigger_key, None)
try:
self._test_api_trigger()
self._test_insert_trigger()
# test copy project from template
self._test_copy_project()
# clear again for subsequent Client API test
trigger_key = "triggers:cache"
Container.put(trigger_key, None)
trigger_key2 = Trigger.KEY
Container.put(trigger_key2, None)
finally:
Project.set_project('unittest')
test_env.delete()
开发者ID:mincau,项目名称:TACTIC,代码行数:29,代码来源:command_test.py
示例13: test_all
def test_all(my):
'''entry point function'''
my.description = "Checkin unit test"
my.errors = []
Batch()
# FIXME: this is needed for the triggers to be registerd. These
# triggers have nothing to do with the web
from pyasm.web import WebInit
WebInit().execute()
test_env = UnittestEnvironment()
test_env.create()
Project.set_project("unittest")
try:
Command.execute_cmd(my)
# undo the command
undo = UndoCmd()
undo.execute()
finally:
test_env.delete()
开发者ID:blezek,项目名称:TACTIC,代码行数:27,代码来源:checkin_test.py
示例14: _test_copy_project
def _test_copy_project(self):
#transaction = Transaction.get(create=True)
try:
os.system('dropdb -U postgres "game_copy"')
from tactic.command import ProjectTemplateInstallerCmd
cmd = ProjectTemplateInstallerCmd(project_code='game_copy', template_code='game', mode='copy')
cmd.execute()
schema_entry = Search.eval("@GET(sthpw/schema['code','game_copy'].code)", single=True)
self.assertEquals(schema_entry, 'game_copy')
project_entry = Search.eval("@GET(sthpw/project['code','game_copy'].code)", single=True)
self.assertEquals(project_entry, 'game_copy')
Project.set_project('game_copy')
widget_config_st = Search.eval("@GET(config/widget_config['code','1GAME'].search_type)", single=True)
self.assertEquals(widget_config_st, 'game/ticket')
widget_config_counts = Search.eval("@COUNT(config/widget_config)")
self.assertEquals(widget_config_counts, 133)
Project.set_project('unittest')
finally:
sql = DbContainer.get('sthpw')
sql.do_update("delete from project where code ='game_copy'")
sql.do_update("delete from schema where code ='game_copy'")
sql.commit()
DbContainer.close_all()
os.system('dropdb -U postgres "game_copy"')
开发者ID:mincau,项目名称:TACTIC,代码行数:31,代码来源:command_test.py
示例15: test_all
def test_all(self):
'''entry point function'''
self.description = "Checkin unit test"
self.errors = []
Batch()
# FIXME: this is needed for the triggers to be registerd. These
# triggers have nothing to do with the web
from pyasm.web import WebInit
WebInit().execute()
test_env = UnittestEnvironment()
test_env.create()
self.transaction = Transaction.get(create=True)
Project.set_project("unittest")
try:
#Command.execute_cmd(self)
# undo the command
#undo = UndoCmd()
#undo.execute()
self.execute()
finally:
self.transaction.rollback()
test_env.delete()
开发者ID:mincau,项目名称:TACTIC,代码行数:30,代码来源:checkin_test.py
示例16: test_all
def test_all(self):
print "Running Sample3d Test"
from pyasm.security import Batch
from pyasm.biz import Project
Batch()
Project.set_project("sample3d")
#self.server = TacticServerStub(protocol="local")
self.server = TacticServerStub(protocol="xmlrpc")
project_code = "sample3d"
self.server.set_project(project_code)
self.server.start("Sample3d Test")
try:
self._test_create_search_type()
self._test_create_submission()
self._test_get_submission()
self._test_shot_sequence_hierarchy()
self._test_query_snapshots()
#self._test_performance()
except Exception:
self.server.abort()
raise
self.server.abort()
开发者ID:Southpaw-TACTIC,项目名称:TACTIC,代码行数:27,代码来源:sample3d_test.py
示例17: execute
def execute(self):
self.base_dir = self.kwargs.get("base_dir")
if not self.base_dir:
self.base_dir = Environment.get_template_dir()
self.project_code = self.kwargs.get("project_code")
if not self.project_code:
self.project_code = Project.get_project_code()
assert self.project_code
# project code can be called anything, and we want to have a _template suffix for the template code
#self.plugin_code = "%s_template" % self.project_code
#self.template_project_code = re.sub( '_template$', '', self.plugin_code)
self.template_project_code = self.project_code
self.project = Project.get_by_code(self.project_code)
if not self.project:
raise TacticException('This project [%s] does not exist'%self.project_code)
self.project_type = self.project.get_value("type")
if not self.project_type:
self.project_type = self.project_code
Project.set_project(self.project_code)
self.export_template()
开发者ID:mincau,项目名称:TACTIC,代码行数:28,代码来源:project_template_cmd.py
示例18: execute
def execute(my):
my.base_dir = my.kwargs.get("base_dir")
if not my.base_dir:
my.base_dir = Environment.get_template_dir()
my.project_code = my.kwargs.get("project_code")
if not my.project_code:
my.project_code = Project.get_project_code()
assert my.project_code
# project code can be called anything, and we want to have a _template suffix for the template code
#my.plugin_code = "%s_template" % my.project_code
#my.template_project_code = re.sub( '_template$', '', my.plugin_code)
my.template_project_code = my.project_code
my.project = Project.get_by_code(my.project_code)
if not my.project:
raise TacticException('This project [%s] does not exist'%my.project_code)
my.project_type = my.project.get_value("type")
if not my.project_type:
my.project_type = my.project_code
Project.set_project(my.project_code)
my.export_template()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:28,代码来源:project_template_cmd.py
示例19: get_loader_xml
def get_loader_xml(my, ticket, project_code, snapshot_code, context="", options=""):
'''uses the loader to generate an execute xml that can be
used to load the assets'''
try:
my.init(ticket)
Project.set_project(project_code)
snapshot = Snapshot.get_by_code(snapshot_code)
# get the loader implementation
loader_context = ProdLoaderContext()
loader_context.set_context(context)
# pass on any message options for the loader
if options != "":
loader_context.set_options(options)
loader = loader_context.get_loader(snapshot)
loader.execute()
execute_xml = loader.get_execute_xml()
xml = execute_xml.get_xml()
finally:
DbContainer.close_all()
return xml
开发者ID:0-T-0,项目名称:TACTIC,代码行数:27,代码来源:base_xmlrpc.py
示例20: execute
def execute(my):
try:
#Batch()
#Command.execute_cmd(timed_trigger)
Project.set_project(my.project_code)
timed_triggers[my.index].execute()
except Exception, e:
print "Error running trigger"
raise
开发者ID:funic,项目名称:TACTIC,代码行数:9,代码来源:monitor.py
注:本文中的pyasm.biz.Project类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论