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


Python meta.Session類代碼示例

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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