This repository has been archived by the owner on Feb 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Storing Resources
mattbasta edited this page Aug 5, 2011
·
2 revisions
Validation error bundles support the ability to save and retrieve resources from a key-value store. If the resource doesn't exist yet, False
is returned as the default value. This is incredibly handy for things like retrieving the chrome.manifest
file during validation without needing to re-parse the file:
@decorator.register_test(tier=2) def some_test_case(err, xpi_package): chrome = err.get_resource("chrome.manifest") if not chrome: return # If there's no manifest, just skip the test # ... perform logic on `chrome` ...
How beautiful! To store data, a similar convention is used:
@decorator.register_test(tier=2) def some_test_case(err, xpi_package): # ... perform logic on `chrome` ... err.save_resource("chrome.manifest", chrome, pushable=True)
get_resource(name)
- Retrieve the value stored in the error bundle with the key
name
. If it cannot be found,False
is returned. save_resource(name, resource, pushable=False)
- Save the value
resource
with the keyname
. If pushable isTrue
, the value will be made unavailable when the state is pushed with thepush_state
function (until the state has been popped).
This is a list of all of the known resources that the validator defines.
bad_install_rdf: |
True if the install.rdf is invalid. |
---|---|
chrome.manifest: | The ChromeManifest for chrome.manifest if present. Saved with pushable set to True to prevent tests from being run multiple times on the ``chrome.manifest` file with subpackages. |
chrome.manifest_nopush: | Same as chrome.manifest , but with pushable set to False . Useful for accessing the manifest data from within subpackages. |
em:bootstrap: | The string value of em:bootstrap from install.rdf if present. |
em:unpack: | The string value of em:unpack from install.rdf if present. |
ff4: |
True if the add-on has Firefox 4 support. |
has_install_rdf: |
True if the add-on has an install.rdf file. |
install_rdf: | The RDFParser for install.rdf if present. |
is_multipackage: |
True if the add-on is a multiple extension package (<em:type>32</em:type> ). |
marked_scripts: | A set of chrome URLs of scripts that are marked as pollutable. |
pretested_files: | A list of files in the add-on which are "pre-approved". |
SPIDERMONKEY: | An override for the SPIDERMONKEY_INSTALLATION constant from validator.constants . Ignored if the value is False , JS tests skipped if the value is None . |
supports: | A list of applications supported by the add-on. Names from validator.constants.APPLICATIONS . |