You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by ni...@apache.org on 2016/11/29 12:31:52 UTC
incubator-ariatosca git commit: ARIA-27 Verify tosca version string
[Forced Update!]
Repository: incubator-ariatosca
Updated Branches:
refs/heads/master 5965497dd -> b54478b74 (forced update)
ARIA-27 Verify 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/b54478b7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/b54478b7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/b54478b7
Branch: refs/heads/master
Commit: b54478b741213b4be55fac95af21a6fecaf6bf89
Parents: b33c70e
Author: nirb <ni...@gigaspaces.com>
Authored: Sun Nov 27 14:52:59 2016 +0200
Committer: nirb <ni...@gigaspaces.com>
Committed: Tue Nov 29 14:28:10 2016 +0200
----------------------------------------------------------------------
aria/cli/commands.py | 12 +++++++++---
aria/parser/consumption/presentation.py | 5 +++--
aria/parser/presentation/source.py | 7 +++++++
3 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b54478b7/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/b54478b7/aria/parser/consumption/presentation.py
----------------------------------------------------------------------
diff --git a/aria/parser/consumption/presentation.py b/aria/parser/consumption/presentation.py
index 4d0f282..7766473 100644
--- a/aria/parser/consumption/presentation.py
+++ b/aria/parser/consumption/presentation.py
@@ -102,8 +102,9 @@ class Read(Consumer):
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
+ if presenter_class is None:
+ raise
+ # 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/b54478b7/aria/parser/presentation/source.py
----------------------------------------------------------------------
diff --git a/aria/parser/presentation/source.py b/aria/parser/presentation/source.py
index 6f195d0..8ff4cab 100644
--- a/aria/parser/presentation/source.py
+++ b/aria/parser/presentation/source.py
@@ -44,4 +44,11 @@ class DefaultPresenterSource(PresenterSource):
if cls.can_present(raw):
return cls
+ if 'tosca_definitions_version' in raw:
+ if 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")
+ if not raw['tosca_definitions_version']:
+ raise PresenterNotFoundError("'tosca_definitions_version' is not specified")
return super(DefaultPresenterSource, self).get_presenter(raw)