コード例 #1
0
    def __init__(self, slacker, slackbot, activated, logger=None):
        """
        slacker is a Slacker() object
        slackbot should be an initialized slackbot.Slackbot() object
        activated is a boolean indicating whether destalinator should do dry runs or real runs
        """
        self.closure_text = utils.get_local_file_content(
            self.closure_text_fname)
        self.warning_text = utils.get_local_file_content(
            self.warning_text_fname)
        self.slacker = slacker
        self.slackbot = slackbot
        self.user = os.getenv("USER")
        self.config = config.Config()
        self.output_debug_to_slack_flag = False
        if os.getenv(self.config.output_debug_env_varname):
            self.output_debug_to_slack_flag = True

        self.logger = logger or logging.getLogger(__name__)

        self.destalinator_activated = activated
        self.logger.debug("destalinator_activated is %s",
                          self.destalinator_activated)

        self.earliest_archive_date = self.get_earliest_archive_date()

        self.cache = {}
        self.now = int(time.time())
コード例 #2
0
    def __init__(self, slacker, slackbot, activated, logger=None):
        """
        slacker is a Slacker() object
        slackbot should be an initialized slackbot.Slackbot() object
        activated is a boolean indicating whether destalinator should do dry runs or real runs
        """
        self.closure_text = utils.get_local_file_content(self.closure_text_fname)
        self.warning_text = utils.get_local_file_content(self.warning_text_fname)
        self.slacker = slacker
        self.slackbot = slackbot
        self.user = os.getenv("USER")
        self.config = config.Config()
        self.output_debug_to_slack_flag = False
        if os.getenv(self.config.output_debug_env_varname):
            self.output_debug_to_slack_flag = True

        self.logger = logger or logging.getLogger(__name__)

        self.destalinator_activated = activated
        self.logger.debug("destalinator_activated is %s", self.destalinator_activated)

        self.earliest_archive_date = self.get_earliest_archive_date()

        self.cache = {}
        self.now = int(time.time())
コード例 #3
0
    def __init__(self, slacker, slackbot, activated):
        """
        slacker is a Slacker() object
        slackbot should be an initialized slackbot.Slackbot() object
        activated is a boolean indicating whether destalinator should do dry runs or real runs
        """
        self.closure_text = utils.get_local_file_content(self.closure_text_fname)
        self.warning_text = utils.get_local_file_content(self.warning_text_fname)
        self.slacker = slacker
        self.slackbot = slackbot

        self.config.activated = activated
        self.logger.debug("activated is %s", self.config.activated)

        self.earliest_archive_date = self.get_earliest_archive_date()

        self.cache = {}
        self.now = int(time.time())
コード例 #4
0
 def test_unicode_file_content(self):
     content = utils.get_local_file_content("tests/content_unicode.txt")
     self.assertIn(u'’', content)
コード例 #5
0
 def test_ascii_file_content(self):
     content = utils.get_local_file_content("tests/content_ascii.txt")
     self.assertIn(u"'", content)
コード例 #6
0
 def test_unicode_file_content(self):
     content = utils.get_local_file_content("tests/content_unicode.txt")
     self.assertIn(u'’', content)
コード例 #7
0
 def test_ascii_file_content(self):
     content = utils.get_local_file_content("tests/content_ascii.txt")
     self.assertIn(u"'", content)