~soren/nova/austin-versioning

« back to all changes in this revision

Viewing changes to nova/api/openstack/__init__.py

  • Committer: Tarmac
  • Author(s): Eric Day
  • Date: 2010-10-16 08:19:04 UTC
  • mfrom: (352.2.2 lp660668)
  • Revision ID: hudson@openstack.org-20101016081904-thc0g2ywxqc1o9h1
Added test case to reproduce bug #660668 and provided a fix by using the user_id from the auth layer instead of the username header.

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
        If the request should be rate limited, return a 413 status with a 
107
107
        Retry-After header giving the time when the request would succeed.
108
108
        """
109
 
        username = req.headers['X-Auth-User']
 
109
        user_id = req.environ['nova.context']['user']['id']
110
110
        action_name = self.get_action_name(req)
111
111
        if not action_name: # not rate limited
112
112
            return self.application
113
 
        delay = self.get_delay(action_name, username)
 
113
        delay = self.get_delay(action_name, user_id)
114
114
        if delay:
115
115
            # TODO(gundlach): Get the retry-after format correct.
116
116
            exc = webob.exc.HTTPRequestEntityTooLarge(