Github user ran-z commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104515969
  
    --- Diff: aria/modeling/misc.py ---
    @@ -0,0 +1,232 @@
    +# Licensed to the Apache Software Foundation (ASF) under one or more
    +# contributor license agreements.  See the NOTICE file distributed with
    +# this work for additional information regarding copyright ownership.
    +# The ASF licenses this file to You under the Apache License, Version 2.0
    +# (the "License"); you may not use this file except in compliance with
    +# the License.  You may obtain a copy of the License at
    +#
    +#     http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +
    +import cPickle as pickle
    +import logging
    +
    +from sqlalchemy import (
    +    Column,
    +    Text,
    +    Binary
    +)
    +from sqlalchemy.ext.declarative import declared_attr
    +
    +from ..storage import exceptions
    +from ..utils import collections, formatting, console
    +from .bases import InstanceModelMixin, TemplateModelMixin
    +from . import utils
    +
    +
    +class ParameterBase(TemplateModelMixin):
    +    """
    +    Represents a typed value.
    +
    +    This class is used by both service template and service instance 
elements.
    +
    +    :ivar name: Name
    +    :ivar type_name: Type name
    +    :ivar value: Value
    +    :ivar description: Description
    +    """
    +
    +    __tablename__ = 'parameter'
    +
    +    name = Column(Text)
    +    type_name = Column(Text)
    +
    +    # Check: value type
    +    _value = Column(Binary, name='value')
    +    description = Column(Text)
    +
    +    @property
    +    def as_raw(self):
    +        return collections.OrderedDict((
    +            ('name', self.name),
    +            ('type_name', self.type_name),
    +            ('value', self.value),
    +            ('description', self.description)))
    +
    +    @property
    +    def value(self):
    +        if self._value is None:
    +            return None
    +        try:
    +            return pickle.loads(self._value)
    +        except BaseException:
    +            raise exceptions.StorageError('bad format for parameter of 
type "{0}": {1}'.format(
    +                self.type_name, self._value))
    +
    +    @value.setter
    +    def value(self, value):
    +        if value is None:
    +            self._value = None
    +        else:
    +            try:
    +                self._value = pickle.dumps(value)
    +            except (pickle.PicklingError, TypeError):
    +                logging.getLogger('aria').warn('Could not pickle parameter 
of type "{0}": {1}'
    --- End diff --
    
    this needs to raise an error, not log a warning


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to