Mercurial > bitten > bitten-test
changeset 798:fcdc7fa56b1f
Support `resource_exists()` as new API feature called by Trac attachment code follwing trac:changeset:9724.
author | osimons |
---|---|
date | Fri, 21 May 2010 08:23:28 +0000 |
parents | 031ce03d2baf |
children | 6f809c041a73 |
files | bitten/main.py |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/bitten/main.py +++ b/bitten/main.py @@ -152,6 +152,16 @@ self.log.error("Unknown build/config resource.id: %s" % resource.id) return 'Unknown Build or Config' + def resource_exists(self, resource): + config_name, build_id = self._parse_resource(resource.id) + if build_id: + build = Build.fetch(self.env, build_id) + return build and build.exists or False + elif config_name: + config = BuildConfig.fetch(self.env, config_name) + return config and config.exists or False + return False + def _parse_resource(self, resource_id): """ Returns a (config_name, build_id) tuple. """ r = resource_id.split('/', 1)