def _handle_n(self, value):
     if value:
         # TODO: Remove this feature for good in RF 3.3!
         from robot.output import librarylogger
         librarylogger.warn(
             "Ignoring space after '\\n' is deprecated. For more info see: "
             "https://github.com/robotframework/robotframework/issues/3333")
     return '\n'
예제 #2
0
 def _get_variable_value(self, match, ignore_errors):
     match.resolve_base(self, ignore_errors)
     # TODO: Do we anymore need to reserve `*{var}` syntax for anything?
     if match.identifier == '*':
         logger.warn(r"Syntax '%s' is reserved for future use. Please "
                     r"escape it like '\%s'." % (match, match))
         return unic(match)
     try:
         value = self._variables[match]
         if match.items:
             value = self._get_variable_item(match, value)
     except DataError:
         if not ignore_errors:
             raise
         value = unescape(match.match)
     return value
예제 #3
0
 def _validate(self, data):
     # TODO: Remove header and end deprecations in RF 3.3!
     if data._header != 'FOR':
         logger.warn("For loop header '%s' is deprecated. "
                     "Use 'FOR' instead." % data._header)
     if data._end != 'END':
         logger.warn("Marking for loop body with '\\' is deprecated. "
                     "Remove markers and use 'END' instead.")
     if not data.variables:
         raise DataError('FOR loop has no loop variables.')
     for var in data.variables:
         if not is_scalar_var(var):
             raise DataError("Invalid FOR loop variable '%s'." % var)
     if not data.values:
         raise DataError('FOR loop has no loop values.')
     if not data.keywords:
         raise DataError('FOR loop contains no keywords.')
예제 #4
0
 def _get_variable_item(self, name, value, match):
     if match.identifier in '@&':
         var = '%s[%s]' % (name, match.items[0])
         logger.warn("Accessing variable items using '%s' syntax "
                     "is deprecated. Use '$%s' instead." % (var, var[1:]))
     for item in match.items:
         if is_dict_like(value):
             value = self._get_dict_variable_item(name, value, item)
         elif is_list_like(value):
             value = self._get_list_variable_item(name, value, item)
         else:
             raise VariableError(
                 "Variable '%s' is %s, not list or dictionary, and thus "
                 "accessing item '%s' from it is not possible." %
                 (name, type_name(value), item))
         name = '%s[%s]' % (name, item)
     return value
예제 #5
0
 def _is_dict_iteration(self, values):
     all_name_value = True
     for item in values:
         if is_dict_variable(item):
             return True
         if split_from_equals(item)[1] is None:
             all_name_value = False
     if all_name_value:
         name, value = split_from_equals(values[0])
         logger.warn(
             "FOR loop iteration over values that are all in 'name=value' "
             "format like '%s' is deprecated. In the future this syntax "
             "will mean iterating over names and values separately like "
             "when iterating over '&{dict} variables. Escape at least one "
             "of the values like '%s\\=%s' to use normal FOR loop "
             "iteration and to disable this warning." %
             (values[0], name, value))
     return False
예제 #6
0
 def _get_variable_item(self, match, value):
     name = match.name
     if match.identifier in '@&':
         var = '%s[%s]' % (name, match.items[0])
         logger.warn("Accessing variable items using '%s' syntax "
                     "is deprecated. Use '$%s' instead." % (var, var[1:]))
     for item in match.items:
         if is_dict_like(value):
             value = self._get_dict_variable_item(name, value, item)
         elif hasattr(value, '__getitem__'):
             value = self._get_sequence_variable_item(name, value, item)
         else:
             raise VariableError(
                 "Variable '%s' is %s, which is not subscriptable, and "
                 "thus accessing item '%s' from it is not possible. To use "
                 "'[%s]' as a literal value, it needs to be escaped like "
                 "'\\[%s]'." % (name, type_name(value), item, item, item))
         name = '%s[%s]' % (name, item)
     return value
예제 #7
0
 def _get_variable_value(self, match, ignore_errors):
     match.resolve_base(self, ignore_errors)
     # TODO: Do we anymore need to reserve `*{var}` syntax for anything?
     if match.identifier == '*':
         logger.warn(r"Syntax '%s' is reserved for future use. Please "
                     r"escape it like '\%s'." % (match, match))
         return unic(match)
     try:
         value = self._finder.find(match)
         if match.items:
             value = self._get_variable_item(match, value)
         try:
             value = self._validate_value(match, value)
         except VariableError:
             raise
         except:
             raise VariableError("Resolving variable '%s' failed: %s"
                                 % (match, get_error_message()))
     except DataError:
         if not ignore_errors:
             raise
         value = unescape(match.match)
     return value
예제 #8
0
 def _deprecated(self, message, data):
     logger.warn("Error in file '%s' in FOR loop starting on line %s: %s" %
                 (data.source, data.lineno, message))
예제 #9
0
def warn(msg, html=False):
    """Writes the message to the log file using the ``WARN`` level."""
    librarylogger.warn(msg, html)
예제 #10
0
def warn(msg, html=False):
    """Writes the message to the log file using the ``WARN`` level."""
    librarylogger.warn(msg, html)
예제 #11
0
def warn(msg,html=False):
    librarylogger.warn(msg,html)
예제 #12
0
 def _get_reserved_variable(self, match):
     value = match.get_variable(self)
     logger.warn("Syntax '%s' is reserved for future use. Please "
                 "escape it like '\\%s'." % (value, value))
     return value