本文整理汇总了Python中pyasm.common.Container.append_seq方法的典型用法代码示例。如果您正苦于以下问题:Python Container.append_seq方法的具体用法?Python Container.append_seq怎么用?Python Container.append_seq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Container
的用法示例。
在下文中一共展示了Container.append_seq方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import append_seq [as 别名]
def get_display(my):
web = WebContainer.get_web()
context_url = web.get_context_url().to_string()
js_url = "%s/javascript" % context_url
spt_js_url = "%s/spt_js" % context_url # adding new core "spt" javascript library folder
version = Environment.get_release_version()
# add some third party libraries
third_party = js_includes.third_party
security = Environment.get_security()
# FIXME: this logic should not be located here.
# no reason to have the edit_area_full.js
if not security.check_access("builtin", "view_script_editor", "allow") and security.check_access("builtin", "view_site_admin", "allow"):
if "edit_area/edit_area_full.js" in third_party:
third_party.remove("edit_area/edit_area_full.js")
for include in js_includes.third_party:
Container.append_seq("Page:js", "%s/%s" % (spt_js_url,include))
all_js_path = js_includes.get_compact_js_filepath()
if os.path.exists( all_js_path ):
Container.append_seq("Page:js", "%s/%s" % (context_url, js_includes.get_compact_js_context_path_suffix()))
else:
for include in js_includes.legacy_core:
Container.append_seq("Page:js", "%s/%s" % (js_url,include))
for include in js_includes.spt_js:
Container.append_seq("Page:js", "%s/%s" % (spt_js_url,include))
for include in js_includes.legacy_app:
Container.append_seq("Page:js", "%s/%s" % (js_url,include))
#Container.append_seq("Page:js", "http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject.js")
#Container.append_seq("Page:js", "/context/spt_js/UnityObject.js")
#widget = DivWdg()
#widget.set_id("javascript")
#my.set_as_panel(widget)
widget = Widget()
js_files = Container.get("Page:js")
for js_file in js_files:
widget.add('<script src="%s?ver=%s" ></script>\n' % (js_file,version) )
return widget
示例2: add_internal_config
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import append_seq [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__()
示例3: get_css_wdg
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import append_seq [as 别名]
def get_css_wdg(my):
widget = Widget()
web = WebContainer.get_web()
context_url = web.get_context_url().to_string()
skin = web.get_skin()
# first load context css
Container.append_seq("Page:css", "%s/style/layout.css" % context_url)
# add the color wheel css
Container.append_seq("Page:css", "%s/spt_js/mooRainbow/Assets/mooRainbow.css" % context_url)
Container.append_seq("Page:css", "%s/spt_js/mooDialog/css/MooDialog.css" % context_url)
Container.append_seq("Page:css", "%s/spt_js/mooScrollable/Scrollable.css" % context_url)
# TEST
Container.append_seq("Page:css", "%s/spt_js/video/video-js.css" % context_url)
# get all of the registered css file
css_files = Container.get_seq("Page:css")
for css_file in css_files:
widget.add('<link rel="stylesheet" href="%s" type="text/css" />\n' % css_file )
return widget
示例4: run_sql
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import append_seq [as 别名]
def run_sql(my, sql):
''' run an sql statement. my is an instance of the dynamically created
<project_type>Upgrade class. If SqlException arise, it will record the
error, and the user is advised to check if the error is a result of syntax
error or the upgrade function is doing redundant work'''
project = Project.get_by_code(my.project_code)
db_resource = project.get_project_db_resource()
db = DbContainer.get(db_resource)
#if not my.quiet:
# print sql
try:
db.do_update(sql, quiet=my.quiet)
except SqlException, e:
print "Error: ", e
# TEST for Sqlite
if str(e).startswith("duplicate column name:"):
pass
elif str(e).startswith("table") and str(e).endswith("already exists"):
pass
elif not my.quiet:
print
print "WARNING: Skipping due to SqlException..."
print "Message: ", e
print
members = inspect.getmembers(my, predicate=inspect.ismethod)
key = '%s|%s' %(my.project_code, my.upgrade_class)
Container.append_seq(key, (my.upgrade_method, str(e)))
"""
for name, member in members:
# there should only be 1 upgrade method
if name.startswith('upgrade_v'):
Container.append_seq(key, (my.upgrade_method, str(e)))
break
"""
# to prevent sql error affecting query that follows the Upgrade
#DbContainer.abort_thread_sql()
DbContainer.release_thread_sql()
示例5: get_display
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import append_seq [as 别名]
def get_display(my):
web = WebContainer.get_web()
context_url = web.get_context_url().to_string()
js_url = "%s/javascript" % context_url
spt_js_url = "%s/spt_js" % context_url # adding new core "spt" javascript library folder
version = Environment.get_release_version()
# add some third party libraries
third_party = js_includes.third_party
security = Environment.get_security()
for include in js_includes.third_party:
Container.append_seq("Page:js", "%s/%s" % (spt_js_url,include))
all_js_path = js_includes.get_compact_js_filepath()
if os.path.exists( all_js_path ):
Container.append_seq("Page:js", "%s/%s" % (context_url, js_includes.get_compact_js_context_path_suffix()))
else:
for include in js_includes.legacy_core:
Container.append_seq("Page:js", "%s/%s" % (js_url,include))
for include in js_includes.spt_js:
Container.append_seq("Page:js", "%s/%s" % (spt_js_url,include))
for include in js_includes.legacy_app:
Container.append_seq("Page:js", "%s/%s" % (js_url,include))
# custom js files to include
includes = Config.get_value("install", "include_js")
includes = includes.split(",")
for include in includes:
include = include.strip()
if include:
print "include: ", include
Container.append_seq("Page:js", include)
widget = Widget()
js_files = Container.get("Page:js")
for js_file in js_files:
widget.add('<script src="%s?ver=%s" ></script>\n' % (js_file,version) )
return widget
示例6: get_css_wdg
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import append_seq [as 别名]
def get_css_wdg(my):
widget = Widget()
web = WebContainer.get_web()
context_url = web.get_context_url().to_string()
skin = web.get_skin()
# Bootstrap
use_bootstrap = True
if use_bootstrap:
Container.append_seq("Page:css", "%s/spt_js/bootstrap/css/bootstrap.min.css" % context_url)
# add the color wheel css
Container.append_seq("Page:css", "%s/spt_js/mooRainbow/Assets/mooRainbow.css" % context_url)
Container.append_seq("Page:css", "%s/spt_js/mooDialog/css/MooDialog.css" % context_url)
Container.append_seq("Page:css", "%s/spt_js/mooScrollable/Scrollable.css" % context_url)
# first load context css
Container.append_seq("Page:css", "%s/style/layout.css" % context_url)
# TEST
Container.append_seq("Page:css", "%s/spt_js/video/video-js.css" % context_url)
# get all of the registered css file
css_files = Container.get_seq("Page:css")
for css_file in css_files:
widget.add('<link rel="stylesheet" href="%s" type="text/css" />\n' % css_file )
# custom js files to include
includes = Config.get_value("install", "include_css")
includes = includes.split(",")
for include in includes:
include = include.strip()
if include:
print "include: ", include
widget.add('<link rel="stylesheet" href="%s" type="text/css" />\n' % include )
return widget
示例7: add_outdated_ref
# 需要导入模块: from pyasm.common import Container [as 别名]
# 或者: from pyasm.common.Container import append_seq [as 别名]
def add_outdated_ref(version_wdg):
Container.append_seq('SubRef_outdated', version_wdg)