本文整理汇总了Python中calypso.model.meta.Session类的典型用法代码示例。如果您正苦于以下问题:Python Session类的具体用法?Python Session怎么用?Python Session使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Session类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render_html
def render_html(self,for_editing=False, format=None):
sqlsession.flush()
c.name = self.get_name()
c.tiles = self.tiles
if format==None:
c.format = calypso.Session.session.get_display().format
else:
c.format=format
if for_editing:
return render('/tlm/develop/Visualization.html')
else:
return render ('/tlm/telemetrydisplay.html')
示例2: verify_is_admin
def verify_is_admin(self):
try:
user = sqlsession.query(User).filter_by(userid=self.userid,password=self.password).one()
return sqlsession.query(UserRoleMapping).filter_by(userid=self.userid,roleid=Role.ADMIN.id).count()>0
except:
print "No such user"
return False
示例3: copy_to
def copy_to(self, displayname):
sqlsession.commit()
name=self.dao.name
user=self.dao.user
self.dao=None
self.dao=TelemetryWindowModel(user = user, name=name, displayname=displayname).dao
sqlsession.commit()
示例4: set_display
def set_display(self, display):
self._model.set_parent(display.get_name())
sqlsession.commit()
for row in self.tiles:
for tile in row:
if tile!=None:
tile.tile.set_display(display)
tile.properties.set_display(display)
示例5: copy_to
def copy_to(self, displayname):
sqlsession.commit()
for model in self.filtermodels:
model.copy_to(displayname)
newview=MonitorView(name=self.dao.name, user=self.dao.user, parentname=self.dao.parent,displayname=displayname, format=self.format, index=self.index)
self.dao=None
self.dao=newview.dao
sqlsession.commit()
示例6: delete
def delete(self):
for model in self.filtermodels:
model.delete()
self.filtermodels=[]
self.filteredattrs=[]
sqlsession.delete(self.dao)
sqlsession.commit()
del self.dao
示例7: set_value
def set_value( self, value ):
self.dao.set_value(str(value))
try:
sqlsession.add(self.dao)
except:
pass
sqlsession.commit()
print "SET VALUE OF " +self.dao.parent +" TO " + self.dao.name + " TO " + self.dao.value
示例8: __init__
def __init__(self,id,name):
self.id = id
self.name = name
try:
if (sqlsession.query(Role).filter_by(id=self.id).count() == 0):
sqlsession.add(self)
except:
sqlsession.add(self)
示例9: __init__
def __init__(self, user, name, parentname, displayname, type):
self.type = type
self.user = user
self.display=displayname
self.parent=parentname
self.name=name
sqlsession.add(self)
sqlsession.commit()
示例10: append
def append(self, monitorview):
if not(isinstance(monitorview, MonitorView)):
raise Exception("Type mismatch")
for index in range(len(self.monitors)):
mon=self.monitors[index]
if mon.monitor().get_name()==monitorview.monitor().get_name():
self.monitors[index]=monitorview
return
self.monitors.append(monitorview)
sqlsession.commit()
示例11: __init__
def __init__(self, name, user, ownername, displayname, value, type):
self.name=name
self.user=user
self.parent=ownername
self.display=displayname
self.type=type
if value==None:
self.value='0'
else:
self.value=value
sqlsession.add(self)
sqlsession.commit()
示例12: place_monitor
def place_monitor(self, monitor, index):
if (monitor in self.monitors):
del self.monitors[index]
self.monitors.insert(index,monitor)
else:
if index > len(self.monitors):
#add to end
self.monitors.append(monitor)
else:
#insert new monitor
self.monitors.insert(index,monitor)
print self.monitors
sqlsession.commit()
示例13: __init__
def __init__(self, user, name, displayname):
daos= sqlsession.query(TelemetryWindowModel.DAO).filter_by(user=user,display=displayname, name=name).all()
if len(daos)>0:
self.dao = daos[0]
else:
self.dao = TelemetryWindowModel.DAO(user=user,name=name, displayname=displayname)
index=0
示例14: set_filtered
def set_filtered(self, filteredattrs):
self.filteredattrs=filteredattrs
if filteredattrs==None:
self.filtermodels=[]
return
try:
for filter in self.filtermodels:
if not(filter.dao.name in filteredattrs):
filter.delete()
except:
pass
self.filtermodels=[]
for attrname in filteredattrs:
self.filtermodels.append(MonitorFilter(user=self.dao.user, name=attrname, parentname=self.get_name(),
tilename=self.dao.parent, displayname=self.dao.display))
sqlsession.commit()
示例15: get_properties
def get_properties(user, parent, display):
daos= sqlsession.query(DisplayPropertyItem.DAO).filter_by( user=user, display=display.get_name(), parent=parent.get_name()).all()
params={}
for dao in daos:
tag=dao.name
if tag != "name":
params[tag]=dao.value
return DisplayProperties(name=parent, user=user, parent=parent, display=display, **params)