本文整理汇总了Python中widget.Widget.get_display方法的典型用法代码示例。如果您正苦于以下问题:Python Widget.get_display方法的具体用法?Python Widget.get_display怎么用?Python Widget.get_display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类widget.Widget
的用法示例。
在下文中一共展示了Widget.get_display方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import get_display [as 别名]
def get_display(my):
my.handle_hidden_rows()
for row in my.rows:
if len(row.widgets) == 1 and len(row.widgets ) < my.max_cols:
row.widgets[0].set_attr("colspan", my.max_cols)
return Widget.get_display(my)
示例2: get_single_widget
# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import get_display [as 别名]
def get_single_widget(my, widget, minimal=True):
from pyasm.widget import BottomWdg
from tactic.ui.app import TitleTopWdg
if minimal:
top = TitleTopWdg()
else:
top = my.get_top_wdg()
container = Widget()
container.add( top )
top.add( widget )
container.add( BottomWdg() )
container.get_display()
return container
示例3: _get_display
# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import get_display [as 别名]
def _get_display(my):
# set up the security object
from pyasm.security import Security, Sudo
from pyasm.biz import Project
from pyasm.web import WebContainer
web = WebContainer.get_web()
security = Security()
security = my.handle_security(security)
is_logged_in = security.is_logged_in()
# guest mode
#
allow_guest = Config.get_value("security", "allow_guest")
if allow_guest == 'true':
allow_guest = True
else:
allow_guest = False
guest_mode = Config.get_value("security", "guest_mode")
if not guest_mode:
guest_mode = 'restricted'
#allow_guest = True
#guest_mode = "full"
# if not logged in, then log in as guest
if not is_logged_in:
if not allow_guest:
return my.handle_not_logged_in()
else:
# login as guest
security = Security()
my.handle_guest_security(security)
# for here on, the user is logged in
login_name = Environment.get_user_name()
# check if the user has permission to see this project
project = web.get_context_name()
if project == 'default':
override_default = Config.get_value("install", "default_project")
if override_default:
project = override_default
if project != 'default':
security_version = get_security_version()
if security_version == 1:
default = "view"
access = security.check_access("project", project, "view", default="view")
else:
default = "deny"
key = { "code": project }
key2 = { "code": "*" }
#keys = [key]
keys = [key, key2]
access = security.check_access("project", keys, "allow", default=default)
else:
# you always have access to the default project
access = True
access = True
if not access:
if login_name == "guest":
from pyasm.widget import WebLoginWdg
msg = web.get_form_value(WebLoginWdg.LOGIN_MSG)
if not msg:
msg = "User [%s] is not allowed to see this project [%s]" % (login_name, project)
web.set_form_value(WebLoginWdg.LOGIN_MSG, msg)
return my.handle_not_logged_in(allow_change_admin=False)
else:
from pyasm.widget import WebLicenseWdg, BottomWdg, Error403Wdg
widget = Widget()
top = my.get_top_wdg()
widget.add( top )
widget.add( Error403Wdg() )
widget.add( BottomWdg() )
widget.get_display()
return
if login_name == 'guest' and guest_mode == "full":
# some extra security for guest users
guest_url_allow = Config.get_value("security", "guest_url_allow")
if guest_url_allow:
items = guest_url_allow.split("|")
allowed = False
if my.hash:
url = my.hash[0]
else:
#.........这里部分代码省略.........
示例4: Widget
# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import get_display [as 别名]
from pyasm.widget import WebLoginWdg
msg = web.get_form_value(WebLoginWdg.LOGIN_MSG)
if not msg:
msg = "User [%s] is not allowed to see this project [%s]" % (login_name, project)
web.set_form_value(WebLoginWdg.LOGIN_MSG, msg)
return my.handle_not_logged_in(allow_change_admin=False)
else:
from pyasm.widget import WebLicenseWdg, BottomWdg, Error403Wdg
widget = Widget()
top = my.get_top_wdg()
widget.add( top )
widget.add( Error403Wdg() )
widget.add( BottomWdg() )
widget.get_display()
return
if login_name == 'guest' and guest_mode == "full":
# some extra security for guest users
guest_url_allow = Config.get_value("security", "guest_url_allow")
if guest_url_allow:
items = guest_url_allow.split("|")
allowed = False
if my.hash:
url = my.hash[0]
else:
url = "index"
for item in items:
示例5: _get_display
# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import get_display [as 别名]
def _get_display(self):
# set up the security object
from pyasm.security import Security, Sudo
from pyasm.biz import Project
from pyasm.web import WebContainer
web = WebContainer.get_web()
# guest mode
#
allow_guest = Config.get_value("security", "allow_guest")
if allow_guest == 'true':
allow_guest = True
else:
allow_guest = False
site_obj = Site.get()
site_allow_guest = site_obj.allow_guest()
if site_allow_guest != None:
allow_guest = site_allow_guest
security = Security()
try:
security = self.handle_security(security)
is_logged_in = security.is_logged_in()
except Exception as e:
print("AppServer Exception: ", e)
return self.handle_not_logged_in()
guest_mode = Config.get_value("security", "guest_mode")
if not guest_mode:
guest_mode = 'restricted'
# Test
#allow_guest = True
#guest_mode = "full"
# if not logged in, then log in as guest
if not is_logged_in:
if not allow_guest:
return self.handle_not_logged_in()
else:
# login as guest
security = Security()
self.handle_guest_security(security)
# for here on, the user is logged in
login_name = Environment.get_user_name()
is_upload = '/UploadServer' in web.get_request_url().to_string()
# check if the user has permission to see this project
project = web.get_context_name()
if project == 'default':
override_default = Project.get_default_project()
if override_default:
project = override_default
if is_upload:
print("IS UPLOAD")
access = True
elif project != 'default':
# make sure the security check is done on the appropriate site
path_info = site_obj.get_request_path_info()
if path_info:
site = path_info.get("site")
Site.set_site(site)
s = Environment.get_security()
has_site = True
else:
s = security
has_site = False
try:
security_version = get_security_version()
if security_version == 1:
default = "view"
access = s.check_access("project", project, "view", default="view")
else:
default = "deny"
key = { "code": project }
key2 = { "code": "*" }
keys = [key, key2]
access = s.check_access("project", keys, "allow", default=default)
finally:
if has_site:
Site.pop_site()
else:
# you always have access to the default project
access = True
#.........这里部分代码省略.........