~ubuntu-branches/ubuntu/trusty/python-heatclient/trusty

« back to all changes in this revision

Viewing changes to heatclient/common/base.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-07-19 13:04:38 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130719130438-95oatgbus97v9b8u
Tags: 0.2.3-0ubuntu1
* New upstream release. 
* Enabled testsuite.
* debian/control:
  - Dropped python-nose.
  - Add python-fixtures.
  - Add python-testscenarios.
  - Add python-testrepository.
  - Add python-testtools.
  - Add python-d2to1.
  - Add python-pbr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
 
31
31
def getid(obj):
32
 
    """
 
32
    """Get by object or ID.
 
33
 
33
34
    Abstracts the common pattern of allowing both an object or an object's ID
34
35
    (UUID) as a parameter when dealing with relationships.
35
36
    """
40
41
 
41
42
 
42
43
class Manager(object):
43
 
    """
44
 
    Managers interact with a particular type of API (servers, flavors, images,
45
 
    etc.) and provide CRUD operations for them.
 
44
    """Managers interact with a particular type of API.
 
45
 
 
46
    For example servers, flavors and images.
 
47
    It provides CRUD operations for these objects.
46
48
    """
47
49
    resource_class = None
48
50
 
69
71
 
70
72
 
71
73
class Resource(object):
72
 
    """
73
 
    A resource represents a particular instance of an object (tenant, user,
74
 
    etc). This is pretty much just a bag for attributes.
 
74
    """A resource represents a particular instance of an object.
 
75
 
 
76
    For example tenant or user. This is pretty much just a bag for attributes.
75
77
 
76
78
    :param manager: Manager object
77
79
    :param info: dictionary representing resource attributes
99
101
            return self.__dict__[k]
100
102
 
101
103
    def __repr__(self):
102
 
        reprkeys = sorted(k for k in self.__dict__.keys() if k[0] != '_' and
103
 
                                                                k != 'manager')
 
104
        reprkeys = sorted(k for k in self.__dict__.keys()
 
105
                          if k[0] != '_' and k != 'manager')
104
106
        info = ", ".join("%s=%s" % (k, getattr(self, k)) for k in reprkeys)
105
107
        return "<%s %s>" % (self.__class__.__name__, info)
106
108