本文整理汇总了Python中pyasm.biz.Project.get方法的典型用法代码示例。如果您正苦于以下问题:Python Project.get方法的具体用法?Python Project.get怎么用?Python Project.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.biz.Project
的用法示例。
在下文中一共展示了Project.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_naming
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def get_naming(cls, naming_type, sobject=None, project=None):
'''get a certain type of naming determined by type of naming'''
naming_cls = ""
# this import statement is needed for running Batch
from pyasm.biz import Project
if not project:
if sobject:
project = sobject.get_project()
else:
project = Project.get()
if project:
naming_cls = project.get_value("%s_naming_cls" % naming_type, no_exception=True)
if not naming_cls and project.get_project_type():
naming_cls = project.get_project_type().get_value("%s_naming_cls" % naming_type, no_exception=True)
# if none is defined, use defaults
if not naming_cls:
# TODO: this should probably be stored somewhere else
if naming_type == "file":
naming_cls = "pyasm.biz.FileNaming"
elif naming_type == "dir":
naming_cls = "pyasm.biz.DirNaming"
elif naming_type == "node":
naming_cls = "pyasm.prod.biz.ProdNodeNaming"
naming = Common.create_from_class_path(naming_cls)
return naming
示例2: get_display
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def get_display(my):
project = Project.get()
search_types = project.get_search_types()
task_search_type = SearchType.get("sthpw/task")
search_types.append(task_search_type)
values = [ x.get_value("search_type") for x in search_types]
labels = []
for x in search_types:
label = "%s (%s)" % (x.get_value("title"), x.get_value("search_type"))
labels.append(label)
sobject = my.get_current_sobject()
if not sobject:
value = ""
else:
value = sobject.get_value(my.get_name() )
my.set_option("values", values)
my.set_option("labels", labels)
my.add_empty_option("-- Select --")
if value:
my.set_value(value)
return super(SearchTypeInputWdg, my).get_display()
示例3: get_display
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def get_display(my):
#defining init is better than get_display() for this kind of SelectWdg
search = Search( SearchType.SEARCH_TYPE )
if my.mode == None or my.mode == my.ALL_BUT_STHPW:
# always add the login / login group search types
filter = search.get_regex_filter("search_type", "login|task|note|timecard|trigger|milestone", "EQ")
no_sthpw_filter = search.get_regex_filter("search_type", "^(sthpw).*", "NEQ")
search.add_where('%s or %s' %(filter, no_sthpw_filter))
elif my.mode == my.CURRENT_PROJECT:
project = Project.get()
project_code = project.get_code()
#project_type = project.get_project_type().get_type()
project_type = project.get_value("type")
search.add_where("\"namespace\" in ('%s','%s') " % (project_type, project_code))
search.add_order_by("search_type")
search_types = search.get_sobjects()
values = SObject.get_values(search_types, 'search_type')
labels = [ x.get_label() for x in search_types ]
values.append('CustomLayoutWdg')
labels.append('CustomLayoutWdg')
my.set_option('values', values)
my.set_option('labels', labels)
#my.set_search_for_options(search, "search_type", "get_label()")
my.add_empty_option(label='-- Select Search Type --')
return super(SearchTypeSelectWdg, my).get_display()
示例4: create_snapshot_xml
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def create_snapshot_xml(my, file_objects, snapshot_xml=None):
builder = SnapshotBuilder(snapshot_xml)
root = builder.get_root_node()
from pyasm.search.sql import DbContainer
from pyasm.biz import Project
project = Project.get()
db_resource = project.get_project_db_resource()
sql = DbContainer.get(db_resource)
if sql.get_database_type() == 'SQLServer':
import datetime
Xml.set_attribute(root, "timestamp", datetime.datetime.now())
else:
Xml.set_attribute(root, "timestamp", time.asctime() )
Xml.set_attribute(root, "context", my.context )
for i in range(0, len(file_objects)):
file_object = file_objects[i]
file_type = my.file_types[i]
file_info = {}
file_info['type'] = file_type
if file_object.get_file_range():
file_info['file_range'] = my.file_range.get_key()
builder.add_file(file_object, file_info)
for input_snapshot in my.input_snapshots:
builder.add_ref_by_snapshot(input_snapshot)
return builder.to_string()
示例5: get_application_wdg
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
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
示例6: _test_task
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def _test_task(my):
project = Project.get()
# create a new task
task = SearchType.create("sthpw/task")
task.set_parent(project)
task.set_value("code", "XXX001")
task.set_value("process", "unittest")
task.set_value("description", "unittest")
# set a time with no timezone. A timestamp with no timezone should
# assume GMT.
test_time = '2011-11-11 00:00:00'
task.set_value("timestamp", test_time)
# asset that the time has not changed
timestamp = task.get_value("timestamp")
my.assertEquals(timestamp, test_time)
task.commit()
# get the task back from the databse
search = Search("sthpw/task")
search.add_filter("code", "XXX001")
task = search.get_sobject()
# make sure the time has not changed. This value should is assumed
# to be in GMT
timestamp = task.get_value("timestamp")
my.assertEquals(timestamp, test_time)
task.delete()
示例7: get_child_codes
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def get_child_codes(self, parent_collection_code, search_type):
'''
All of the children's codes down the relationship tree of the collection
will be returned.
'''
from pyasm.biz import Project
project = Project.get()
sql = project.get_sql()
impl = project.get_database_impl()
search_codes = []
parts = search_type.split("/")
collection_type = "%s/%s_in_%s" % (parts[0], parts[1], parts[1])
# Check if connection between asset and asset_in_asset is in place
if collection_type not in SearchType.get_related_types(search_type):
return search_codes
stmt = impl.get_child_codes_cte(collection_type, search_type, parent_collection_code)
results = sql.do_query(stmt)
for result in results:
result = "".join(result)
search_codes.append(result)
return search_codes
示例8: add_internal_config
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def add_internal_config(cls, configs, views):
'''add an internal config based on project base type'''
project = Project.get()
project_type = project.get_base_type()
# catch potential invalid xpath error
try:
if project_type:
tmp_path = __file__
dir_name = os.path.dirname(tmp_path)
file_path="%s/../config/%s-conf.xml" % (dir_name, project_type)
if os.path.exists(file_path):
for view in views:
config = WidgetConfig.get(file_path=file_path, view=view)
if config.get_view_node():
configs.append(config)
# finally, just look at the DEFAULT config
tmp_path = __file__
dir_name = os.path.dirname(tmp_path)
file_path="%s/../config/%s-conf.xml" % (dir_name, "DEFAULT")
if os.path.exists(file_path):
for view in views:
config = WidgetConfig.get(file_path=file_path, view=view)
if config.get_view_node():
configs.append(config)
except XmlException, e:
msg = "Error with view [%s]"% ' '.join(views)
error_list = Container.get_seq(cls.ERR_MSG)
if msg not in error_list:
Container.append_seq(cls.ERR_MSG, msg)
print e.__str__()
示例9: init
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def init(my):
top = DivWdg()
top.set_id('top_of_application')
msg_div = DivWdg()
msg_div.add_style('text-align: center')
msg_div.add('<img src="/context/icons/common/indicator_snake.gif" border="0"/>')
msg_div.add(" ")
project = Project.get()
title = project.get_value("title")
if not title:
title = "TACTIC"
msg_div.add('''Loading "%s" ....'''% title)
msg_div.add_style("font-size: 1.5em")
msg_div.add_behavior( {
'type': 'load',
'hash': my.hash,
'cbjs_action': '''
if (bvr.hash) {
spt.hash.hash = "/" + bvr.hash;
}
else {
spt.hash.hash = "/index";
}
'''
} )
msg_div.add_style("margin: 200 0 500 0")
top.add(msg_div)
my.add(top)
return
示例10: get_header_class_name
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def get_header_class_name(cls):
project = Project.get()
class_name = project.get_value("header_class_name", no_exception=True)
if not class_name:
class_name = Config.get_value("install", "header_class_name")
if not class_name:
class_name = 'tactic.ui.app.PageNavContainerWdg'
return class_name
示例11: get_main_tab_wdg
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def get_main_tab_wdg():
from pyasm.biz import Project
project = Project.get()
type = project.get_base_type()
if type == "":
raise TacticException("Project: %s has no type" % project.get_code())
exec( "from pyasm.%s.site import MainTabWdg" % type )
tab = MainTabWdg()
return tab
示例12: get_predefined_wdg
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def get_predefined_wdg(self):
project = Project.get()
project_type = project.get_type()
from tactic.ui.container import PopupWdg
popup = PopupWdg(id="predefined_db_columns", allow_page_activity=True, width="320px")
popup.add_title("Predefined Database Columns")
popup.add( self.get_section_wdg(view='predefined', default=True))
return popup
示例13: get_application_wdg
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def get_application_wdg(my):
page = None
try:
project = Project.get()
except Exception, e:
Project.set_project("sthpw")
from pyasm.widget import Error404Wdg
page = Error404Wdg()
示例14: execute
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def execute(self):
dirname = os.path.dirname(self.script_path)
basename = os.path.basename(self.script_path)
project = Project.get()
# treat the code as a python
search = Search("config/custom_script")
search.add_filter("folder", dirname)
search.add_filter("title", basename)
script_sobj = search.get_sobject()
if not script_sobj:
try:
# get from the sthpw database
search = Search("sthpw/custom_script")
search.add_filter("folder", dirname)
search.add_filter("title", basename)
script_sobj = search.get_sobject()
if not script_sobj:
print("WARNING: Script with path [%s] does not exist in this project [%s] or Admin Site" % (self.script_path, project.get_code()))
return {}
except:
print("WARNING: Script with path [%s] does not exist in this project [%s] or Admin Site" % (self.script_path, project.get_code()))
return
script = script_sobj.get_value("script")
if not script:
print("WARNING: Empty python script [%s]" %script_sobj.get_code())
return {}
if self.trigger_sobj:
trigger_sobj = self.trigger_sobj.get_sobject_dict()
self.input['trigger_sobject'] = trigger_sobj
language = script_sobj.get_value("language")
if language == "server_js":
from tactic.command import JsCmd
cmd = JsCmd(code=script, input=self.input)
else:
cmd = PythonCmd(code=script, input=self.input)
ret_val = cmd.execute()
self.ret_val = ret_val
self.info['result'] = ret_val
#print "input: ", self.input
#print "output: ", self.output
#print "options: ", self.options
return ret_val
示例15: get_application_wdg
# 需要导入模块: from pyasm.biz import Project [as 别名]
# 或者: from pyasm.biz.Project import get [as 别名]
def get_application_wdg(my):
page = None
try:
project = Project.get()
except Exception, e:
Project.set_project("sthpw")
from pyasm.widget import Error404Wdg
page = Error404Wdg()
page.set_message(e.__str__())
page.status = ''