本文整理汇总了Python中calypso.model.meta.Session.commit方法的典型用法代码示例。如果您正苦于以下问题:Python Session.commit方法的具体用法?Python Session.commit怎么用?Python Session.commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calypso.model.meta.Session
的用法示例。
在下文中一共展示了Session.commit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: copy_to
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
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()
示例2: __init__
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
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()
示例3: delete
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
def delete(self):
for model in self.filtermodels:
model.delete()
self.filtermodels=[]
self.filteredattrs=[]
sqlsession.delete(self.dao)
sqlsession.commit()
del self.dao
示例4: set_display
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
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
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
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: set_value
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
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
示例7: get_name
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
def get_name(self):
try:
return self.dao.name
except:
sqlsession.commit()
sqlsession.add(self.dao)
sqlsession.commit()
return self.dao.name
示例8: delete
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
def delete(self):
"""
Remove from database
"""
if self.dao != None:
sqlsession.flush()
sqlsession.delete(self.dao)
sqlsession.commit()
del self.dao
示例9: append
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
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()
示例10: __init__
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
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()
示例11: place_monitor
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
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()
示例12: set_filtered
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
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()
示例13: copy_to
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
def copy_to(self, newname):
olddisplay = self
oldname = self.dao.name
if newname == oldname:
return
daos = sqlsession.query(DisplayModel.DAO).filter_by(user=self.dao.user, name=newname).all()
if len(daos) > 0:
raise Exception("Name already exists")
sqlsession.commit()
format = self.dao.format
user = self.dao.user
self.dao = None
self.dao = DisplayModel(user=user, name=newname, format=format).dao
sqlsession.add(self.dao)
sqlsession.commit()
if oldname == "unnamed":
olddisplay.delete()
示例14: render_html
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
def render_html(self, properties, for_editing=False):
sqlsession.flush()
sqlsession.commit()
c.formatview= self.get_name().replace(' ','_')
c.properties=properties
c.monitors=self.monitors()
c.flatattrs={}
c.x_pos=properties.x_pos()
c.y_pos=properties.y_pos()
for mon in c.monitors:
for attr in mon.attrs():
if not(c.flatattrs.has_key(attr[0])):
c.flatattrs[attr[0]]=attr
c.content_type = 'html'
c.name = self.display.format.name
c.tile = self
c.display_ops=for_editing
try:
return render('/tlm/develop/Visualization-tile_view.html');
except:
import traceback
traceback.print_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])
return "<b><i>ERROR rendering tile</i></b>"
示例15: __init__
# 需要导入模块: from calypso.model.meta import Session [as 别名]
# 或者: from calypso.model.meta.Session import commit [as 别名]
def __init__(self, project_name, contract_id, project_type):
self.project_name = project_name
self.contract_id = contract_id
self.project_type = project_type
sqlsession.add(self)
sqlsession.commit()