當前位置: 首頁>>代碼示例>>Python>>正文


Python Session.commit方法代碼示例

本文整理匯總了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()
開發者ID:lonefeifei,項目名稱:Team-Works,代碼行數:9,代碼來源:windows.py

示例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()
開發者ID:lonefeifei,項目名稱:Team-Works,代碼行數:10,代碼來源:tiles.py

示例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 
開發者ID:lonefeifei,項目名稱:Team-Works,代碼行數:10,代碼來源:tiles.py

示例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)
開發者ID:lonefeifei,項目名稱:Team-Works,代碼行數:10,代碼來源:windows.py

示例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()
開發者ID:lonefeifei,項目名稱:Team-Works,代碼行數:10,代碼來源:tiles.py

示例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
開發者ID:lonefeifei,項目名稱:Team-Works,代碼行數:10,代碼來源:properties.py

示例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
開發者ID:nak,項目名稱:Team-Works,代碼行數:10,代碼來源:Visualization.py

示例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
開發者ID:lonefeifei,項目名稱:Team-Works,代碼行數:11,代碼來源:properties.py

示例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()
開發者ID:lonefeifei,項目名稱:Team-Works,代碼行數:12,代碼來源:tiles.py

示例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()
開發者ID:lonefeifei,項目名稱:Team-Works,代碼行數:14,代碼來源:properties.py

示例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()
開發者ID:lonefeifei,項目名稱:Team-Works,代碼行數:15,代碼來源:tiles.py

示例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()
開發者ID:lonefeifei,項目名稱:Team-Works,代碼行數:18,代碼來源:tiles.py

示例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()
開發者ID:nak,項目名稱:Team-Works,代碼行數:19,代碼來源:Visualization.py

示例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>"
開發者ID:lonefeifei,項目名稱:Team-Works,代碼行數:25,代碼來源:tiles.py

示例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()
開發者ID:lonefeifei,項目名稱:Team-Works,代碼行數:8,代碼來源:Main.py


注:本文中的calypso.model.meta.Session.commit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。