Ejemplo n.º 1
0
 def getVoteValues(self, pointRootKey):
     vote = UserVote.query(            
         UserVote.pointRootKey==pointRootKey, ancestor=self.key).get()
     if vote:
         return vote.value, vote.ribbon
     else:
         return 0, False                    
Ejemplo n.º 2
0
 def getVoteValues(self, pointRootKey):
     vote = UserVote.query(
         UserVote.pointRootKey==pointRootKey, ancestor=self.key).get()
     if vote:
         return vote.value, vote.ribbon
     else:
         return 0, False
 def userVotes(self):
     if not hasattr(self, "_userVotes"):
         votes = UserVote.query(ancestor=self.key)
         # votes = qry.run()
         self._userVotes = {}
         if votes:
             for vote in votes:
                 self._userVotes[vote.pointRootKey] = vote
     return self._userVotes
Ejemplo n.º 4
0
 def _getOrCreateVote(self, pointRootKey):
     vote = UserVote.query(UserVote.pointRootKey == pointRootKey,
                           ancestor=self.key).get()
     if not vote:  # No vote yet, create a new one
         vote = UserVote(pointRootKey=pointRootKey,
                         value=0,
                         ribbon=False,
                         parent=self.key)
     return vote
Ejemplo n.º 5
0
 def _getOrCreateVote(self, pointRootKey):
     vote = UserVote.query(
         UserVote.pointRootKey==pointRootKey, ancestor=self.key).get()
     if not vote:  # No vote yet, create a new one
         vote = UserVote(
             pointRootKey=pointRootKey,
             value=0,
             ribbon=False,
             parent=self.key
         )
     return vote
Ejemplo n.º 6
0
 def getVoteValue_async(self, pointRootKey):
     vote = yield UserVote.query(
         UserVote.pointRootKey==pointRootKey, ancestor=self.key).get_async()
     raise ndb.Return(vote.value if vote else 0)
Ejemplo n.º 7
0
 def getVoteValue(self, pointRootKey):
     vote = UserVote.query(
         UserVote.pointRootKey==pointRootKey, ancestor=self.key).get()
     return vote.value if vote else 0
Ejemplo n.º 8
0
 def getVoteFuture(self, pointRootKey):
     return UserVote.query(
         UserVote.pointRootKey==pointRootKey, ancestor=self.key).get_async()
Ejemplo n.º 9
0
 def getVoteValue_async(self, pointRootKey):
     vote = yield UserVote.query(            
         UserVote.pointRootKey==pointRootKey, ancestor=self.key).get_async()
     raise ndb.Return(vote.value if vote else 0)
Ejemplo n.º 10
0
 def getVoteValue(self, pointRootKey):
     vote = UserVote.query(            
         UserVote.pointRootKey==pointRootKey, ancestor=self.key).get()
     return vote.value if vote else 0
Ejemplo n.º 11
0
 def getVoteFuture(self, pointRootKey):
     return UserVote.query(            
         UserVote.pointRootKey==pointRootKey, ancestor=self.key).get_async()