本文整理汇总了Python中pyasm.biz.ExpressionParser.clear_cache方法的典型用法代码示例。如果您正苦于以下问题:Python ExpressionParser.clear_cache方法的具体用法?Python ExpressionParser.clear_cache怎么用?Python ExpressionParser.clear_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.biz.ExpressionParser
的用法示例。
在下文中一共展示了ExpressionParser.clear_cache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_mail_users
# 需要导入模块: from pyasm.biz import ExpressionParser [as 别名]
# 或者: from pyasm.biz.ExpressionParser import clear_cache [as 别名]
def get_mail_users(my, column):
# mail groups
recipients = set()
expr = my.notification.get_value(column, no_exception=True)
if expr:
sudo = Sudo()
# Introduce an environment that can be reflected
env = {
'sobject': my.sobject
}
#if expr.startswith("@"):
# logins = Search.eval(expr, list=True, env_sobjects=env)
#else:
parts = expr.split("\n")
# go through each login and evaluate each
logins = []
for part in parts:
if part.startswith("@") or part.startswith("{"):
results = Search.eval(part, list=True, env_sobjects=env)
# clear the container after each expression eval
ExpressionParser.clear_cache()
# these can just be login names, get the actual Logins
if results:
if isinstance(results[0], basestring):
login_sobjs = Search.eval("@SOBJECT(sthpw/login['login','in','%s'])" %'|'.join(results), list=True)
login_list = SObject.get_values(login_sobjs, 'login')
for result in results:
# the original result could be an email address already
if result not in login_list:
logins.append(result)
if login_sobjs:
logins.extend( login_sobjs )
else:
logins.extend(results)
elif part.find("@") != -1:
# this is just an email address
logins.append( part )
elif part:
# this is a group
group = LoginGroup.get_by_code(part)
if group:
logins.extend( group.get_logins() )
del sudo
else:
notification_id = my.notification.get_id()
logins = GroupNotification.get_logins_by_id(notification_id)
for login in logins:
recipients.add(login)
return recipients
示例2: get_item_div
# 需要导入模块: from pyasm.biz import ExpressionParser [as 别名]
# 或者: from pyasm.biz.ExpressionParser import clear_cache [as 别名]
def get_item_div(self, sobject):
''' get the item div the sobject'''
top = DivWdg()
top.add_style("padding: 3px 2px")
top.add_class("spt_drop_item")
top.add_class("SPT_DROP_ITEM")
item_div = DivWdg()
top.add(item_div, "item_div")
item_div.add_style("text-overflow: ellipsis")
item_div.add_style("white-space: nowrap")
item_div.add_style("width: 80%")
item_div.add_attr('title','Click to remove')
item_div.add_style("display", "inline-block")
item_div.add_style("vertical-align", "top")
item_div.add_style("overflow", "hidden")
icon_div = DivWdg()
top.add(icon_div)
icon = IconWdg(icon="BS_REMOVE")
icon_div.add(icon)
icon_div.add_behavior( {
'type': 'click_up',
#'cbjs_action': '''spt.dg_table_action.sobject_drop_remove(evt,bvr)'''
'cbjs_action': '''spt.drop.sobject_drop_remove(evt,bvr)'''
} )
icon.add_style("opacity: 0.3")
icon_div.add_class("hand")
icon_div.add_style("display", "inline-block")
icon_div.add_style("vertical-align", "top")
#icon_div.add_border()
#self.menu.set_over(item_div, event="mousein")
#self.menu.set_out(top, event="mouseleave")
# set this as the place for the display value to go
item_div.add_class("spt_drop_display_value")
add_icon = True
ExpressionParser.clear_cache()
if sobject:
if add_icon:
self._add_icon(sobject, item_div)
if self.display_expr:
display_value = Search.eval(self.display_expr, sobjects = sobject, single=True)
else:
display_value = sobject.get_display_value()
if isinstance(display_value, list):
display_value = display_value[0]
item_div.add( display_value )
self.values.append( SearchKey.get_by_sobject(sobject) )
return top
示例3: get_item_div
# 需要导入模块: from pyasm.biz import ExpressionParser [as 别名]
# 或者: from pyasm.biz.ExpressionParser import clear_cache [as 别名]
def get_item_div(my, sobject):
''' get the item div the sobject'''
top = DivWdg()
top.add_style("padding: 3px 2px")
top.add_attr('title','Click to remove')
# FIXME: put this here for now
top.add_behavior( {
'type': 'click_up',
#'cbjs_action': '''spt.dg_table_action.sobject_drop_remove(evt,bvr)'''
'cbjs_action': '''spt.drop.sobject_drop_remove(evt,bvr)'''
} )
top.add_class("spt_drop_item")
top.add_class("SPT_DROP_ITEM")
item_div = DivWdg()
item_div.add_class("hand")
item_div.add_style("float: clear")
top.add(item_div, "item_div")
#my.menu.set_over(item_div, event="mousein")
#my.menu.set_out(top, event="mouseleave")
# set this as the place for the display value to go
item_div.add_class("spt_drop_display_value")
add_icon = True
ExpressionParser.clear_cache()
if sobject:
if add_icon:
my._add_icon(sobject, item_div)
if my.display_expr:
display_value = Search.eval(my.display_expr, sobjects = sobject, single=True)
else:
display_value = sobject.get_display_value()
if isinstance(display_value, list):
display_value = display_value[0]
item_div.add( display_value )
my.values.append( SearchKey.get_by_sobject(sobject) )
return top