~veebers/autopilot/remove_object_registry-CPO_creation_explicit

« back to all changes in this revision

Viewing changes to autopilot/introspection/dbus.py

  • Committer: Christopher Lee
  • Date: 2015-06-18 23:08:38 UTC
  • Revision ID: chris.lee@canonical.com-20150618230838-gr6od6fwyrlmmv4j
RemoveĀ conversionĀ notes

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
        # Default to None because it's ok to create a default CPO oh or perhaps
85
85
        # default to a default dbus object?
86
86
        """Execute query object 'query' and return the result."""
87
 
        # vvveebers this will need to be updated to take any CPO passed in.
88
 
        # as well as updating the backend code so that it can handle it.
89
87
        return self._backend.execute_query_get_proxy_instances(
90
88
            query,
91
89
            cpo_class,
147
145
            Tutorial Section :ref:`custom_proxy_classes`
148
146
 
149
147
        """
150
 
        # vvveebers this will need updating (docs, and select_child).
151
 
        # Will def need to pass in the CPO class.
152
 
        # (seems that this will reside in execute_query.
153
148
        new_query = self._query.select_child(
154
149
            get_type_name(desired_type),
155
150
            kwargs
156
151
        )
157
152
 
158
 
        return self._execute_query(new_query)
 
153
        return self._execute_query(new_query, desired_type)
159
154
 
160
155
    def get_properties(self):
161
156
        """Returns a dictionary of all the properties on this class.
182
177
        necessarily be immediate children), use :meth:`select_single` and
183
178
        :meth:`select_many`.
184
179
 
 
180
        Note. Any proxy objects return from this call will be generated
 
181
        defaults and will not use any Custom Proxy Object classes.
 
182
 
185
183
        """
186
 
        # vvveebers this will need a note stating that any objects returned
187
 
        # will be just defaults.
188
 
 
189
184
        # Thomi: 2014-03-20: There used to be a call to 'self.refresh_state()'
190
185
        # here. That's not needed, since the only thing we use is the proxy
191
186
        # path, which isn't affected by the current state.
198
193
        If this object has no parent (i.e.- it is the root of the introspection
199
194
        tree). Then it returns itself.
200
195
 
 
196
        Note. Any proxy object return from this call will be generated defaults
 
197
        and will not use any Custom Proxy Object classes.
 
198
 
201
199
        """
202
 
        # vvveebers This might also be an issue as there will be no record of
203
 
        # what CPO to use.
204
200
        new_query = self._query.select_parent()
205
201
        return self._execute_query(new_query)[0]
206
202
 
394
390
        :return: List (possibly empty) of class instances.
395
391
 
396
392
        """
397
 
        # vvveebers this will need a revamp:
398
 
        #  - getting cls_name like this will fail for CPOs with different
399
 
        #  names.
400
 
        #  - this would currently produce a default proxy as the CPO isn't
401
 
        #  passed in: either pass self in (or similar) or perhaps 'from_cpo()'.
402
393
        cls_name = type(self).__name__
403
394
        return self._execute_query(
404
395
            xpathselect.Query.whole_tree_search(cls_name)
411
402
        introspection tree.
412
403
 
413
404
        """
414
 
        # vvveebers undecided if this should take a cpo argument so the
415
 
        # returned object can be instatiated instead of a default.
416
 
        # It appears that currently in use that the expectation is that it's a
417
 
        # default.
418
405
        query = xpathselect.Query.pseudo_tree_root()
419
406
        return self._execute_query(query)[0]
420
407
 
561
548
 
562
549
        """
563
550
 
564
 
        # vvveebers this won't be needed with the newer design. Is there
565
 
        # perhaps a need for something along this line so CPOs are created for
566
 
        # the expected bits?
567
 
 
568
551
        state_name = xpathselect.get_classname_from_path(path)
569
552
        if isinstance(state_name, str):
570
553
            state_name = state_name.encode('utf-8')