本文整理汇总了Python中pyasm.common.Environment.get_release_version方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.get_release_version方法的具体用法?Python Environment.get_release_version怎么用?Python Environment.get_release_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Environment
的用法示例。
在下文中一共展示了Environment.get_release_version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [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: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [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
示例3: upgrade
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [as 别名]
def upgrade(my):
# Note this should only be called when the database is local ...
# for now, just sqlite database
vendor = Config.get_value("database", "vendor")
if vendor != 'Sqlite':
return
version = Environment.get_release_version()
print "Upgrade database to version [%s] ..." % version
import sys
#path = __file__
#dirname = os.path.dirname(path)
#path = "%s/upgrade.py" % dirname
dir = os.getcwd()
file_path = sys.modules[__name__].__file__
full_path = os.path.join(dir, file_path)
dirname = os.path.dirname(full_path)
# take another directory off
dirname = os.path.dirname(dirname)
if os.name == 'posix':
executable = "%s/python/bin/python" % dirname
else:
executable = "%s/python/python.exe" % dirname
#print 'exec: ', executable
install_dir = tacticenv.get_install_dir()
path = "%s/src/bin/upgrade_db.py" % install_dir
import subprocess
subprocess.call([executable, path , "-f", "-y"])
print "... done upgrade"
示例4: main
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [as 别名]
def main():
install_dir = tacticenv.get_install_dir()
version = Environment.get_release_version()
api_version = Environment.get_release_api_version()
client_api_dir = '%s/src/client' % install_dir
context_client_dir = '%s/src/context/client' % install_dir
print "install: ", install_dir
print "version: ", version
# copy scm directory in api
scm_dir = "%s/src/tactic/scm" % install_dir
client_dir = "%s/src/client" % install_dir
to_scm_dir = "%s/src/client/tactic_client_lib/scm" % install_dir
if os.path.exists(to_scm_dir):
shutil.rmtree(to_scm_dir)
shutil.copytree(scm_dir, to_scm_dir)
# create the client api zip package into context/client dir
path = "%s/src/context/client/tactic-api-%s.zip" % (install_dir, api_version)
if os.path.exists(path):
os.system('''rm "%s"''' % path)
os.system('''cd "%s"; zip -r "%s" "tactic_client_lib"''' % (client_api_dir, path) )
# copy the client api into the standalone minimal python
from_dir = '%s/src/client/tactic_client_lib' % install_dir
python = '%s/src/client/python-3.6.6-win32-minimal' % install_dir
to_dir = '%s/Lib/site-packages/tactic_client_lib' % python
if os.path.exists(to_dir):
shutil.rmtree(to_dir)
shutil.copytree(from_dir, to_dir)
# copy and rename to the api version
to_name = "tactic-api-python-%s" % api_version
to_dir = os.path.dirname(python) + "/" + to_name;
if os.path.exists(to_dir):
shutil.rmtree(to_dir)
shutil.copytree(python, to_dir)
# zip this up
to_dir = os.path.dirname(python)
zip_path = "%s/%s.zip" % (to_dir, to_name)
if os.path.exists(zip_path):
os.unlink(zip_path)
os.system('''cd "%s"; zip -r "%s.zip" "%s"''' % (to_dir, to_name, to_name) )
shutil.rmtree("%s/%s" % (to_dir, to_name) )
#
final_path = "%s/%s.zip" % (context_client_dir, to_name)
if os.path.exists(final_path):
os.unlink(final_path)
print(zip_path, final_path)
shutil.move(zip_path, final_path)
示例5: upgrade
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [as 别名]
def upgrade(my):
project_code = my.kwargs.get('project_code')
# run the upgrade script (this has to be done in a separate
# process due to possible sql errors in a transaction
install_dir = Environment.get_install_dir()
python = Config.get_value("services", "python")
if not python:
python = "python"
impl = Project.get_database_impl()
from pyasm.search.upgrade import Upgrade
version = Environment.get_release_version()
version.replace('.', '_')
upgrade = Upgrade(version, is_forced=True, project_code=project_code, quiet=True)
upgrade.execute()
示例6: get_css_wdg
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [as 别名]
def get_css_wdg(self):
widget = Widget()
web = WebContainer.get_web()
context_url = web.get_context_url().to_string()
skin = web.get_skin()
version = Environment.get_release_version()
# Bootstrap
use_bootstrap = True
if use_bootstrap:
Container.append_seq("Page:css", "%s/spt_js/bootstrap/css/bootstrap.min.css?ver=%s" % (context_url, version))
# 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: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [as 别名]
def get_display(my):
top_div = DivWdg()
top_div.add_styles("text-align: center")
top_div.add_style("margin-top: 10px")
top_div.add_style("opacity: 0.5")
top_div.add_style("font-size: 10px")
tactic_span = SpanWdg()
tactic_span.add( "TACTIC®" )
rel_span = SpanWdg()
rel_span.add( " Release %s" % Environment.get_release_version() )
top_div.add( tactic_span )
top_div.add( rel_span )
top_div.add( " © 2005-2015, Southpaw Technology Inc. All Rights Reserved. " )
show_license_info = my.kwargs.get("show_license_info")
if show_license_info:
security = Environment.get_security()
if security:
license = Environment.get_security().get_license()
company = license.get_data("company")
if company.startswith('ALL'):
lic_type = ''
tmps = company.split('-')
if tmps:
lic_type = tmps[-1]
lic_type = lic_type.strip()
license_text = "Open Source License - %s" %lic_type
else:
license_text = "Licensed to %s" % company
else:
license_text = "No License"
top_div.add( license_text )
top_div.add("<br/>"*2)
return top_div
示例8: get_compact_js_context_path_suffix
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [as 别名]
def get_compact_js_context_path_suffix():
context_path_suffix = "spt_js/_compact_spt_all_r%s.js" % Environment.get_release_version().replace(".","_")
return context_path_suffix
示例9: len
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [as 别名]
elif answer == 'n':
sys.exit(0)
else:
print "Only y or n is accepted. Exiting..."
sys.exit(0)
version = current_version
elif len(args) == 1:
version = args[0]
else:
print "Either 1 or no argument can be accepted."
if not version:
version = tacticversion
if version != Environment.get_release_version():
answer = raw_input("[%s] does not match currently running TACTIC version [%s]. If it is a lower version number, it will probably not work. -f must be used to continue. For regular upgrade, you have not symlinked to the new TACTIC version. Continue (y/n): " \
%(version, Environment.get_release_version()))
if answer == "y":
if not is_forced:
print "-f option must be used in this situation. "
sys.exit(0)
pass
elif answer == 'n':
sys.exit(0)
else:
print "Only y or n is accepted. Exiting..."
sys.exit(0)
示例10: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [as 别名]
def get_display(my):
web = WebContainer.get_web()
tactic_header = Table()
tactic_header.add_row()
tactic_header.add_color("color", "color2")
# tactic logo and release info
skin = web.get_skin()
src = '/context/skins/' + skin + '/images/tactic_logo.png'
img = HtmlElement.img(src)
img.add_class('hand')
img.add_attr('title', 'Go to home page')
img.add_behavior({'type': 'click_up', 'cbjs_action': "window.location='/tactic/'"})
rel_div = DivWdg()
rel_div.add(" "*3)
rel_div.add("Release: %s" %Environment.get_release_version() )
rel_div.add_style("font-size: 9px")
# Need this to override the above color in add_looks
rel_div.add_color("color", "color2")
tactic_wdg = Table()
tactic_wdg.add_style("width: 180px")
tactic_wdg.add_row()
td = tactic_wdg.add_cell( img )
td.set_style("width:100px")
tactic_wdg.add_row()
td = tactic_wdg.add_cell( rel_div )
td.set_style("text-align: left")
td = tactic_header.add_cell( tactic_wdg )
# add the project thumb and title
project = Project.get()
if my.show_project:
thumb_div = DivWdg()
td = tactic_header.add_cell( thumb_div )
thumb_div.add_style("height: 28px")
thumb_div.add_style("overflow: hidden")
thumb_div.add_border(modifier=-10)
thumb_div.add_style("-moz-border-radius: 3px")
thumb = ThumbWdg()
thumb_div.add(thumb)
thumb.set_sobject(project)
thumb.set_icon_size("45")
td.set_style("vertical-align: top; padding-right:14px;padding-left: 3px")
td = tactic_header.add_cell( project.get_value("title") )
#td.add_looks( "fnt_title_1" )
td.add_style("font-size: 20px")
td.add_style("white-space: nowrap")
td.add_style("padding-left: 14px")
# project selection
td = tactic_header.add_cell()
project_div = DivWdg()
project_div.add_style("margin-top: -5px")
project_div.add(ProjectSelectWdg() )
td.add( project_div )
td.set_style("padding-left: 14px")
# Global Actions Gear Menu (contains links to Documentation) ...
action_bar_btn_dd = PageHeaderGearMenuWdg()
action_div = DivWdg(action_bar_btn_dd)
action_div.add_style("margin-top: -5px")
td = tactic_header.add_cell( action_div )
if PrefSetting.get_value_by_key('subscription_bar') == 'true':
from message_wdg import SubscriptionBarWdg
sub = SubscriptionBarWdg(mode='popup')
tactic_header.add_cell(sub)
# user login
# user
user = Environment.get_login()
full_name = user.get_full_name()
user_div = SpanWdg( HtmlElement.b( "%s " % full_name) , css='hand')
user_div.set_style("padding-right:10px")
# signout
login = Environment.get_security().get_login()
search_key = SearchKey.get_by_sobject(login)
span = SpanWdg()
span.add( user_div )
user_div.add_attr('spt_nudge_menu_vert', '20')
td = tactic_header.add_cell(span)
td.set_style("width:100%; text-align:right; white-space: nowrap")
#.........这里部分代码省略.........
示例11: preprocess
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [as 别名]
def preprocess(self):
self.version = Environment.get_release_version()
示例12: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [as 别名]
def get_display(my):
top = my.top
top.add_style("padding: 10px")
top.add_color("background", "background")
top.add_style("width: 400px")
inner = DivWdg()
top.add(inner)
inner.add("The following projects have databases that are out of date with this version of TACTIC")
server_version = Environment.get_release_version()
server_div = DivWdg()
inner.add(server_div)
server_div.add("Installed TACTIC Version: ")
server_div.add(server_version)
server_div.add_style("padding: 20px")
server_div.add_style("font-weight: bold")
search = Search("sthpw/project")
projects = search.get_sobjects()
projects_div = DivWdg()
inner.add(projects_div)
table = Table()
projects_div.add(table)
table.add_style("margin: 20px")
table.set_max_width()
for project in projects:
project_code = project.get_code()
if project_code == 'admin':
continue
table.add_row()
project_version = project.get_value("last_version_update")
if project_version < server_version:
td = table.add_cell()
td.add(project_code)
td = table.add_cell()
if not project_version:
td.add("-")
else:
td.add(project_version)
button = ActionButtonWdg(title="Update")
inner.add(button)
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var server = TacticServerStub.get();
var cmd = 'tactic.ui.app.update_wdg.UpdateCbk';
server.execute_cmd(cmd);
'''
} )
return top
示例13: preprocess
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [as 别名]
def preprocess(my):
my.version = Environment.get_release_version()
示例14: add_top_behaviors
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [as 别名]
#.........这里部分代码省略.........
}
spt.tab.set_main_body_tab()
if (view) {
var cls = "tactic.ui.panel.CustomLayoutWdg";
var kwargs = {
view: view
}
}
else if (search_key) {
var cls = "tactic.ui.tools.SObjectDetailWdg";
var kwargs = {
search_key: search_key
}
}
var attributes = bvr.src_el.attributes;
for (var i = 0; i < attributes.length; i++) {
var attr_name = attributes[i].name;
if (attr_name == "class") {
continue;
}
var value = attributes[i].value;
kwargs[attr_name] = value;
}
try {
spt.tab.add_new(name, title, cls, kwargs);
} catch(e) {
spt.alert(e);
}
'''
} )
self.body.add_relay_behavior( {
'type': 'click',
'bvr_match_class': 'tactic_submit',
'cbjs_action': '''
var command = bvr.src_el.getAttribute("command");
var kwargs = {
}
var server = TacticServerStub.get();
try {
server.execute_cmd(command, kwargs);
} catch(e) {
spt.alert(e);
}
'''
} )
self.body.add_relay_behavior( {
'type': 'mouseenter',
'bvr_match_class': 'tactic_hover',
'cbjs_action': '''
var bgcolor = bvr.src_el.getStyle("background");
bvr.src_el.setAttribute("spt_bgcolor", bgcolor);
bvr.src_el.setStyle("background", "#EEE");
'''
} )
self.body.add_relay_behavior( {
'type': 'mouseleave',
'bvr_match_class': 'tactic_hover',
'cbjs_action': '''
var bgcolor = bvr.src_el.getAttribute("spt_bgcolor");
if (!bgcolor) bgcolor = "";
//var bgcolor = ""
bvr.src_el.setStyle("background", bgcolor);
'''
} )
self.body.set_unique_id()
self.body.add_smart_style( "tactic_load", "cursor", "pointer" )
# check version of the database
project = Project.get()
version = project.get_value("last_version_update")
release = Environment.get_release_version()
#if version < release:
# FIXME: can't do this ... TACTIC cannot be running when the database
# is upgrading.
if False:
try:
from pyasm.security import Site
site = Site.get_site()
install_dir = Environment.get_install_dir()
cmd = '''python "%s/src/bin/upgrade_db.py" -f -s "%s" --quiet --yes &''' % (install_dir, site)
print("cmd: ", cmd)
os.system(cmd)
pass
except Exception as e:
print("WARNING: ", e)
示例15: __init__
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_release_version [as 别名]
#.........这里部分代码省略.........
try:
sql = DbContainer.get("sthpw")
if sql.get_database_type() != "MongoDb":
# before batch, clean up the ticket with a NULL code
if os.getenv('TACTIC_MODE') != 'production':
sql.do_update('DELETE from "ticket" where "code" is NULL')
else:
start_port = Config.get_value("services", "start_port")
if start_port:
start_port = int(start_port)
else:
start_port = 8081
if port and int(port) == start_port:
sql.do_update('DELETE from "ticket" where "code" is NULL')
except DatabaseException as e:
# TODO: need to work on this
print("ERROR: could not connect to [sthpw] database")
#os.environ["TACTIC_CONFIG_PATH"] = Config.get_default_config_path()
#Sql.set_default_vendor("Sqlite")
Config.set_tmp_config()
Config.reload_config()
# try connecting again
try:
sql = DbContainer.get("sthpw")
except:
print "Could not connect to the database."
raise
# is it CherryPyStartup's responsibility to start batch?
from pyasm.security import Batch
Batch()
self.site_dir = os.getenv("TACTIC_SITE_DIR")
self.install_dir = os.getenv("TACTIC_INSTALL_DIR")
# set up a simple environment. May need a more complex one later
self.env = Environment()
self.setup_env()
self.config = self.setup_sites()
self.init_only = False
cherrypy.startup = self
# this initializes the web.
# - sets up virtual implied tiggers
from web_init import WebInit
WebInit().execute()
# Windows should handle fine
#start up the caching system if it's not windows
cache_mode = Config.get_value("install", "cache_mode")
if not cache_mode:
cache_mode = 'complete'
if os.name == 'nt':
cache_mode = 'basic'
from cache_startup import CacheStartup
cmd = CacheStartup(mode=cache_mode)
cmd.execute()
cmd.init_scheduler()
# DEPRECATED (but keeping it around"
"""
# start up the queue system ...
if Config.get_value("sync", "enabled") == "true":
# start up the sync system ...
print("Starting Transaction Sync ...")
from tactic.command import TransactionQueueManager
TransactionQueueManager.start()
# start up the sync system ...
print("Starting Watch Folder Service ...")
from tactic.command import WatchServerFolderTask
WatchServerFolderTask.start()
"""
# start up scheduled triggers
#from tactic.command import ScheduledTriggerMonitor
#ScheduledTriggerMonitor.start()
#from pyasm.web import Translation
#Translation.install()
# close all the threads in this startup thread
from pyasm.search import DbContainer
DbContainer.close_thread_sql()
version = Environment.get_release_version()
print("")
print("Starting TACTIC v%s ..." % version)
print("")