~pieq/checkbox/lp1464195-double-clicking

« back to all changes in this revision

Viewing changes to checkbox-support/checkbox_support/lib/dmi.py

  • Committer: Daniel Manrique
  • Author(s): Daniel Manrique
  • Date: 2015-06-02 17:49:48 UTC
  • mfrom: (3817.2.6 launchpad/dmi-parser-stuff)
  • Revision ID: daniel_manrique-20150602174948-5s43resj0cqbtwmg
"Extends the DMI parser to capture all the attributes from dmidecode records (not just the ones that map to checkbox's concept of a "device"). This includes  DMI parser changes with unit tests, plainbox dev parse entry point and configuration, and integration with the submission parser, including integration tests. [r=zyga][bug=][author=roadmr]"

Show diffs side-by-side

added added

removed removed

Lines of Context:
245
245
    def form(self):
246
246
        attribute = "%s_form" % self.category.lower()
247
247
        return self._attributes.get(attribute)
 
248
 
 
249
    @property
 
250
    def raw_attributes(self):
 
251
        """
 
252
        Access "raw" non-collapsed DMI data.
 
253
 
 
254
        The well-known accessor methods allow direct access
 
255
        to the essential and usually-always-present DMI
 
256
        attributes. But to access other less-known, custom
 
257
        attributes, raw_attribute can be used.
 
258
 
 
259
        DMI keys, or field names/identifiers, are converted
 
260
        to lowercase, spaces are replaced with underscores,
 
261
        and they're stored as-is in the _attributes dictionary.
 
262
 
 
263
        Returns a dictionary with each data item from self._attributes
 
264
        but with the prefix ("self.category.lower()_") removed.
 
265
        """
 
266
        # Note a dict comprehension is not used out of fear of python 2.x.
 
267
        return dict([(k.replace("%s_" % self.category.lower(), "", 1), v)
 
268
                    for k, v in self._attributes.items()])