Commits

Tetsuya Morimoto committed 1e46203

dropped E501 E701 from pep8ignore list

Comments (0)

Files changed (5)

 tag_svn_revision = true
 
 [pytest]
-pep8ignore = E128 E302 E501 E701
+pep8ignore = E128 E302
                 try:
                     listener.onStartTask(task)
                 except Exception, e:
-                    self.env.log.warn("listener %s failed  onStartTask event : %s" % (str(listener), exception_to_unicode(e)))
+                    msg = 'listener %s failed  onStartTask event : %s' % (
+                          str(listener), exception_to_unicode(e))
+                    self.env.log.warn(msg)
 
     def _notify_end_task(self, task, success=True):
         for listener in self.task_event_list:
                 try:
                     listener.onEndTask(task, success)
                 except Exception, e:
-                    self.env.log.warn("listener %s failed  onEndTask event : %s" % (str(listener), exception_to_unicode(e)))
+                    msg = 'listener %s failed  onEndTask event : %s' % (
+                          str(listener), exception_to_unicode(e))
+                    self.env.log.warn(msg)
 
     def _runTask(self, task, schedule=None, parameters=None):
         task_id = task.getId()
         return 'cron_listener.html', data
 
     def _saveSettings(self, req, category, page):
-        arg_name_list = [self.cronconf.TICKER_ENABLED_KEY, self.cronconf.TICKER_INTERVAL_KEY]
+        arg_name_list = [self.cronconf.TICKER_ENABLED_KEY,
+                         self.cronconf.TICKER_INTERVAL_KEY]
         for task in self.cron_task_list:
             task_id = task.getId()
-            arg_name_list.append(task_id + "." + self.cronconf.TASK_ENABLED_KEY)
+            arg_name_list.append('%s.%s' % (task_id,
+                                            self.cronconf.TASK_ENABLED_KEY))
             for schedule in self.all_schedule_type:
                 schedule_id = schedule.getId()
-                arg_name_list.append(task_id + "." + schedule_id)
-                arg_name_list.append(task_id + "." + schedule_id + "." + self.cronconf.SCHEDULE_ENABLED_KEY)
-                arg_name_list.append(task_id + "." + schedule_id + "." + self.cronconf.SCHEDULE_ARGUMENT_KEY)
+                arg_name_list.append('%s.%s' % (task_id, schedule_id))
+                arg_name_list.append('%s.%s.%s' % (task_id, schedule_id,
+                                     self.cronconf.SCHEDULE_ENABLED_KEY))
+                arg_name_list.append('%s.%s.%s' % (task_id, schedule_id,
+                                     self.cronconf.SCHEDULE_ARGUMENT_KEY))
 
         for arg_name in arg_name_list:
-            arg_value = req.args.get(arg_name, "").strip()
-            self.env.log.debug("receive req arg " + arg_name + "=[" + arg_value + "]")
-            if (arg_value == ""):
+            arg_value = req.args.get(arg_name, '').strip()
+            self.env.log.debug('request args: %s=[%s]' % (arg_name, arg_value))
+            if (arg_value == ''):
                 # dont't remove the key because of default value may be True
-                if (arg_name.endswith(("." + self.cronconf.TASK_ENABLED_KEY, "." + self.cronconf.SCHEDULE_ENABLED_KEY))):
-                    self.cronconf.set_value(arg_name, "False")
+                if arg_name.endswith('.' + self.cronconf.TASK_ENABLED_KEY,
+                                     '.' + self.cronconf.SCHEDULE_ENABLED_KEY):
+                    self.cronconf.set_value(arg_name, 'False')
                 else:
                     # otherwise we can remove the key
                     self.cronconf.remove_value(arg_name)
         arg_name_list = []
         for listener in self.cron_listener_list:
             listener_id = listener.getId()
-            arg_name_list.append(listener_id + "." + self.cronconf.TASK_LISTENER_ENABLED_KEY)
+            arg_name_list.append('%s.%s' % (listener_id,
+                                 self.cronconf.TASK_LISTENER_ENABLED_KEY))
 
         for arg_name in arg_name_list:
-            arg_value = req.args.get(arg_name, "").strip()
-            self.env.log.debug("receive req arg " + arg_name + "=[" + arg_value + "]")
-            if (arg_value == ""):
+            arg_value = req.args.get(arg_name, '').strip()
+            self.env.log.debug('request args: %s=[%s]' % (arg_name, arg_value))
+            if (arg_value == ''):
                 # dont't remove the key because of default value may be True
-                if (arg_name.endswith("." + self.cronconf.TASK_ENABLED_KEY)):
-                    self.cronconf.set_value(arg_name, "False")
+                if (arg_name.endswith('.' + self.cronconf.TASK_ENABLED_KEY)):
+                    self.cronconf.set_value(arg_name, 'False')
                 else:
                     # otherwise we can remove the key
                     self.cronconf.remove_value(arg_name)
         taskWithId = filter(lambda x: x.getId() == taskId, self.cron_task_list)
 
         if len(taskWithId) == 0:
-            self.env.log.error("The task with id %s was not found" % taskId)
-            add_warning(req, "The task with id %s was not found" % taskId)
+            single_msg = 'The task with id %s was not found' % taskId
+            self.env.log.error(single_msg)
+            add_warning(req, single_msg)
             req.redirect(req.href.admin('traccron', 'cron_admin'))
         elif len(taskWithId) > 1:
-            self.env.log.error("Multiple task with id %s was not found" % taskId)
-            add_warning(req, "Multiple task with id %s was not found" % taskId)
+            multi_msg = 'Multiple task with id %s was not found' % taskId
+            self.env.log.error(multi_msg)
+            add_warning(req, multi_msg)
             req.redirect(req.href.admin('traccron', 'cron_admin'))
         else:
             task = taskWithId[0]

src/traccron/listener.py

         self.success = success
 
 
-class NotificationEmailTaskEvent(Component, ITaskEventListener, ITemplateProvider):
+class NotificationEmailTaskEvent(Component, ITaskEventListener,
+                                 ITemplateProvider):
     """
     This task listener send notification mail about task event.
     """

src/traccron/scheduler.py

         Universal set - match everything
         Stand for * in cron expression
         """
-        def __contains__(self, item): return True
+        def __contains__(self, item):
+            return True
 
     class OmitMatch(AllMatch):
         """

tests/test_cronconf.py

 
 
 def test_is_task_listener_enabled(cronconf, history_task_event):
-    default_value = eval(CronConfig.TASK_LISTENER_ENABLED_DEFAULT)
-    assert default_value is cronconf.is_task_listener_enabled(history_task_event)
+    def_value = eval(CronConfig.TASK_LISTENER_ENABLED_DEFAULT)
+    assert def_value is cronconf.is_task_listener_enabled(history_task_event)
 
 def test_set_task_listener_enabled(cronconf, history_task_event):
     cronconf.set_task_listener_enabled(history_task_event, True)