~sandy-walsh/nova/zones

« back to all changes in this revision

Viewing changes to nova/context.py

  • Committer: Sandy Walsh
  • Date: 2011-02-17 21:39:03 UTC
  • mfrom: (635.1.60 nova)
  • Revision ID: sandy.walsh@rackspace.com-20110217213903-swehe88wea8inxow
changed from 003-004 migration

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
 
30
30
class RequestContext(object):
31
 
 
32
31
    def __init__(self, user, project, is_admin=None, read_deleted=False,
33
32
                 remote_address=None, timestamp=None, request_id=None):
34
33
        if hasattr(user, 'id'):
53
52
        self.read_deleted = read_deleted
54
53
        self.remote_address = remote_address
55
54
        if not timestamp:
56
 
            timestamp = datetime.datetime.utcnow()
 
55
            timestamp = utils.utcnow()
57
56
        if isinstance(timestamp, str) or isinstance(timestamp, unicode):
58
57
            timestamp = utils.parse_isotime(timestamp)
59
58
        self.timestamp = timestamp
101
100
        return cls(**values)
102
101
 
103
102
    def elevated(self, read_deleted=False):
104
 
        """Return a version of this context with admin flag set"""
 
103
        """Return a version of this context with admin flag set."""
105
104
        return RequestContext(self.user_id,
106
105
                              self.project_id,
107
106
                              True,