def dogOwnerRoleConfirmed (role_key, user_id): role = role_key.get() profile_key = Profile.byUserId(user_id) query = TerveyskyselySubmission.gql("WHERE koira = :1 and answered_by = :2", role.dog, profile_key) for submission in query: logging.info("roleConfirmed: %s" % submission) submission.owner_confirmed = True submission.Put()
def post_(self, user): submission = TerveyskyselySubmission() submission.populateFromRequest(self.request.Params) if user: submission.answered_by = Profile.byUser(user) else: # Used for validating the submission via email link. submission.confirmation_code = uuid.uuid4().hex submission.submitter_confirmed = False submission.owner_confirmed = False submission.Put() if user: deferred.defer(processSubmission, user.user_id(), user.nickname(), submission.key) else: deferred.defer(requestEmailConfirmation, submission.key) self.jsonReply(submission.hashify())