Author: pekka.klarck
Date: Sat Mar 21 14:18:48 2009
New Revision: 1460

Modified:
   trunk/src/robot/libraries/OperatingSystem.py
   trunk/src/robot/running/keywords.py

Log:
1) No need to write warnings both to log and syslog after warnings to normal log are written to syslog automatically (issue 200), 2) Cleanup

Modified: trunk/src/robot/libraries/OperatingSystem.py
==============================================================================
--- trunk/src/robot/libraries/OperatingSystem.py        (original)
+++ trunk/src/robot/libraries/OperatingSystem.py        Sat Mar 21 14:18:48 2009
@@ -23,7 +23,6 @@

 try:
     from robot.errors import DataError
-    from robot.output import SYSLOG
     from robot.utils import get_version, ConnectionCache, seq2str, \
         timestr_to_secs, secs_to_timestr, plural_or_not, get_time, \
         secs_to_timestamp, timestamp_to_secs
@@ -33,7 +32,6 @@

 except ImportError:
     DataError = RuntimeError
-    SYSLOG = None
     __version__ = '<unknown>'
     seq2str = lambda items: ', '.join(["'%s'" % item for item in items])
     timestr_to_secs = int
@@ -265,7 +263,7 @@
         """
         PROCESSES.switch(index_or_alias)

-    def read_process_output(self, mode='<deprecated>'):
+    def read_process_output(self, mode='DEPRECATED'):
         """Waits for the process to finish and returns its output.

         In Robot Framework versions prior to 2.0.2 it was possible to
@@ -285,11 +283,9 @@
         See `Start Process` and `Switch Process` for more information
         and examples about running processes.
         """
-        if mode != '<deprecated>':
- msg = "'mode' argument for 'Read Process Output' keyword is deprecated."
-            self._log(msg, 'WARN')
-            if SYSLOG:
-                SYSLOG.warn(msg)
+        if mode != 'DEPRECATED':
+ self._warn("'mode' argument for 'Read Process Output' keyword is "
+                       "deprecated and will be removed in RF 2.2.")
         return PROCESSES.current.read()

     def stop_process(self):
@@ -598,8 +594,8 @@
         if mode == 'DEPRECATED':
             open_mode = 'w'
         else:
- self._log("'mode' argument for 'Create File' is deprecated and " - "will be replaced with 'encoding' in RF 2.2.", "WARN") + self._warn("'mode' argument for 'Create File' is deprecated and "
+                       "will be replaced with 'encoding' in RF 2.2.")
             mode = mode.upper()
             if 'FALSE' in mode or 'NO' in mode or "DON'T" in mode:
                 self.file_should_not_exist(path)
@@ -1208,9 +1204,9 @@
if pattern_type == '': # 'absolute' given and 'pat_type' left empty
             pattern_type = 'simple'
         if pattern_type != 'simple':
- self._log("'pattern_type' argument of 'List Directory' keywords "
-                      "has been deprecated. In Robot Framework 2.2 all "
- "patterns are considered simple glob patterns.", "WARN") + self._warn("'pattern_type' argument of 'List Directory' keywords "
+                       "has been deprecated. In Robot Framework 2.2 all "
+                       "patterns are considered simple glob patterns.")
         if pattern:
             items = _filter_lines(items, pattern, pattern_type)
         items.sort()
@@ -1264,6 +1260,9 @@

     def _info(self, msg):
         self._log(msg, 'INFO')
+
+    def _warn(self, msg):
+        self._log(msg, 'WARN')

     def _log(self, msg, level):
         print '*%s* %s' % (level, msg)

Modified: trunk/src/robot/running/keywords.py
==============================================================================
--- trunk/src/robot/running/keywords.py (original)
+++ trunk/src/robot/running/keywords.py Sat Mar 21 14:18:48 2009
@@ -174,14 +174,12 @@
         self._error = None
         Keyword.__init__(self, kwdata.name, kwdata.args, 'repeat')
         data = ['%s x' % kwdata.repeat, kwdata.name] + kwdata.args
-        self._syntax_example = '| %s |' % ' | '.join(data)
+        self._example = '| %s |' % ' | '.join(data)

     def _run(self, handler, output, namespace):
-        msg = ("Repeating keywords using the special syntax like '%s' "
-               "is deprecated and will be removed in Robot Framework 2.2. "
- "Use 'BuiltIn.Repeat Keyword' instead." % self._syntax_example)
-        output.warn(msg)
-        output.syslog.warn(msg)
+ output.warn("Repeating keywords using the special syntax like '%s' is " + "deprecated and will be removed in Robot Framework 2.2. " + "Use 'BuiltIn.Repeat Keyword' instead." % self._example)
         if self._error is not None:
             output.fail(self._error)
             raise ExecutionFailed(self._error)

Reply via email to