~paolorotolo/software-center/fix-for-963309

« back to all changes in this revision

Viewing changes to softwarecenter/backend/reviews/rnr.py

  • Committer: Danny Tamez
  • Date: 2012-01-19 16:17:34 UTC
  • mfrom: (2682 trunk)
  • mto: This revision was merged to the branch mainline in revision 2683.
  • Revision ID: danny.tamez@canonical.com-20120119161734-8viwvv83ph9d4kfx
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
 
66
66
    # reviews
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
70
70
            when its ready
71
71
        """
77
77
        if language is None:
78
78
            language = self.language
79
79
        # gather args for the helper
80
 
        try:
81
 
            origin = self.cache.get_origin(app.pkgname)
82
 
        except:
83
 
            # this can happen if e.g. the app has multiple origins, this
84
 
            # will be handled later
85
 
            origin = None
86
 
        # special case for not-enabled PPAs
87
 
        if not origin and self.db:
88
 
            details = app.get_details(self.db)
89
 
            ppa = details.ppaname
90
 
            if ppa:
91
 
                origin = "lp-ppa-%s" % ppa.replace("/", "-")
92
 
        # if there is no origin, there is nothing to do
93
 
        if not origin:
94
 
            callback(app, [])
95
 
            return
96
 
        distroseries = self.distro.get_codename()
 
80
        if relaxed:
 
81
            origin = 'any'
 
82
            distroseries = 'any'
 
83
        else:
 
84
            try:
 
85
                origin = self.cache.get_origin(app.pkgname)
 
86
            except:
 
87
                # this can happen if e.g. the app has multiple origins, this
 
88
                # will be handled later
 
89
                origin = None
 
90
            # special case for not-enabled PPAs
 
91
            if not origin and self.db:
 
92
                details = app.get_details(self.db)
 
93
                ppa = details.ppaname
 
94
                if ppa:
 
95
                    origin = "lp-ppa-%s" % ppa.replace("/", "-")
 
96
            # if there is no origin, there is nothing to do
 
97
            if not origin:
 
98
                callback(app, [])
 
99
                return
 
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,