67
67
def get_reviews(self, translated_app, callback, page=1,
68
language=None, sort=0):
68
language=None, sort=0, relaxed=False):
69
69
""" public api, triggers fetching a review and calls callback
77
77
if language is None:
78
78
language = self.language
79
79
# gather args for the helper
81
origin = self.cache.get_origin(app.pkgname)
83
# this can happen if e.g. the app has multiple origins, this
84
# will be handled later
86
# special case for not-enabled PPAs
87
if not origin and self.db:
88
details = app.get_details(self.db)
91
origin = "lp-ppa-%s" % ppa.replace("/", "-")
92
# if there is no origin, there is nothing to do
96
distroseries = self.distro.get_codename()
85
origin = self.cache.get_origin(app.pkgname)
87
# this can happen if e.g. the app has multiple origins, this
88
# will be handled later
90
# special case for not-enabled PPAs
91
if not origin and self.db:
92
details = app.get_details(self.db)
95
origin = "lp-ppa-%s" % ppa.replace("/", "-")
96
# if there is no origin, there is nothing to do
100
distroseries = self.distro.get_codename()
97
101
# run the command and add watcher
98
102
cmd = [os.path.join(softwarecenter.paths.datadir, PistonHelpers.GET_REVIEWS),
99
103
"--language", language,
130
134
LOG.debug("refresh with days_delta: %s" % days_delta)
135
# FIXME: the server currently has bug (#757695) so we
136
# can not turn this on just yet and need to use
137
# the old "catch-all" review-stats for now
132
139
#distroseries = self.distro.get_codename()
134
softwarecenter.paths.datadir, PistonHelpers.GET_REVIEW_STATS),
135
# FIXME: the server currently has bug (#757695) so we
136
# can not turn this on just yet and need to use
137
# the old "catch-all" review-stats for now
139
#"--distroseries", distroseries,
140
spawn_helper = SpawnHelper()
141
spawn_helper.connect("data-available", self._on_review_stats_data, callback)
142
cmd += ["--days-delta", str(days_delta)]
143
spawn_helper = SpawnHelper()
144
spawn_helper.connect("data-available", self._on_review_stats_data, callback)
145
spawn_helper.run(cmd)
143
spawn_helper.run_generic_piston_helper(
144
"RatingsAndReviewsAPI", "review_stats", days=days_delta)
146
spawn_helper.run_generic_piston_helper(
147
"RatingsAndReviewsAPI", "review_stats")
147
149
def _on_review_stats_data(self, spawn_helper, piston_review_stats, callback):
148
150
""" process stdout from the helper """
149
151
review_stats = self.REVIEW_STATS_CACHE