示例#1
0
 def latest(cls) -> "Poll":
     with get_connection() as connection:
         poll = database.get_latest_poll(connection)
         return cls(poll[1], poll[2], poll[0])
示例#2
0
 def latest(cls) -> "Poll":
     connection = create_connection()
     poll = database.get_latest_poll(connection)
     connection.close()
     return  cls(poll[1], poll[2], poll[0])
示例#3
0
 def latest(cls) -> 'Poll':
     with get_connection() as connection:
         latest_poll = database.get_latest_poll(connection)
         return cls(latest_poll[1], latest_poll[2], latest_poll[0])
示例#4
0
 def latest(cls) -> "Poll":
     with get_connection() as connection:
         poll = database.get_latest_poll(connection)
         return cls(title=poll[1], owner=poll[2], _id=poll[0])
 def latest(cls) -> "Poll":
     connection = pool.getconn()
     poll = database.get_latest_poll()
     pool.putconn(connection)
     return cls(poll[1], poll[2], poll[0])