Beispiel #1
0
 def _on_reviews_helper_data(self, spawn_helper, piston_reviews, app):
     # convert into our review objects
     reviews = []
     for r in piston_reviews:
         reviews.append(Review.from_piston_mini_client(r))
     # add to our dicts and emit signal
     self._reviews[app] = reviews
     self.emit("get-reviews-finished", app, self._reviews[app])
     return False
Beispiel #2
0
 def _on_reviews_helper_data(self, spawn_helper, piston_reviews, app, callback):
     # convert into our review objects
     reviews = []
     for r in piston_reviews:
         reviews.append(Review.from_piston_mini_client(r))
     # add to our dicts and run callback
     self._reviews[app] = reviews
     callback(app, self._reviews[app])
     return False
 def _on_submit_review_data(self, spawn_helper, review_json, app, callback):
     """ called when submit_review finished, when the review was send
         successfully the callback is triggered with the new reviews
     """
     LOG.debug("_on_submit_review_data")
     # read stdout from submit_review
     review = ReviewDetails.from_dict(review_json)
     # FIXME: ideally this would be stored in ubuntu-sso-client
     #        but it dosn't so we store it here
     save_person_to_config(review.reviewer_username)
     if not app in self._reviews:
         self._reviews[app] = []
     self._reviews[app].insert(0, Review.from_piston_mini_client(review))
     callback(app, self._reviews[app])
Beispiel #4
0
 def _on_modify_review_finished(self, spawn_helper, review_json, review_id):
     """called when modify_review finished"""
     LOG.debug("_on_modify_review_finished")
     #review_json = spawn_helper._stdout
     mod_review = ReviewDetails.from_dict(review_json)
     for (app, reviews) in self._reviews.items():
         for review in reviews:
             if str(review.id) == str(review_id):
                 # remove the one we don't want to see anymore
                 self._reviews[app].remove(review)
                 new_review = Review.from_piston_mini_client(mod_review)
                 self._reviews[app].insert(0, new_review)
                 self.emit("replace-review", app, new_review)
                 break
Beispiel #5
0
 def _on_submit_review_data(self, spawn_helper, review_json, app):
     """ called when submit_review finished, when the review was send
         successfully the callback is triggered with the new reviews
     """
     LOG.debug("_on_submit_review_data")
     # read stdout from submit_review
     review = ReviewDetails.from_dict(review_json)
     # FIXME: ideally this would be stored in ubuntu-sso-client
     #        but it doesn't so we store it here
     save_person_to_config(review.reviewer_username)
     if not app in self._reviews:
         self._reviews[app] = []
     self._reviews[app].insert(0, Review.from_piston_mini_client(review))
     self.emit("get-reviews-finished", app, self._reviews[app])
Beispiel #6
0
 def _on_modify_review_finished(self, spawn_helper, review_json, review_id):
     """called when modify_review finished"""
     LOG.debug("_on_modify_review_finished")
     #review_json = spawn_helper._stdout
     mod_review = ReviewDetails.from_dict(review_json)
     for (app, reviews) in self._reviews.items():
         for review in reviews:
             if str(review.id) == str(review_id):
                 # remove the one we don't want to see anymore
                 self._reviews[app].remove(review)
                 new_review = Review.from_piston_mini_client(mod_review)
                 self._reviews[app].insert(0, new_review)
                 self.emit("replace-review", app, new_review)
                 break