~mvo/software-center/trivial-restore-state-fix

« back to all changes in this revision

Viewing changes to softwarecenter/backend/piston/sreclient_pristine.py

  • Committer: Michael Vogt
  • Date: 2012-08-29 07:27:51 UTC
  • mfrom: (3098.2.7 software-center)
  • Revision ID: michael.vogt@ubuntu.com-20120829072751-0aq107nkbq5u4kmt
mergedĀ lp:~gary-lasker/software-center/update-to-latest-recommender-client

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
            scheme=PUBLIC_API_SCHEME)
42
42
 
43
43
    @oauth_protected
 
44
    @validate_pattern('uuid', r'[\dabcdef]{32}')
44
45
    @returns_json
45
 
    def recommend_me(self):
46
 
        return self._get('recommend_me/', scheme=AUTHENTICATED_API_SCHEME)
 
46
    def recommend_me(self, uuid):
 
47
        """Fetch personalized (authenticated) recommendations.
 
48
 
 
49
        We still need to submit an UUID to link to the anon profile if
 
50
        it was submitted.
 
51
        """
 
52
        return self._get('recommend_me/%s/' % uuid,
 
53
            scheme=AUTHENTICATED_API_SCHEME)
 
54
 
 
55
    @validate_pattern('uuid', r'[\dabcdef]{32}')
 
56
    def anon_recommend_me(self, uuid):
 
57
        return self._get('recommend_me/%s/' % uuid,
 
58
            scheme=AUTHENTICATED_API_SCHEME)
47
59
 
48
60
    @validate_pattern('pkgname', '[^/]+')
49
61
    @returns_json
72
84
            scheme=AUTHENTICATED_API_SCHEME)
73
85
 
74
86
    @oauth_protected
 
87
    @validate('pkgname', str)
 
88
    @validate_pattern('action', '\w{3,20}')
 
89
    @returns_json
 
90
    def implicit_feedback(self, pkgname, action):
 
91
        data = {
 
92
            'package_name': pkgname,
 
93
            'action': action,
 
94
        }
 
95
        return self._post('implicit_feedback/', data=data,
 
96
                          scheme=AUTHENTICATED_API_SCHEME)
 
97
 
 
98
    @oauth_protected
75
99
    @returns_json
76
100
    @validate('remove', bool)
77
101
    def remove_app(self, appname, remove):