Beispiel #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                    
 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
Beispiel #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
 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
 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)
 def getVoteValue(self, pointRootKey):
     vote = UserVote.query(
         UserVote.pointRootKey==pointRootKey, ancestor=self.key).get()
     return vote.value if vote else 0
 def getVoteFuture(self, pointRootKey):
     return UserVote.query(
         UserVote.pointRootKey==pointRootKey, ancestor=self.key).get_async()
Beispiel #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)
Beispiel #10
0
 def getVoteValue(self, pointRootKey):
     vote = UserVote.query(            
         UserVote.pointRootKey==pointRootKey, ancestor=self.key).get()
     return vote.value if vote else 0
Beispiel #11
0
 def getVoteFuture(self, pointRootKey):
     return UserVote.query(            
         UserVote.pointRootKey==pointRootKey, ancestor=self.key).get_async()