Repository: incubator-ariatosca Updated Branches: refs/heads/fix-parser-format-tests 7af2168c3 -> c2f21753a (forced update)
Verifing tosca version string Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/c2f21753 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/c2f21753 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/c2f21753 Branch: refs/heads/fix-parser-format-tests Commit: c2f21753ad2a09d8bb8f7e91d2f71108ae8e8569 Parents: b33c70e Author: nirb <[email protected]> Authored: Sun Nov 27 14:52:59 2016 +0200 Committer: nirb <[email protected]> Committed: Tue Nov 29 11:36:47 2016 +0200 ---------------------------------------------------------------------- aria/cli/commands.py | 12 +++++++++--- aria/parser/consumption/presentation.py | 7 ++++--- aria/parser/presentation/source.py | 5 +++++ 3 files changed, 18 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c2f21753/aria/cli/commands.py ---------------------------------------------------------------------- diff --git a/aria/cli/commands.py b/aria/cli/commands.py index 57118a7..17a2564 100644 --- a/aria/cli/commands.py +++ b/aria/cli/commands.py @@ -309,7 +309,7 @@ class ExecuteCommand(BaseCommand): class ParseCommand(BaseCommand): def __call__(self, args_namespace, unknown_args): super(ParseCommand, self).__call__(args_namespace, unknown_args) - + if args_namespace.prefix: for prefix in args_namespace.prefix: URI_LOADER_PREFIXES.append(prefix) @@ -349,9 +349,15 @@ class ParseCommand(BaseCommand): args = vars(namespace).copy() args.update(kwargs) return ParseCommand.create_context(**args) - + @staticmethod - def create_context(uri, loader_source, reader_source, presenter_source, presenter, debug, **kwargs): + def create_context(uri, + loader_source, + reader_source, + presenter_source, + presenter, + debug, + **kwargs): context = ConsumptionContext() context.loading.loader_source = import_fullname(loader_source)() context.reading.reader_source = import_fullname(reader_source)() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c2f21753/aria/parser/consumption/presentation.py ---------------------------------------------------------------------- diff --git a/aria/parser/consumption/presentation.py b/aria/parser/consumption/presentation.py index 4d0f282..38f03f3 100644 --- a/aria/parser/consumption/presentation.py +++ b/aria/parser/consumption/presentation.py @@ -101,9 +101,10 @@ class Read(Consumer): else: try: presenter_class = self.context.presentation.presenter_source.get_presenter(raw) - except PresenterNotFoundError: - # We'll use the presenter class we were given (from the presenter that imported us) - pass + except PresenterNotFoundError, e: + if presenter_class is None: + raise e + # We'll use the presenter class we were given (from the presenter that imported us) if presenter_class is None: raise PresenterNotFoundError('presenter not found') http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c2f21753/aria/parser/presentation/source.py ---------------------------------------------------------------------- diff --git a/aria/parser/presentation/source.py b/aria/parser/presentation/source.py index 6f195d0..a46b361 100644 --- a/aria/parser/presentation/source.py +++ b/aria/parser/presentation/source.py @@ -44,4 +44,9 @@ class DefaultPresenterSource(PresenterSource): if cls.can_present(raw): return cls + if 'tosca_definitions_version' in raw and raw['tosca_definitions_version'] is None: + raise PresenterNotFoundError("'tosca_definitions_version' is not specified") + if not isinstance(raw['tosca_definitions_version'], basestring): + raise PresenterNotFoundError("'tosca_definitions_version' is not a string") + return super(DefaultPresenterSource, self).get_presenter(raw)
